BioFormat for matlab and svs images
Show older comments
Dear all
does anyone know how can i open an svs image by using bioformat?
My images have 4 planes:
- image at the maximum resolution
- image at the mid resolution
- image at 1/8 resolution (or even less)
- image with the original resolution bar.
When trying to open an image to get the second plane, I use the following commands:
r=bfGetReader('C:\prova.svs');
when issued, this command raises this error:
log4j:WARN No appenders could be found for logger (loci.formats.ClassList). log4j:WARN Please initialize the log4j system properly.
if I further proceed with the bfGetPlane instruction:
img=bfGetPlane(r,2);
I get the following error:
Error using bfGetPlane (line 78) Java exception occurred: java.lang.IllegalArgumentException: Array size too large: 89488 x 74009 x 1
at loci.common.DataTools.safeMultiply32(DataTools.java:949)
at loci.common.DataTools.allocate(DataTools.java:922)
at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:158)
Please, help me!
5 Comments
Walter Roberson
on 1 Oct 2018
That image appears to be about 6.8 gigabytes, assuming that the components are uint8 .
You would have to go into Preferences to change Java Memory to permit at least that much memory for Java. You would typically need to restart MATLAB once after increasing Java memory.
Elena Casiraghi
on 1 Oct 2018
Walter Roberson
on 2 Oct 2018
The routine name loci.common.DataTools.safeMultiply32 hints that possibly it might need 32 bits per component, or 4 times 6.8 gigabytes.
Or perhaps it hints that it uses 32 bit addresses and so might be restricted to 2 or 4 gigabytes.
Walter Roberson
on 2 Oct 2018
I see from the source code at https://github.com/openmicroscopy/bioformats/blob/develop/components/formats-gpl/matlab/bfGetPlane.m that just before the openBytes call, that it calls
pixelType = r.getPixelType();
bpp = javaMethod('getBytesPerPixel', 'loci.formats.FormatTools', pixelType);
fp = javaMethod('isFloatingPoint', 'loci.formats.FormatTools', pixelType);
sgn = javaMethod('isSigned', 'loci.formats.FormatTools', pixelType);
little = r.isLittleEndian();
It would be interesting to see the result of bpp and fp, which you could get by putting a breakpoint in at the openBytes call and examining the variables. This would help figure out what array size was needed.
It looks to me as if it might be possible to use bfGetPlane to read in portions of the image at a time. Even if you have to piece the parts together again, you would be doing that in main RAM instead of in java memory, so this approach could help get around java limits.
Elena Casiraghi
on 2 Oct 2018
Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!