EIN-lab / CHIPS

CHIPS, or Cellular and Hemodynamic Image Processing Suite, is an open-source MATLAB toolbox designed to analyse functional images of cells and blood vessels, primarily from two-photon microscopy. Please see the README file, which is displayed at the bottom of this page, for more information.
Other
17 stars 4 forks source link

Add support for ScanImage version >r3.8 #2

Open kferrari opened 6 years ago

kferrari commented 6 years ago

Allow import of images acquired in newer ScanImage versions than r3.8.

This may require adding ScanImageTiffReader library as downloadable utility. Unfortunately the reader isn't backwards-compatible. So we need at least two parsers for header information.

Also, utils.scim.openTif() gives some cryptic error messages when trying to load newer images because it tries to access libraries not supplied with CHIPS (line 177).

utils.scim.openTif() could, dependent on header information retrieved with hTif.getTag('ImageDescription'), decide whether to use the new ScanImageTiffReader() or the old parseHeader() to parse header information. It then needs some sort of unifying to get them to the same structure.

Until this is solved, loading ScanImage 2017 TIFF files with the general purpose RawImgDummy class works well.

pbl007 commented 5 years ago

Hi, is there any performance impact while using RawImgDummy instead of the regular reader for SI files?

kferrari commented 5 years ago

Hi @pbl007

We haven't directly compared the two, but in my view there shouldn't be a major difference in performance. However, ScanImage writes a lot of information to the file header, and this information gets lost when importing via RawImgDummy. This can be accounted for by creating a Metadata object by hand and supplying the necessary parameters (please see this guide for more information).

Best, Kim

pbl007 commented 5 years ago

Got it! Thanks a lot. This looks like a very promising tool! Best Pablo

pbl007 commented 5 years ago

Looking deeper into the metadata issue. What will be the best approach for the CalibrationPixelSize' ? Should I create aDummy` obj for each combination of image size and zoom (as all zoom values obtain the same pixel size per the corresponding documentations)? It looks like the regular 'CalibrationPixelSize' object with measured values can suffice. Please be kind to clarify.

kferrari commented 5 years ago

You should only need a single CalibrationPixelSize per microscope/objective combination. You need to supply a vector of zoom values and their corresponding pixel sizes. Please look into this guide for more information. You can then use CalibrationPixelSize's plot function to look at the graphs for your calibration. When you're happy with it, save it to your drive and re-load it as needed.

Best, Kim

HagaiHargil commented 3 years ago

Hi @kferrari, regarding the original discussion, would you be interested in a PR that adds support for newer SI TIFs?

Regarding the new dependency issue, the MATLAB Tif object, at least the one for versions 2019 and 2020, identifies the relevant metadata so it seems that ScanImage's own Tiff reader won't be necessary, at least not for these newer MATLAB versions. I don't have an older MATLAB version to check whether the older Tiff reader also parses that information successfully.

kferrari commented 3 years ago

Hi @HagaiHargil, yes absolutely! Thanks a lot for the effort. I don't know yet how long it'll take me to review it, but it would definitely be a great enhancement. Thank you!