ArrayIndexOutOfBoundsException encountered opening .svs files

Hello,

i have some problems using the bio formats library for fijii: i can successfully open most of the .svs images i have with this awesome library but some of it gives me this stacktrace:

java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:215)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:348)
	at loci.formats.DimensionSwapper.openBytes(DimensionSwapper.java:249)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:348)
	at loci.formats.MinMaxCalculator.openBytes(MinMaxCalculator.java:269)
	at loci.formats.MinMaxCalculator.openBytes(MinMaxCalculator.java:260)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
	at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:86)
	at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:69)
	at DS4H.ImageFile.getImage(ImageFile.java:75)
	at DS4H.BufferedImagesManager.getImage(BufferedImagesManager.java:42)
	at DS4H.BufferedImagesManager.get(BufferedImagesManager.java:122)
	at DS4H.ImageAlignment.lambda$onMainDialogEvent$8(ImageAlignment.java:309)
	at DS4H.Utilities.lambda$setTimeout$0(Utilities.java:15)
	at java.lang.Thread.run(Thread.java:748)
java.lang.NullPointerException

ImageFile.java is a class i created to handle all the images opened by the user.
The getImage() method can be summerized like this:

public void Initialize() {
   ImporterOptions options = new ImporterOptions();
   options.loadOptions();
   options.setVirtual(true);
   options.setId("c:/thepathofthefile.svs");
   options.setSplitChannels(false);
   options.setColorMode(ImporterOptions.COLOR_MODE_DEFAULT);
   options.setSeriesOn(0, true);
   ImportProcess process = new ImportProcess(options);
   process.execute();
   BufferedImageReader bufferedEditorImageReaderWholeSlide = BufferedImageReader.makeBufferedImageReader(importProcess.getReader());
   // Open the biggest image possible
   this.bufferedEditorImageReaderWholeSlide.setSeries(0);
}


public BufferedImage getImage(index) {
   if(!initialized)
      this.Initialize();
   return this.bufferedEditorImageReaderWholeSlide.openImage(index);
}

The images i have troubles opening are the one stored here: https://figshare.com/articles/2019_Tazzari_Patient_TMA_CD8/8970785

What can i do to resolve this issue? is it a bug of Bio-formats?
I can succesfully open images of about ~200mb.

Thanks

Are you dragging and dropping the files into Fiji or using the BioFormats importer (better option, sometimes only option)?

I am developing a custom ImageJ plugins that uses pom-bio-formats 6.1.1 to import the images.

Specifically, my plugins starts and asks the user to select a file image, and then specify the image file path via options.setId(pathFile); (as shown in my code snippet above).

The issue with those files is that the dimension sizes are so large, which means that a single plane will be larger than the max size for a Java array. To get around this you will have to read a cropped region of the image, or read the images one region at a time. You can do this by using openImage(int no, int x, int y, int width, int height) instead of openImage(int no)

1 Like