Skip to content

Read color tiff stacks #87

@nkeim

Description

@nkeim

I get an error when trying to open a color TiffStack.

To duplicate: open a few color PNGs in ImageJ as a stack, from the sample_data/bulk_water directory in the trackpy-examples repo. Save as a single TIFF file.

In Python:

>>> ts = pims.TiffStack('seq.tif')
>>> ts[0]
ValueError                                Traceback (most recent call last)
<ipython-input-5-5810989840f7> in <module>()
----> 1 ts[0]

/Users/nkeim/trackpy-tryout/src/pims/pims/base_frames.pyc in __getitem__(self, key)
    153 
    154             # else, fall back to `get_frame`
--> 155             return self.get_frame(key if key >= 0 else _len + key)
    156 
    157     def __iter__(self):

/Users/nkeim/trackpy-tryout/src/pims/pims/tiff_stack.pyc in get_frame(self, j)
    334         self.cur = self.im.tell()
    335         res = np.reshape(self.im.getdata(),
--> 336                          self._im_sz).astype(self._dtype).T[::-1]
    337         return Frame(self.process_func(res), frame_no=j)
    338 

/Users/nkeim/anaconda/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in reshape(a, newshape, order)
    215         reshape = a.reshape
    216     except AttributeError:
--> 217         return _wrapit(a, 'reshape', newshape, order=order)
    218     return reshape(newshape, order=order)
    219 

/Users/nkeim/anaconda/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in _wrapit(obj, method, *args, **kwds)
     41     except AttributeError:
     42         wrap = None
---> 43     result = getattr(asarray(obj), method)(*args, **kwds)
     44     if wrap:
     45         if not isinstance(result, mu.ndarray):

ValueError: total size of new array must be unchanged

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions