nel-lab / mesmerize-core

High level pandas-based API for batch analysis of Calcium Imaging data using CaImAn
Other
58 stars 15 forks source link

AttributeError: 'TiffPageSeries' object has no attribute 'levels' #254

Closed santicolom closed 9 months ago

santicolom commented 9 months ago

Hi, I'm in the Visualize Results section of this code and I can't seem to get the visualization of the results.

https://github.com/nel-lab/mesmerize-core/blob/master/notebooks/cnmfe.ipynb

Code:

a = LazyTiff(df.iloc[0].caiman.get_input_movie_path()) a.shape

Error:


AttributeError Traceback (most recent call last) Cell In[25], line 1 ----> 1 a = LazyTiff(df.iloc[0].caiman.get_input_movie_path()) 2 a.shape

File ~\anaconda3\envs\mescore\lib\site-packages\mesmerize_core\arrays_tiff.py:27, in LazyTiff.init(self, path, shape) 13 """ 14 Lazy reader for tiff files. WIP, works for some tiff files. 15 Try tifffile.memmap first before trying LazyTiff (...) 23 manually set shape 24 """ 26 self._tif = tifffile.TiffFile(path) ---> 27 tiffseries = self._tif.series[0].levels[0] 29 if shape is None: 30 # TODO: someone who's better with tiff can help on this 31 if len(self._tif.pages) == 1:

AttributeError: 'TiffPageSeries' object has no attribute 'levels'

Thank you in advance.

kushalkolar commented 9 months ago

Not all tiff files support lazy loading, you will have to convert them to be lazy-loadable if it doesn't work. You can use tiffit: https://github.com/EricThomson/tiffit

santicolom commented 9 months ago

Yes, that worked, thank you.

I noticed there was a typo in the cell immediately after, tiffile.memmap should be tifffile.memmap. Thank you and hopefully this helps you.