atlab / scanreader

Python TIFF Stack Reader for ScanImage 5 scans (including multiROI).
MIT License
9 stars 11 forks source link

scanimage 2020.1.0 compatibility #11

Closed sugarjo closed 3 years ago

sugarjo commented 3 years ago

Hi, is scanreader compatible with tif files from scanimage 2020.1.0? Seems as there are some issues with reading the headers: scanreader.exceptions.ScanImageVersionError: Could not find ScanImage version in the tiff header Thanks.

ecobost commented 3 years ago

Hi @sugarjo By default, scanreader won't work with newer versions of scanimage because they used to introduce forwards incompatible stuff pretty often in the header info but it is being pretty consistent lately. You can add the newer version to the list of accepted versions like in this PR (https://github.com/atlab/scanreader/pull/10), essentially inheriting from Scan5Point3; if all works fine then it means it's compatible, otherwise maybe you can send me a small scan recorded in that version and I'll add it to it. Michael

sugarjo commented 3 years ago

Hi @ecobost , Thanks for you reply. the problem seems to be upstream of the version imcompatibility(?) since this is the error we get is

File "..\dj_schemas\preprocess.py", line 107, in make_2pmini_dict scan = scanreader.read_scan(dataset_dict[base]['TIFRaw']) File "C:\Users\horsto\AppData\Local\conda\conda\envs\analysis\lib\site-packages\scanreader\core.py", line 48, in read_scan version = get_scanimage_version(file_info) File "C:\Users\horsto\AppData\Local\conda\conda\envs\analysis\lib\site-packages\scanreader\core.py", line 108, in get_scanimage_version raise ScanImageVersionError('Could not find ScanImage version in the tiff header') scanreader.exceptions.ScanImageVersionError: Could not find ScanImage version in the tiff header

It seems as the header info is stored in an incompatible way? I have made a small tif stack if you have time to take a look at it. https://www.dropbox.com/s/fch3zl84m0gwmfn/test_00002.tif?dl=0

best regards Jørgen

ecobost commented 3 years ago

Thanks for the sample scan, I added it to the standard test suite and fixed the issue with 2020 (thanks to @horsto) in https://github.com/atlab/scanreader/commit/723ce4a61d9df017f7f33194638d8ded45ea66e7 I tested it and looks good