Open ashwin-miriyala opened 3 months ago
Hello, Right now I think the easiest route would be for you to preprocess the data to remove the extra dimension; I don't think we've ever run into someone doing things they way you describe before, and adding code to support too many data layout variations would make things hard to maintain.
Yea scanimage does bizarre things, IIRC it does that if the acquisition was stopped midway, if all frames that were set to be recorded were not recorded it just leave the tiff file like that there. Anyways, as Pat said you have to save them to two separate files.
Please fill in the following for any issues
Your setup:
Using scanimage, I have recorded a tif file that carries frames from 2 channels. These frames are interleaved, i.e. channel 1 is on odd frames and channel 2 is on even frames in the tif file. I thought I would run motion correction on the entire tif file and then worry about de-interleaving afterwards. However, while running motion correction, there is a step where the shape of the tiff file is read, and it doesn't account for the extra dimention that mentions the number of channels. I've found an example of where this occurs (in utilities.py):
dims, T = cm.source_extraction.cnmf.utilities.get_file_size(fname, var_name_hdf5=var_name_hdf5)
within this definition 'get_file_size'... ... if extension in ['.tif', '.tiff', '.btf']: tffl = tifffile.TiffFile(file_name) siz = tffl.series[0].shape
tiff files written in append mode
Here, my tif file returns dimensions (2056,2,256,256). If there was only one channel during acquisition, the size would be (2056,256,256). I'm not sure if this problem stems from the tifffile class or the scanimage software that saves the tif file.
While a workaround would be simple for this particular definition, I'm not sure how many other definitions I'd need to update. Do you think this is a valid problem? Or should I deinterleave and make sure of only 1 channel per tif file and appropriate dimensions before running motion correction?
Thanks!