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' #284

Closed zhouyi0812 closed 6 months ago

zhouyi0812 commented 6 months ago
AttributeError Traceback (most recent call last)
Cell In[18], 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](http://localhost:8889/lab/tree/caiman_data/demos/notebooks/~/anaconda3/envs/mescore/lib/site-packages/mesmerize_core/arrays/_tiff.py#line=26), 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'

This time I was successfully run the mesmerize-viz

Thank you!

kushalkolar commented 6 months ago

LazyTiff doesn't work for all tiff files, tiff is a very flexible format so it's not possible to make a lazy loader that works for all files. I'd recommend using tifffit to convert your files so that they're then memmapble, so you can load it with tifffile.memmap()

zhouyi0812 commented 6 months ago

How can I check which type of.tif it is? In the past, I converted some movies from.avi to .tif from ImageJ and later I wrote some code at macro to batch processing. And it doesn’t work. Thank you!

On Wed, Mar 6, 2024 at 5:27 PM Kushal Kolar @.***> wrote:

Reopened #284 https://github.com/nel-lab/mesmerize-core/issues/284.

— Reply to this email directly, view it on GitHub https://github.com/nel-lab/mesmerize-core/issues/284#event-12035379730, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALSTOST2IIK4NL77IVYWUSTYW67ABAVCNFSM6AAAAABEKCTQ6CVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSGAZTKMZXHE3TGMA . You are receiving this because you authored the thread.Message ID: @.***>

kushalkolar commented 6 months ago

Just use tifffit if you want to be sure that the files will work.

zhouyi0812 commented 6 months ago

Hello! I tried to use it as: import tiffit tiffif.info('002C5d16_B1_F2_1_00d00h00m.tif') tiffit.convert('002C5d16_B1_F2_1_00d00h00m.tif', '002C5d16_B1_F2_1_00d00h00m.tiff')

both encounter the error below: AttributeError Traceback (most recent call last) Cell In[6], line 2 1 import tiffit ----> 2 tiffit.convert('002C5d16_B1_F2_1_00d00h00m.tif', '002C5d16_B1_F2_1_00d00h00m.tiff')

AttributeError: module 'tiffit' has no attribute 'convert'

Thank you very much!

kushalkolar commented 6 months ago

ask at tiffit, this isn't the tiffit repo.