I am using Bioformats 6.3.1 to read and open .czi files in Matlab R2019b, following the workflow at
https://docs.openmicroscopy.org/bio-formats/6.3.1/developers/matlab-dev.html. The .czi files contain confocal linescans which should be display as XT images.
I keep having the same problem over and over with every file I try. Bioformats reads each line in the .czi file as a plane within a series, which I guess is okay. There’s always only one series and the number of planes should depend on the length of the recording (number of lines). The problem is that Bioformats only loads planes for about 1/4 of the total number of lines in the scan, and most lines contain just zeroes – no data. I can stitch the planes into an image, and it is evident there is a lot of data missing. Here’s a link with relevant files: the original .czi file, a TIFF made with Zen 2.6 and a TIFF stiched in Matlab with the data obtained with Bioformats. https://uwmadison.box.com/s/ow5f42fjh8rl677vogaeggp12h50duza
In this case, the scan has 38825 lines but Bioformats only reads 9556 into Matlab and most. Overall, there is one line with data, followed by 4 or 5 lines with just zeroes, followed by another good line. And then, there are over 29000 lines missing… The info has to be there in the .czi file, the question is why Bioformats doesn’t access it. I actually managed to find the correct T size buried in the Metadata, but have no idea how to access pixel data.
Any ideas what’s going on?? By the way, opening these .czi files in Fiji gives the same metadata as Matlab (which is good) but the same overall issue (missing, incomplete data).
Here is the Matlab code I am running:
Image = bfGetReader(id); % Query some metadata fields (keys are format-dependent) globalMetadata=Image.getGlobalMetadata(); OriginalMetadata = Image.getSeriesMetadata(); javaMethod('merge', 'loci.formats.MetadataTools', ... globalMetadata, OriginalMetadata, 'Global '); OmeMeta = Image.getMetadataStore(); %Incorrect info obtained by Bioformats after reading file SizeX = OmeMeta.getPixelsSizeX(0).getValue(); % image width, pixels SizeY = OmeMeta.getPixelsSizeY(0).getValue(); % image height, pixels SizeT = OmeMeta.getPixelsSizeT(0).getValue(); % number of T points %Correct info buried in Metadata. SizeX_correct=str2double(OriginalMetadata.get('Global Information|Image|SizeX #1')); % image width, pixels SizeY_correct=str2double(OriginalMetadata.get('Global Information|Image|SizeY #1')); % image height, pixels SizeT_correct=str2double(OriginalMetadata.get('Global Information|Image|SizeT #1')); % CORRECT number of T points