Scifio/imglib2: How to get meta data of a an image?



I am going to try scifio/imglib2 libraries instead of the outdated JAI library for my larger image processing project. If I’m right, loading an image should be straightforward with:

Img< T> img = ( Img< T > ) imgOpener.openImgs( path ).get( 0 );

Img< T > will be my generic image container throughout the project.
The next step for me will be the loading of an image stack from a single tif image. I think “.get( i )” with i the index of the individual image should do that. Is that right?

But particularly, I do not know the number of images before loading and therefore I would like to know if there is a convenient way to get meta data out of an image before loading it?
I have already tried some scifio/Metadata classes but unfortunately without success.

Thanks in advance,


Hi @iqmmug and welcome to the forum!

Instead of directly using ImgOpener you can also use IOService as a @Parameter (in case you’re creating a Command):

private IOService ioService;


Img< T> img = ( Img< T > ) path );

Just yesterday, @ctrueden posted an example Groovy script that illustrates how to get metadata using SCIFIO:


Many thanks for the quick reply. I have to import some missing libraries and will check it.