These are chat archives for thunder-project/thunder

28th
Jun 2017
Kyle
@kr-hansen
Jun 28 2017 21:28
@d-v-b @jwittenbach @boazmohar Is there a straightforward way to concatenate opened tifs using thunder? I have a list of direct paths to multipage tifs within a folder such as mylist = ['/path/to/tif1.tif', '/path/to/tif2.tif']. I can use td.images.fromtif(mylist[0], nplanes=1) to load the first multipage tif and td.images.fromtif(mylist[1], nplanes=1) to load the second multipage tif just fine. I know that if I pass td.images.fromtif('/path/to/', nplanes=1) it will open all the tifs in that directory, but I may not want to open all the tifs in that particular directory. I was thinking something like td.images.fromlist might work, but from what I understand the accessor function can only take an input of 1 argument, correct? I wouldn't be able to pass it both mylist and a list of the iteration values through mylist. Does something currently exist that can handle this?
Davis Bennett
@d-v-b
Jun 28 2017 21:37
@kyle I don't think I understand correctly how your data are structured. can you describe what shape you want the final thunder object to be?
if you did td.images.fromlist(list_of_filenames, accessor=function_that_loads_a_tif_stack) then thunder would make an images object with shape [num_images, image_dimension_0, image_dimension_1, image_dimension_2...]
Davis Bennett
@d-v-b
Jun 28 2017 21:47
also, for td.images.fromlist() the accessor function takes a single argument, but that argument could be a list or a tuple (or anything you can put in a list)
Kyle
@kr-hansen
Jun 28 2017 23:52

@d-v-b So for a simple example, I have 2 multipage tifs, that are each 1024x1024 pixels. Each tif has 1000 pages, so the data are (1000, 1024, 1024). The multipage tifs are acquired sequentially, so I want the final data to be (2000, 1024, 1024). I can get the locations of the tifs in a list, [/path/to/tif1.tif, /path/to/tif2.tif]. So if for my accessor function, I made a function that basically said

def loadmystack(fn): import thunder as td td.images.fromtif(fn, nplanes=1)

That should work? It didn't seem like it would work that way to me from reading what fromlist() said. I can try that tomorrow when I'm near my data and have access again to it though if you think that will work.

Davis Bennett
@d-v-b
Jun 28 2017 23:59
first off I think this is kind of a tricky case for any distributed computing situation -- you have single files that contain lots of timepoints, which means it's hard for multiple workers to load data in parallel