soft-matter / trackpy-examples

sample images, examples, and speed tests for trackpy
Other
22 stars 42 forks source link

ImageSequenceND is not working #48

Open tikkita opened 5 years ago

tikkita commented 5 years ago

Hi, I am pretty new to python. I was trying to use 3d tracking for my stack of images which are as z and t index separated png files, then made a .zip file to use the ImageSequenceND. But no matter what I do I always get the "index is out of bounds" error. I am unable to understand the problem after so many attempts and would really appreciate the help. Here is what I tried, and the output I get.


IndexError Traceback (most recent call last)

in () ----> 1 images=pims.ImageSequenceND('./tiffstacks.zip',axes_identifiers = ['z', 't']) ~/anaconda3/lib/python3.6/site-packages/pims/image_sequence.py in __init__(self, path_spec, process_func, dtype, as_grey, plugin, axes_identifiers) 430 self.axes_identifiers = axes_identifiers 431 ImageSequence.__init__(self, path_spec, process_func, --> 432 dtype, as_grey, plugin) 433 shape = self._first_frame_shape 434 if len(shape) == 2: ~/anaconda3/lib/python3.6/site-packages/pims/image_sequence.py in __init__(self, path_spec, process_func, dtype, as_grey, plugin) 93 self._is_zipfile = False 94 self._zipfile = None ---> 95 self._get_files(path_spec) 96 97 tmp = self.imread(self._filepaths[0], **self.kwargs) ~/anaconda3/lib/python3.6/site-packages/pims/image_sequence.py in _get_files(self, path_spec) 468 for f in self._filepaths]) 469 for n, name in enumerate(self.axes_identifiers): --> 470 if np.all(self._toc[:, n] == 0): 471 self._toc = np.delete(self._toc, n, axis=1) 472 else: IndexError: index 1 is out of bounds for axis 1 with size 1
nkeim commented 5 years ago

Does it work if you just put the TIFF files in a directory, and then call ImageSequenceND with “mydir/*.tif”? The sequence does not have to be in a single file.

tikkita commented 5 years ago

Thanks for the reply. And no, I tried that as well. Didn't work, and I got the same IndexError ( index 1 is out of bounds for axis 1 with size 1).

nkeim commented 5 years ago

Thanks. We are quickly getting out of my depth (and into that of @caspervdw ), but have you confirmed that you are able to read all the images in a single tiff stack?

tikkita commented 5 years ago

Hi, the ImageSequenceND doesn't work (index out of bound error).

  1. Currently i am using - from skimage import io im = io.imread('file.tif')

This gives me a four dimensional array and I am individually tracking features in each 2d plane (by treating each plane as a matrix element) then stacking them in 3d, but its not very efficient.

  1. Another way I have tried is pims.TiffStack, this gives me a single file with n number of frames and no separation in z and t. Length: 374 frames Frame Shape: 2048 x 2048 Pixel Datatype: uint16 in this case however, the frames[123].metadata tells me {'ImageDescription': 'ImageJ=1.51u\nimages=374\nslices=34\nframes=11\nhyperstack=true\nunit=inch\nloop=false\nmin=4276.0\nmax=65535.0\n'}, here, nslices=34\nframes=11 represents my z and t slices if I understand correctly. But again, I am unable to figure out how to use this information.