Error opening multi-series LIF file with ImgLib2/SCIFIO

Hi All,

I’m trying to open a multi-series LIF file using the following code:

ImgOpener imgOpener = new ImgOpener();
SCIFIOConfig config = new SCIFIOConfig();
config.imgOpenerSetIndex(series);
Img<T> imageCell = (Img<T>) imgOpener.openImgs(pathToFile, config).get(0);
ImageJFunctions.show(imageCell);

If series is set to 0, this works fine and opens the first image in the dataset.

However, if series is set to 1 or greater, the code fails with the following exception:

Exception in thread "main" java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Bound #0 of [0, 2599] is not contained in [0, 1024]
	at net.imglib2.cache.util.CacheAsUncheckedCacheAdapter.get(CacheAsUncheckedCacheAdapter.java:32)
	at net.imglib2.img.cell.LazyCellImg$LazyCells.get(LazyCellImg.java:104)
	at net.imglib2.img.list.AbstractLongListImg$LongListRandomAccess.get(AbstractLongListImg.java:274)
	at net.imglib2.img.cell.CellRandomAccess.getCell(CellRandomAccess.java:136)
	at net.imglib2.img.cell.CellRandomAccess.updatePosition(CellRandomAccess.java:474)
	at net.imglib2.img.cell.CellRandomAccess.<init>(CellRandomAccess.java:130)
	at net.imglib2.img.cell.AbstractCellImg.randomAccess(AbstractCellImg.java:104)
	at net.imglib2.img.cell.AbstractCellImg.randomAccess(AbstractCellImg.java:51)
	at net.imagej.ImgPlus.randomAccess(ImgPlus.java:171)
	at net.imglib2.util.Util.getTypeFromInterval(Util.java:770)
	at net.imglib2.img.display.imagej.ImageJFunctions.wrap(ImageJFunctions.java:215)
	at net.imglib2.img.display.imagej.ImageJFunctions.show(ImageJFunctions.java:262)
	at net.imglib2.img.display.imagej.ImageJFunctions.show(ImageJFunctions.java:155)
	at net.imglib2.img.display.imagej.ImageJFunctions.show(ImageJFunctions.java:160)
	at SlideJ.SlideJ.<init>(SlideJ.java:91)
	at SlideJ.SlideJ.main(SlideJ.java:29)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Bound #0 of [0, 2599] is not contained in [0, 1024]
	at net.imglib2.cache.ref.SoftRefLoaderRemoverCache.get(SoftRefLoaderRemoverCache.java:168)
	at net.imglib2.cache.util.LoaderRemoverCacheAsLoaderCacheAdapter.get(LoaderRemoverCacheAsLoaderCacheAdapter.java:37)
	at net.imglib2.cache.util.LoaderCacheAsCacheAdapter.get(LoaderCacheAsCacheAdapter.java:30)
	at net.imglib2.cache.util.CacheAsUncheckedCacheAdapter.get(CacheAsUncheckedCacheAdapter.java:28)
	... 15 more
Caused by: java.lang.IllegalArgumentException: Bound #0 of [0, 2599] is not contained in [0, 1024]
	at io.scif.img.cell.loaders.AbstractArrayLoader.validateBounds(AbstractArrayLoader.java:310)
	at io.scif.img.cell.loaders.AbstractArrayLoader.read(AbstractArrayLoader.java:278)
	at io.scif.img.cell.loaders.AbstractArrayLoader.read(AbstractArrayLoader.java:269)
	at io.scif.img.cell.loaders.AbstractArrayLoader.read(AbstractArrayLoader.java:251)
	at io.scif.img.cell.loaders.AbstractArrayLoader.loadArray(AbstractArrayLoader.java:231)
	at io.scif.img.cell.SCIFIOCellImgFactory$SCIFIOCellLoader.load(SCIFIOCellImgFactory.java:200)
	at net.imglib2.cache.img.LoadedCellCacheLoader.get(LoadedCellCacheLoader.java:91)
	at net.imglib2.cache.img.LoadedCellCacheLoader.get(LoadedCellCacheLoader.java:51)
	at net.imglib2.cache.img.DiskCellCache.get(DiskCellCache.java:104)
	at net.imglib2.cache.img.DiskCellCache.get(DiskCellCache.java:43)
	at net.imglib2.cache.IoSync.get(IoSync.java:174)
	at net.imglib2.cache.ref.SoftRefLoaderRemoverCache.get(SoftRefLoaderRemoverCache.java:158)
	... 18 more

I have an inkling of what might be going on here (it looks like the bounds of the first image in the dataset are somehow being “applied” to all subsequent series, which causes a conflict when checked against the image dimensions) but I don’t seem to be able to resolve the issue.

Any assistance would be greatly appreciated.

D.