Page 1 of 1

openByte function not used?

PostPosted: Mon Jun 25, 2018 1:59 pm
by Albin
Command: Hedwall$ BF_CP=/Users/Hedwall/bioformats/tools/ISQReader.jar /Users/Hedwall/bioformats/tools/showinf -format ISQ /Users/Hedwall/Desktop/C0003094.ISQ

Error:
Exception in thread "main" loci.formats.FormatException: Image plane too large. Only 2GB of data can be extracted at one time. You can workaround the problem by opening the plane in tiles; for further details, see: https://docs.openmicroscopy.org/bio-for ... s-to-check
at loci.formats.FormatReader.openBytes(FormatReader.java:880)
at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:86)
at loci.formats.tools.ImageInfo.readPixels(ImageInfo.java:821)
at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1054)
at loci.formats.tools.ImageInfo.main(ImageInfo.java:1120)
Caused by: java.lang.IllegalArgumentException: Array size too large: 1163026262 x 822280192 x 1 x 1
at loci.common.DataTools.safeMultiply32(DataTools.java:949)
at loci.common.DataTools.allocate(DataTools.java:922)
at loci.formats.FormatReader.openBytes(FormatReader.java:877)
... 5 more

Hi,

As mentioned in the error above I should use openBytes to handle the image. I am but it is not used, why is this?
Would very much appreciate some feedback on my code overall as well :)

link to Repo: https://github.com/Hedwall/ISQReader/blob/master/src

Re: openByte function not used?

PostPosted: Mon Jun 25, 2018 2:17 pm
by sbesson
Hi Albin,

the main issue is that the image you are loading is too large to fit into a single byte array which is limited to 2GB. If you are working with large XY images, you do not want to load the whole planes is not recommended (unless you are working with small resolutions images). Instead you should open the image in smaller tiles - see also https://docs.openmicroscopy.org/bio-for ... hlight=2GB.

At the API level, this means you want to use openBytes with values of x,y, w and h specifying a region smaller than the 2GB limit.

At the command-line level, you want to use the crop option to load tiles rather than entire planes i.e.

Code: Select all
$ BF_CP=/Users/Hedwall/bioformats/tools/ISQReader.jar /Users/Hedwall/bioformats/tools/showinf -format ISQ -crop 0,0,1024,1024 /Users/Hedwall/Desktop/C0003094.ISQ


Best,
Sebastien

Re: openByte function not used?

PostPosted: Mon Jun 25, 2018 3:26 pm
by Albin
Thanks! -crop is what I was looking for but now it keeps complaining about my readPlane() and I don't see the reson why. Is there any other method which behave like readPlane which I should use instead?


Exception in thread "main" java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:275)
at loci.common.NIOFileHandle.read(NIOFileHandle.java:272)
at loci.common.NIOFileHandle.read(NIOFileHandle.java:255)
at loci.common.RandomAccessInputStream.read(RandomAccessInputStream.java:613)
at loci.formats.FormatReader.readPlane(FormatReader.java:562)
at loci.formats.FormatReader.readPlane(FormatReader.java:513)
at loci.formats.in.ISQReader.openBytes(ISQReader.java:76)
at loci.formats.FormatReader.openBytes(FormatReader.java:886)
at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:86)
at loci.formats.tools.ImageInfo.readPixels(ImageInfo.java:821)
at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1054)
at loci.formats.tools.ImageInfo.main(ImageInfo.java:1120)

Re: openByte function not used?

PostPosted: Tue Jun 26, 2018 10:55 am
by dgault