BioFormat for matlab and svs images

6 views (last 30 days)
Elena Casiraghi
Elena Casiraghi on 1 Oct 2018
Commented: Elena Casiraghi on 2 Oct 2018

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
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
Elena Casiraghi on 2 Oct 2018
bpp=1 fp logical 0 sgn logical 0 I used also bfGetPlane but it gave the same error

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!