File Exchange

image thumbnail

imread for multiple life science image file formats

version 1.7.0.0 (3.7 KB) by Christoph Moehl
imports images and metadata using the LOCI Bioformats package

21 Downloads

Updated 13 Sep 2013

View License

Detailed tutorial of imreadBF:

http://imageprocessingblog.com/importing-generic-bioimage-files-to-matlab/

Imports formats from Zeiss, Leica, Nikon, Olympus, MetaMorph and others via BioFormats

Amongst others, following formats are supported:
lsm, zvi, ics, nd2, pic, dv, img, tif,

imreadBF loads multiple user-defined image slices at once.
[imageStack]=imreadBF(datname,zplanes,tframes,channel)

You can load multiple z and t slices at once, e.g. zplanes=[1 2 5] loads first,second and fifth z-slice in a 3D-Stack.

imreadBFmeta returns corresponding metadata.

To use the functions, you have to download loci_tools.jar here: http://www.loci.wisc.edu/bio-formats/downloads

make sure to have copied the file loci_tools.jar, in the folder where the
function is placed

modified from bfopen.m

More information about BioFormats:
http://www.loci.wisc.edu/software/bio-formats

Comments and Ratings (16)

hao liu

shit!

Hello,
The link to the detailed tutorial is not working for me. Could a new link be added or is a detailed tutorial offered somewhere else? I am having trouble organizing the software and using the correct input in the function.
Thanks

Ayan Desai

Hi Christoph,

I seem to be encountering an issue with an invalid t-index when I call imreadBF. Thoughts?

K.A Jansen

I have been trying to use this, but I have been unable to download loci_tools.jar. The links are not working anymore. Could you please either include it in the .zip or give an updated link?

Ignacio

Hi,

I've been trying to use the imreadBFmeta funtion to obtain all of the metadata from my nd2 format files. However, when I run the function I get the following error messages:

No appropriate method, property, or field getMetadata for class
loci.formats.ChannelFiller

Error in ==> imreadBFmeta at 70
metadataList = r.getMetadata();

loci_tools is definitely in the right folder. Do you have any idea what could be wrong?

Elad

I suggest to use the matlab function from openmicroscopy (see Curtis Ruedens post).

When I published imreadBF here, the original importer bfopen had some drawbacks. But this seems to be solved now.

In response to the various questions being asked here: please try with the most up-to-date MATLAB script and documentation on the official site at:

https://www.openmicroscopy.org/site/support/bio-formats/users/matlab/

If you still have questions or issues, you will have better luck asking for help from the Bio-Formats developers on the OME mailing list (https://www.openmicroscopy.org/site/community/mailing-lists) or OME forums (https://www.openmicroscopy.org/community/).

Sorry, I accidentally submitted twice.

I also want to ask/comment about two specific problems:

(1) Reading a uint8 file
I open a LIF file which should have intensities 0 to 255, I guess (unless the bit depth is higher???). However, the results returned from this M-file are in the range of int8, that is from -128 to +127. Looking at the frequency histogram, this is clearly wrong. I can fix it like this:
% Begin DIV edit 2013-01-22 %
if sgn == 0,
whos sgn arr
arr = uint8(arr >= 0) .* uint8(arr) + uint8(arr < 0) .* (uint8(arr + 128) + 128);
end;
% End DIV edit 2013-01-22 %

but I notice that the variable
sgn = loci.formats.FormatTools.isSigned(pixelType);
is already defined in the code, but never used for anything (see my previous post). Is there some bug there?

(2) Opening a LIF file
A Leica LIF file can contain multiple series. By default this code opens only the last series. I wonder if there is a way to access (in a controlled way) the other series in the file.

To use this we need loci_tools.jar here: http://www.loci.wisc.edu/bio-formats/downloads

I am wondering how you know the syntax to access the methods in this jar file.

For example, how do you know to use

arr = loci.common.DataTools.makeDataArray2D(plane, bpp, fp, little, height);

??

I could not find any documentation on this.

To use this we need loci_tools.jar here: http://www.loci.wisc.edu/bio-formats/downloads

I am wondering how you know the syntax to access the methods in this jar file.

For example, how do you know to use

arr = loci.common.DataTools.makeDataArray2D(plane, bpp, fp, little, height);

??

I could not find any documentation on this.

Omid G

Thank you, but if it is possible put a more detailed manual.

dear zhao and jian jiang

here is a way to read out the java hashtable as strings:

datname='good.oib'
meta=imreadBFmeta(datname);

parameterNames=meta.raw.keySet.toArray
values=meta.raw.values.toArray

This gives you all the rawdata. However, the parameternames are somewhat cryptic and you have to find out what is the important parameter for you.

ZHAO

Very nice tool!
Is the detail imaging information of Olympus oib file in the results of meta.raw? It is a hashtable file ,but how can I get some informaton from it?

Liat

I have oib files which I want to open. I feed the function with the parameters but I get an error message.
What is the input arguments type? Does the file have to be in the same folder?

Thank you

Jian Jiang

Good sofware!
But how to get detailed information of the Olympus/Zeiss figure? For example, the time, rotation and others that saved in the raw files.

Updates

1.7.0.0

added link to tutorial on image processing blog

1.6.0.0

updated metadata import

1.2.0.0

files were completed

1.1.0.0

path of loci_tools.jar is now added automatically (code was copied from bfopen.m)

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor