MATLAB

MATLAB is a high-level language and interactive environment that facilitates rapid development of algorithms for performing computationally intensive tasks.

Calling Bio-Formats from MATLAB is fairly straightforward, since MATLAB has built-in interoperability with Java. We have created a set of scripts for reading image files. Note the minimum supported MATLAB version is R2007b (7.5).

Installation

Download the MATLAB toolbox from the Bio-Formats downloads page. Unzip bfmatlab.zip and add the unzipped bfmatlab folder to your MATLAB path.

Note

As of Bio-Formats 5.0.0, this zip now contains the bundled jar and you no longer need to download loci_tools.jar or the new bioformats_package.jar separately.

Usage

Please see Using Bio-Formats in MATLAB for usage instructions. If you intend to extend the existing .m files, please also see the developer page for more information on how to use Bio-Formats in general.

Performance

In our tests (MATLAB R14 vs. java 1.6.0_20), the script executes at approximately half the speed of our showinf command line tool, due to overhead from copying arrays.

Troubleshooting

If you encounter an error trying to open JPEG-2000 data in MATLAB but the file will open e.g. in Fiji using Bio-Formats, it may be due to conflicting versions of JAI ImageIO in different JARs. As discussed on the component page, JAI ImageIO is no longer maintained and you will likely need to remove the conflicting JAR(s) as a workaround.

Upgrading

To use a newer version of Bio-Formats, overwrite the content of the bfmatlab folder with the newer version of the toolbox and restart MATLAB.

Alternative scripts

Several other groups have developed their own MATLAB scripts that use Bio-Formats, including the following: