Closed niallmacq closed 7 years ago
Hi Niall, See the 'TIFFs' option for initializing Sequence objects when your data is saved as a series of individual .tiff images here: http://www.losonczylab.org/sima/1.3.2/api/sequence.html#sima.Sequence.create
Hi nbdanielson, I second this question. The 'TIFFs' option gives a method to create sequences with each single tiff file creating a plane, but no way to use each single tiff file as a frame. So after putting together the sequence of 10 frames (210x420), 2 channels, I get a (1, 10L, 210L, 420L, 2L) sequence instead of (10L, 1L, 210L, 420L, 2L). Is there a method to change the dimensions, without casting to numpy.array?
Hi @YishGene, What was the command you called to initialize the Sequence object?
Hi @nbdanielson , Thanks for the quick reply!
this is a snippet of the call that gives me a plane for each tiff file:
#Generate the filenames (first 100 files only)
ch1 = glob.glob(dirname + os.path.sep + 'TSeries*Ch1*.tif')
ch2 = glob.glob(dirname + os.path.sep + 'TSeries*Ch2*.tif')
tiff_filenames100 = [[ch1[ind], ch2[ind]] for ind in range(100)]
sequences100 = sima.Sequence.create('TIFFs', tiff_filenames100)
... if I add this, I'm good (nice results!), but I would like to avoid the numpy.array cast:
arr = np.array(sequences100)
tarr = arr.transpose([1, 0, 2, 3, 4])
sequencesa = sima.Sequence.create('ndarray', tarr)
You should not have to cast as np.array for this to work. I have a simple example here that I verified works:
1 channel with 3 frames ('im1.tif', 'im2.tif', 'im3.tif')
So I can call:
In [1]: images = [['im*.tif']]
In [2]: from sima import Sequence
In [3]: seq = Sequence.create('TIFFs', images)
In [4]: seq.shape
Out[4]: (3, 1, 128, 256, 1)
In your example, because you have two channels, you'd probably want something like
In [1]: images = [['TSeries*Ch1*.tif', 'TSeries*Ch2*.tif']]
I gave this a try, unfortunately I can't get it to work. This code:
import sima
tiff_filenames = [['TSeries*Ch1*', 'TSeries*Ch2*']]
sequences = sima.Sequence.create('TIFFs', tiff_filenames)
sequences.shape
gave me the following error:
IndexError: index 0 is out of bounds for axis 0 with size 0
with multiple attempts (only 2 files in the directory, no folders, all files, different glob patterns, etc.).
Can you upload a small bit of your data (e.g. 5 frames from each channel), so I can take a look?
On Mon, Nov 14, 2016 at 5:03 PM, Yishai Elyada notifications@github.com wrote:
I gave this a try, unfortunately I can't get it to work. This code:
import sima tiff_filenames = [['TSeriesCh1', 'TSeriesCh2']] sequences = sima.Sequence.create('TIFFs', tiff_filenames) sequences.shape
gave me the following error: IndexError: index 0 is out of bounds for axis 0 with size 0
with multiple attempts (only 2 files in the directory, no folders, all files, different glob patterns, etc.).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/losonczylab/sima/issues/229#issuecomment-260477891, or mute the thread https://github.com/notifications/unsubscribe-auth/AH9T4r3kWyPy2yj5qWxxSGwslTsl3JGqks5q-NrKgaJpZM4KfArp .
No problem.
I just downloaded your data, and this worked fine for me...keep in mind I ran this from the directory in which the data was located (i.e. an ls
command returned the list of filenames)
In [7]: images = [['*Ch1*.tif', '*Ch2*.tif']]
In [8]: seq = Sequence.create('TIFFs', images)
In [9]: seq.shape
Out[9]: (5, 1, 210, 420, 2)
What version are you running?
Got it. Embarrassingly enough, there's a "Set as current console's working directory" in spyder that I missed, so I was in the wrong path. I thought keying it into the path bar was enough. Sorry for troubling you!
No worries, glad it works!
On Mon, Nov 14, 2016 at 5:44 PM, Yishai Elyada notifications@github.com wrote:
Got it. Embarrassingly enough, there's a "Set as current console's working directory" in spyder that I missed, so I was in the wrong path. I thought keying it into the path bar was enough. Sorry for troubling you!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/losonczylab/sima/issues/229#issuecomment-260487950, or mute the thread https://github.com/notifications/unsubscribe-auth/AH9T4qrG_66xqlHaZPnXtPJdAfCPIKpRks5q-ORVgaJpZM4KfArp .
I would like to use your SIMA code to look at a single channel time-lapse stack of calcium images. These signals look very similar to those used in your neuron paper and I would like to segment them based on the similarity of calcium fluorescence in adjacent pixels.
I have a decent level of python programming knowledge, and would like to use you’re the module to use my tiff images, instead of in your dataset. I’ve had a look on your git repro, but can’t find an easy way to import in the dataset format. Could you help?