Error using bfGetReader in Matlab

Hi,
We have updated the computer (and the Nikon software) in my lab and my last aquisition won’t load: when I run:

reader = bfGetReader('filename.nd2');
Error using bfGetReader (line 85)
Java exception occurred:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at
        java.util.ArrayList.rangeCheck(ArrayList.java:657)
        	at
        java.util.ArrayList.get(ArrayList.java:433)
	at
        loci.formats.in.NativeND2Reader.initFile(NativeND2Reader.java:1141)
        	at
        loci.formats.FormatReader.setId(FormatReader.java:1397)
        	at
        loci.formats.DelegateReader.setId(DelegateReader.java:291)
        	at
        loci.formats.ImageReader.setId(ImageReader.java:839)
        	at
        loci.formats.ReaderWrapper.setId(ReaderWrapper.java:650)
        	at
        loci.formats.ChannelFiller.setId(ChannelFiller.java:223)
        	at
        loci.formats.ReaderWrapper.setId(ReaderWrapper.java:650)
        	at
        loci.formats.ChannelSeparator.setId(ChannelSeparator.java:291) 

This happens on my Ubuntu 19.04 and my Macbook using Matlab 2018b and 2018a respectively.

Thank you for your help.

PS: movies load on ImageJ though, in the info, one can read the following lines (duno if it is linked to the problem…?):

m_CompanyString = NIKON Corporation
m_CopyrightString = Copyright © 1991-2018  Laboratory Imaging,  http://www.lim.cz
m_GrabberString = Nikon DS-Qi2
m_SWNameString = NIS-Elements AR
m_VersionString = 5.02.01 (Build 1270)

Hi @LeChat, in your ImageJ setup can you see if you can reproduce the same error when changing the ND2 chunkmap option. You can set whether or not to use the ND2 chunkmap for reading offsets as below:

Plugins > Bio-Formats > Bio-Formats Plugins Configurations > Formats > Nikon ND2 > Chunkmap

Hi! thank you so much for helping me.
on Fiji, with or without chunkmap, I managed to open the .nd2 file.
However, on the upper band on the image window (where the size of the image in microns is written among other things), it is written 6.5Gb in the case without chunkmap, and 2Gb in the case with chunkmap.
This is the only difference that I can tell…

Do you know what version of Bio-Formats you are using with MATLAB?
You can check using [status, version] = bfCheckJavaPath() which will return the version

I reinstalled what I believe to be the latest version of the toolbox yesterday because of my issue.

>> [status, version]=bfCheckJavaPath

status =

  logical

   1


version =

    '5.4.1'

That looks to be an older version, there have been a number of ND2 fixes since then so that is probably the cause.

When you upgraded did you replace the bioformats_package.jar file? Do you have any other versions of that jar on your classpath?

1 Like

Actually I had the issue with the .jar file you mentioned from a download and install I made on March 21st 2018, so I download the last version 3 days ago when the issue appeared.
I also checked the path and it seems that I might have had a duplicate of the 1-year old version. I also realized that the limit of my Matlab Java heap memory had been lowered down to ~2Gb which is weird because I remember I set it to the maximum.
Now things seem to work. Thank you so much for your help.
All the best,
LeChat

1 Like