[ome-devel] in-memory reading

Roger Leigh rleigh at dundee.ac.uk
Wed Sep 6 16:30:18 BST 2017


On 01/09/17 15:14, Roger Leigh wrote:
> On 01/09/17 10:00, Manuel Stritt wrote:
>> Dear all,
>>
>> I'm trying to use the in-memory reading method as documented here:
>>
>> https://docs.openmicroscopy.org/bio-formats/5.6.0/developers/in-memory.html
>>
>>
>> in combination with a NDPI reader + BufferedImageReader:
>
> Making this into a compilable example, the stack trace is this:
[...]

Dear Manuel,

I've written another two small examples as modifications to test exactly
where the failure lies.

testfile replaces the in-memory I/O with regular file I/O.  This works
correctly, with BufferedImageReader.

testplain retains the in-memory I/O but replaces BufferedImageReader
with regular openBytes.  This fails:

Reading file into memory from disk...
3544235 bytes read.
size reader: 3968 x4864
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
         at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:57)
         at java.nio.ByteBuffer.allocate(ByteBuffer.java:335)
         at loci.common.ByteArrayHandle.setLength(ByteArrayHandle.java:111)
         at loci.common.ByteArrayHandle.seek(ByteArrayHandle.java:180)
         at
loci.common.RandomAccessInputStream.seek(RandomAccessInputStream.java:174)
         at
loci.formats.services.JPEGTurboServiceImpl.getTile(JPEGTurboServiceImpl.java:303)
         at
loci.formats.services.JPEGTurboServiceImpl.getTile(JPEGTurboServiceImpl.java:235)
         at loci.formats.in.NDPIReader.openBytes(NDPIReader.java:191)
         at loci.formats.FormatReader.openBytes(FormatReader.java:886)
         at testplain.main(testplain.java:43)

It's clear that the NDPI reader is behaving differently with the in
memory stream vs a regular file stream.

This has been recorded here:
https://trello.com/c/C4v0GnWv/185-ndpi-in-memory-reading


Regards,
Roger

--
Dr Roger Leigh -- Open Microscopy Environment
Wellcome Trust Centre for Gene Regulation and Expression,
College of Life Sciences, University of Dundee, Dow Street,
Dundee DD1 5EH Scotland UK   Tel: (01382) 386364

The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testfile.java
Type: text/x-java
Size: 1333 bytes
Desc: not available
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20170906/cd083528/attachment.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testplain.java
Type: text/x-java
Size: 1780 bytes
Desc: not available
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20170906/cd083528/attachment-0001.java>


More information about the ome-devel mailing list