Opening Zeiss czi file format mosaic files in Matlab using bio-formats
The issue: I often write scripts in Matlab to batch image processing tasks, and for that purpose I need to load confocal or axioscan Zeiss czi format image files. I use an open source package called Bio-formats. However, I frequently get two kinds of problems when using this library in Matlab: a) working memory problems (Matlabs Java memory capacity gets filled when the files are in the order of the GB size); and b) stitching problems. This post will only focus on the second issue (I will write later a separate post for the first). The problem is that, for a long time, when I tried to open czi image files of confocal images that were tiled, the bio-formats pack would open the tiles individually, but it would not stitch them as a single image.
Diagnose procedure: I tried to download different versions of the bio-formats library, because according to internet forums like forum.image.sc, the latest version of bio-formats had that problem fixed. The version that I used to use was version v5.5.2. You can follow the process at the the forum link here.
Solution:
- Delete all previous versions of bfmatlab that are installed;
- Close the Matlab IDE;
- Download the latest version of bfmatlab 7.0.0 (Bio-Formats Downloads | Open
Microscopy Environment (OME)).
- Restarte matlab and add the bfmatlab folder to the path;
- Check which version of bioformats_package.jar that library is using
by typing
[status, version] =
bfCheckJavaPath()
In the command prompt. The answer
should be status = 1 and version = 7.0.0
- Run the command
data = bfopen(filename);
The program should now give a stitched image as expected.
The most important factor is that the library bioformats_package.jar is updated to at least version v7.0.0. This version stitches tiled images by default. There are procedures to turn off this property, but that would be the subject for another post.
Notes: You can read the documentation about how to use Bio-formats package in Matlab on the link here. Bio-formats is also available as a plugin in Fiji environment. Another interesting feature that I found out is that you can use bio-formats directly in the command line. For the download and documentation, check the link here. You have to download Java to your PC independently though.
Kommentarer
Legg inn en kommentar