[ome-users] Loading a subset of a stack

Thomas Julou thomas.julou at unibas.ch
Mon Mar 9 13:12:54 GMT 2015


Hello,

I’m writing about performance issues when handling large files with bioformats. I realize that this is a rather common issue a since I could already read the following threads/issues:
http://lists.openmicroscopy.org.uk/pipermail/ome-users/2014-December/004958.html
http://trac.openmicroscopy.org/ome/ticket/6586
http://imagej.1557.x6.nabble.com/Fiji-Bio-Formats-is-not-opening-large-czi-td5011842.html

Since we’re typically working with 10-15gb stacks stored on network storage, loading stacks with bioformats (even virtual stacks) is very long. It looks like this is due to the fact that the metadata of the entire stack are always parsed extensively at first. So my questions are two-fold:
- is it possible to get the overall stack metadata (number of timepoints, channels, slices, etc) without parsing the metadata of all frames?
- is it possible to load a few frames (e.g. all channels and slices of the first time point) without parsing the metadata of all frames?

So far, it tried to use 
1. either the high level importer:
but this is reading the metadata of all frames at first, and then opens a flat stack without time/channel/slice info…

> ImporterOptions options = new ImporterOptions();
> options.setId(id);
> options.setVirtual(true);
> options.setTBegin(0, 0);
> options.setTEnd(0, 1);
> options.setTStep(0, 1);
> ImagePlus[] imps = BF.openImagePlus(options);
> imps[0].show();

2. or to create a reader and then load the plane I want only.
but the metadata of all frames are still loaded during the reader creation…

> IFormatReader reader = new ImageReader();
> reader.setId(id);
> //seriesCount = reader.getSeriesCount();
> sizeZ = reader.getSizeZ();
> sizeC = reader.getSizeC();
> sizeT = reader.getSizeT();
> imageCount = reader.getImageCount();
> IJ.log(sizeT + " frames.");
> 
> ipreader = new ImageProcessorReader(reader);
> //import loci.plugins.in.ImagePlusReader;
> //impreader = new ImagePlusReader();
> //ImagePlus imp = impreader.createImage("bar", ip);
> 
> ImageStack stack = new ImageStack(reader.getSizeX(), reader.getSizeY());
> for (i = 0; i<10; i++) {
> 	idx = reader.getIndex(0, 1, i); // z, c, t (from 0)
> 	IJ.log(idx + "");
> 	
> 	//ImageProcessor[] 
> 	ip = ipreader.openProcessors(idx);
> 	
> 	stack.addSlice("", ip[0]);
> }
> ImagePlus imp = new ImagePlus("foo", stack);
> reader.close();
> ipreader.close();
> 
> imp.show();

I would really appreciate to know whether there are better ways to read a subset of a stack only using bioformats and/or to get overall info without reading the metadata of all frames.
I thank you in advance for your help. Best,

--
Thomas Julou  |  Computational & Systems Biology  |  Biozentrum – University of Basel  |  Klingelbergstrasse 50/70 CH-4056 Basel  |  +41 (0)61 267 16 21




More information about the ome-users mailing list