Page 1 of 1

Read CZI in MATLAB

PostPosted: Mon Aug 17, 2015 12:47 pm
by cherrie
Hi there

I am having trouble reading Zeiss .CZI files in MATLAB R2014b, using bfopen().

The same bioformats_package.jar (tested builds (a)11 May 2015 and (b) 17 July 2015) is able to read the same file in ImageJ (1.45s). Bio-formats MATLAB Toolbox is version 5.1.3, downloaded today moments ago. The same MATLAB Toolbox can read the file and pixel sizes when it has been exported as a TIFF stack from ImageJ. The error message in MATLAB is the same regardless of bioformats_package.jar and occurs in bfGetReader:

Error using bfGetReader (line 85)
Java exception occurred:
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:454)
at java.lang.Integer.parseInt(Integer.java:527)
at loci.formats.in.ZeissCZIReader.translateExperiment(ZeissCZIReader.java:1889)
at loci.formats.in.ZeissCZIReader.translateMetadata(ZeissCZIReader.java:980)
at loci.formats.in.ZeissCZIReader.initFile(ZeissCZIReader.java:553)
at loci.formats.FormatReader.setId(FormatReader.java:1244)
at loci.formats.ImageReader.setId(ImageReader.java:727)
at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:529)
at loci.formats.ChannelFiller.setId(ChannelFiller.java:263)
at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:529)
at loci.formats.ChannelSeparator.setId(ChannelSeparator.java:274)

Error in bfopen (line 114)
r = bfGetReader(id, stitchFiles);

Any help would be greatly appreciated.

Best wishes,
Cherrie

Re: Read CZI in MATLAB

PostPosted: Mon Aug 17, 2015 3:31 pm
by sbesson
Hi Cherrie,

from the error lines in you stack trace, it does not look like the version of Bio-Formats used in MATLAB is actually 5.1.3. What is the output of the following command?

>> [~,version] = bfCheckJavaPath


If this does not 5.1.3 as I suspect, it might be you have an outdated Bio-Formats JAR shadowing the new JAR and you may want to double check the content of your Java classpath using:

>> javaclasspath


Let us know if this solves your issue,
Sebastien

Re: Read CZI in MATLAB

PostPosted: Mon Aug 17, 2015 4:47 pm
by sbesson
Hi Cherrie,

fantastic. Glad to hear the issue was a simple outdated JAR.

Regarding physical pixel size, I assume you have upgraded from a 5.0.x version of Bio-Formats. Since 5.1.0, Bio-Formats now stores some OME-XML metadata, especially length and time metadata, as Quantity objects, i.e. including both the value and the unit.

Instructions for unwrapping the physical pixel size from the Length objects can be found on the Using Bio-Formats in MATLAB documentation page.

Let us know if anything is unclear,
Sebastien

Re: Read CZI in MATLAB

PostPosted: Mon Aug 17, 2015 5:28 pm
by cherrie
Hi Sebastien

Thanks for replying so quickly again- yes I saw that it had changed to ...value() instead of getValue(), so I deleted my reply and was going to write a new one with the "stupid" question removed.

Thank you so much for your help!

Best wishes,
Cherrie