ImgLib2 Virtual Stack of multiple images

Tags: #<Tag:0x00007fd5423b0ca8> #<Tag:0x00007fd5423b0ac8> #<Tag:0x00007fd5423b08e8>


Dear community,

We are looking at a way to handle some data from a PerkinElmer Operetta, which gives us an XML output and a folder with a very large number of tiff files.

These have unique files for Wells, Fields, Channels, Slices and Timepoints

Thanks to this post I can parse the XML file and make sense of the file logic (when the system cannot acquire something for some reason, the file is missing, leading to non-continuous field/slice/timepoint numbers…

Now I was thinking of using the examples from ImgLib2 to have the user choose a well and then load

All images regarding that well as a virtual hyperstack where each slice could contain multiple images (fields) for different channels, timepoints and slices.

Se question is. Can ImgLib2 lazily load multiple tiff images per slice as a virtual stack so the user can browse through the data comfortably? I saw the example where one can copy one RandomAccessible to IterableInterval and was wondering to which extent I can push this.

Another idea I had was to use the BigDataViewer to do this… Any thoughts?



I was quite blown away by this:

In case you haven’t had a look yet…



@FelixM, thank you ,that’s really impressive. However I am a bit lost because there is a lot to dig into.

I’ve read the great posts by @tpietzsch in

And am trying to wrap my head around what I would need.

What I have so far:

  1. I am reading an xml file which contains all the metadata from the microscope.
  2. All image files are single slice tiff files
  3. The dataset has channels, time, slices, rows, columns, and tiles inside each row-column

The images could be tiles, or just regions taken at random by the user, called fields.

What I’d want to do is allow the user to load a particular row/column so that they can move through time.
This involves loading the images at the right offsets (we can get the absolute stage positions).

So here are some questions and just wondering how to get started

  1. How do I load a subset of tiff files (distinguished by name) into a meaningful container (I guess) CellLoader, in order to
  2. Open these using the cached image functions from the post above.

I looked at the examples, travered the API, but comments are few and sparse on where to get started. Evertytime I reach somewhere, it’s an abstract class I have to implement that depends on some deeper abstract class. It’s all nice when you have simple placeholer classes that show the functionality, but without a pretty extensive knowledge of ImgLib2 itself, getting into it is rather difficult, especially that it is in heavy development.

Thank again for any time and insight you can dedicate to this.




Hi @oburri,

Warning, imglib2 jargon below - please follow up if its unclear

Another example might help. We’ve been working on a storage framework called N5 that loads data into an imglib2-cache.
Look at this test. It actually sets up both reading and writing to a cache, but I’ll try to focus on the reading part

There’s a reader with metadata, then set up the cache:

final N5CellLoader< UnsignedByteType > loader = new N5CellLoader<>( n5, dataset, cellSize );
final DiskCachedCellImgFactory< UnsignedByteType > factory = new DiskCachedCellImgFactory<>( options );
final DiskCachedCellImg< UnsignedByteType, ? > img = factory.create( dim, new UnsignedByteType(), loader );

where img lets you access everything.

It sounds like you’ve already figured out that what you need to do is implement the CellLoader.
In this case, the loader looks like this.

Most of that is details - I’m pretty sure you only need to implement the load method. i.e. the argument: SingleCellArrayImg< T, ? > cell gives you the min and max of the Interval you need. Then you’ll check your metadata to determine which tiffs you need, load them, and fill the cell with the relevant data.

Hope that helps, and good luck