[ome-users] Opening of nd2 files with "series" bigger than 2GB

Sebastien Besson (Staff) s.besson at dundee.ac.uk
Thu Jan 11 16:57:10 GMT 2018


Hi Guilhem,

although the error message is not fully indicative, you are most certainly hitting
the limit of the Java byte array which is the type returned by the openBytes
method [1].

Generally when working with large XY planes, you will need to read images in tiles
rather than retrieving the whole plane. To do so, you can use the signatures of
the openBytes API allowing to pass the coordinates and the dimensions of the tile
to retrieve [2].

In the MATLAB toolbox, these coordinates and dimensions can be passed to the
 bfGetPlane function e.g. to retrieve the first 1024x1024 tile:

r = bfGetReader(file);
I = bfGetPlane(r, 1, 1, 1, 1024, 1024);

Best regards
Sebastien

[1] https://downloads.openmicroscopy.org/bio-formats/5.7.3/api/loci/formats/IFormatReader.html#openBytes-int-
[2] https://downloads.openmicroscopy.org/bio-formats/5.7.3/api/loci/formats/IFormatReader.html#openBytes-int-int-int-int-int-


On 10 Jan 2018, at 15:56, Guilhem Chenon <guilhem.chenon at espci.fr<mailto:guilhem.chenon at espci.fr>> wrote:


Hello,

I could not find any report of this issue online so I have to ask it here. Thanks in advance for your help.

So I have Bio-formats 5.7.2 installed on both Matlab R2017b with 7000MB of Java Heap space (with bfmatlab folder) and ImageJ (with .jar package). What I want to do is open an ND2 file (20112x20173 ; 16-bit resolution) of 11,2 Gb (12 111 798 272 bytes). It consists of 6 timepoints each containing 3 channels. So the "time points" (consisting of 3 channels and encoded as series by the Nikon Software (NIS-Elements)), are each over 2*10^9 bytes.

Here is an example code:

[file,path] = uigetfile('*.nd2','Select .nd2 file');
cd(fileparts(path));
r = bfGetReader(file);
I = bfGetPlane(r, 1);

which gives, with the file cited above, the following error (same with ImageJ and Icy which all rely on LOCI) :

Error using bfGetPlane (line 78)
Java exception occurred:
java.lang.NegativeArraySizeException

    at loci.formats.in.NativeND2Reader.openBytes(NativeND2Reader.java:298)

    at loci.formats.DelegateReader.openBytes(DelegateReader.java:227)

    at loci.formats.ImageReader.openBytes(ImageReader.java:457)

    at loci.formats.ChannelFiller.openBytes(ChannelFiller.java:156)

    at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:227)

    at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:159)

I tried to open this .nd2 with as much as 30Gb of memory in the last version of ImageJ with no success, so I does not think it has anything to do with available RAM.

The only way I know to prevent the error is to use "crop on import" with Bio-formats plugin in ImageJ. I can open one serie if it's cropped to around 18800x18800px because I think it gets under the 2 Gb limit.

So what i want to know is if there exist a workaround or do I have to crop/bin my files? If requested I can upload the file through FTP.

Thank you very much for your time and your help. I hope I explained myself clearly.

Best regards,

--
Guilhem CHENON
LCMD - ESPCI Paris

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png]<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Garanti sans virus. www.avg.com<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
<x-msg://3/#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20180111/8d5da017/attachment.html>


More information about the ome-users mailing list