We're Hiring!

openByte function not used?

Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats
Please note:
Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats

If you are having trouble with image files, there is information about reporting bugs in the Bio-Formats documentation. Please send us the data and let us know what version of Bio-Formats you are using. For issues with your code, please provide a link to a public repository, ideally GitHub.

openByte function not used?

Postby Albin » Mon Jun 25, 2018 1:59 pm

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
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Re: openByte function not used?

Postby sbesson » Mon Jun 25, 2018 2:17 pm

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
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: openByte function not used?

Postby Albin » Mon Jun 25, 2018 3:26 pm

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)
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Re: openByte function not used?

Postby dgault » Tue Jun 26, 2018 10:55 am

User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm


Return to User Discussion [Legacy]

Who is online

Users browsing this forum: No registered users and 1 guest

cron