We're Hiring!

Issue with Importing .jp2 Files

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.

Issue with Importing .jp2 Files

Postby hhdl » Mon Jul 24, 2017 7:01 pm

Hello all,

I've looked through similar threads to try to resolve this issue, but nothing has really helped so I'm hoping that maybe someone could provide with me a bit of guidance. I've been trying to analyze images using the Color Deconvolution plug-in with ImageJ, but the images are .jp2 so I can't open them in my ImageJ. Instead I downloaded Fiji, which had the BioFormats plug-in, and tried to open the images in there. However, when I imported them using BioFormats, I received this error message:

(Fiji Is Just) ImageJ 2.0.0-rc-61/1.51n; Java 1.8.0_66 [64-bit]; Mac OS X 10.11.6; 1480MB of 4966MB (29%)

java.lang.IllegalArgumentException: Dimensions (width=98688 height=46416) are too large
at java.awt.image.SampleModel.<init>(SampleModel.java:130)
at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:146)
at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
at java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:144)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KReadState.readAsRaster(J2KReadState.java:429)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.readRaster(J2KImageReader.java:556)
at loci.formats.services.JAIIIOServiceImpl.readRaster(JAIIIOServiceImpl.java:177)
at loci.formats.codec.JPEG2000Codec.decompress(JPEG2000Codec.java:296)
at loci.formats.codec.JPEG2000Codec.decompress(JPEG2000Codec.java:267)
at loci.formats.in.JPEG2000Reader.openBytes(JPEG2000Reader.java:182)
at loci.formats.ChannelFiller.openBytes(ChannelFiller.java:156)
at loci.formats.ChannelFiller.openBytes(ChannelFiller.java:148)
at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:198)
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.plugins.util.ImageProcessorReader.openProcessors(ImageProcessorReader.java:186)
at loci.plugins.in.ImagePlusReader.readProcessors(ImagePlusReader.java:412)
at loci.plugins.in.ImagePlusReader.readPlanes(ImagePlusReader.java:376)
at loci.plugins.in.ImagePlusReader.readImage(ImagePlusReader.java:273)
at loci.plugins.in.ImagePlusReader.readImages(ImagePlusReader.java:234)
at loci.plugins.in.ImagePlusReader.readImages(ImagePlusReader.java:212)
at loci.plugins.in.ImagePlusReader.openImagePlus(ImagePlusReader.java:107)
at loci.plugins.in.Importer.readPixels(Importer.java:149)
at loci.plugins.in.Importer.run(Importer.java:86)
at loci.plugins.LociImporter.run(LociImporter.java:78)
at ij.IJ.runUserPlugIn(IJ.java:217)
at ij.IJ.runPlugIn(IJ.java:181)
at ij.IJ.runPlugIn(IJ.java:170)
at HandleExtraFileTypes.openImage(HandleExtraFileTypes.java:499)
at HandleExtraFileTypes.run(HandleExtraFileTypes.java:72)
at ij.IJ.runUserPlugIn(IJ.java:217)
at ij.IJ.runPlugIn(IJ.java:181)
at ij.IJ.runPlugIn(IJ.java:170)
at ij.io.Opener.openWithHandleExtraFileTypes(Opener.java:515)
at ij.io.Opener.openImage(Opener.java:369)
at ij.io.Opener.openImage(Opener.java:243)
at ij.io.Opener.open(Opener.java:110)
at ij.io.Opener.open(Opener.java:73)
at ij.plugin.Commands.run(Commands.java:27)
at ij.IJ.runPlugIn(IJ.java:187)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:745)</i>


I know that .jp2 files are big (ranging from 100000 KB to 600000 KB), so I adjusted Fiji's maximum memory to be higher than 5000 MB (via Memory & Threads) but I'm still getting the same error message. For more context about the files, they were obtained from whole slide imaging using Aperio, so they can be opened by Aperio ImageScope but no other program is capable of opening them for preview.

I'm not certain if there's a bug in my program (and even if there were, I'm not quite sure how to report it), if there's an issue with the image file, or if I'm just using the program incorrectly.

Would anybody have advice about how to handle this situation?

Thanks in advance,
H.
hhdl
 
Posts: 1
Joined: Mon Jul 24, 2017 3:45 pm

Re: Issue with Importing .jp2 Files

Postby dgault » Mon Jul 31, 2017 1:31 pm

Hi,

This is an issue which we have encountered previously. It is caused when attempting to read a JP2 file in which the product of width and height is greater than Integer.MAX_VALUE (2^31 - 1). Ideally this would result in the image being read in a tiled format but currently it is attempting to read the full plane and causing the exception.

We have an open bug ticket against it which I have updated to point to your use case: https://trac.openmicroscopy.org/ome/ticket/9544

If you are using the Bio-Formats importer in FIJI then a possible workaround may be to import the image cropped and stitch it back together.

David Gault
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 0 guests