Page 1 of 1

Matlab R2017b and bfopen error

PostPosted: Wed Sep 27, 2017 2:34 pm
by Ajaxel
Hello,
after update of Matlab to R2017b use of bfopen gives an error. I believe it has something to do with java version that Matlab is using because on R2017a everything is fine.
Is there a way to fix this?

The command I used to open a file:
data = bfopen('d:\DataMix\PLSNLS\07_PLSNLS.zvi');

Error message in R2017b:

Error using bfGetReader (line 75)
Java exception occurred:
java.lang.NoSuchFieldError: MICROMETER
at loci.formats.in.NiftiReader.<init>(NiftiReader.java:78)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at loci.formats.ImageReader.<init>(ImageReader.java:129)
at loci.formats.in.FilePatternReader.<init>(FilePatternReader.java:77)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at loci.formats.ImageReader.<init>(ImageReader.java:129)
at loci.formats.ImageReader.<init>(ImageReader.java:116)
at loci.formats.ReaderWrapper.<init>(ReaderWrapper.java:61)
at loci.formats.ChannelFiller.<init>(ChannelFiller.java:71)
Error in bfopen (line 114)
r = bfGetReader(id, stitchFiles);

Java version in R2017a:
Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

Java version in R2017b:
Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

BioFormats version: 5.7.1 (2017 September 20)

Thanks!
Ilya

Re: Matlab R2017b and bfopen error

PostPosted: Thu Sep 28, 2017 10:43 am
by dgault
Hi Ilya,

That error would suggest there has been a mismatch of 2 different Bio-Formats versions. When you upgraded did you reinstall the Bio-Formats Matlab toolbox? Also are there any other Bio-Formats or OME jar files in your Matlab path other than bioformats_package.jar?

David Gault

Re: Matlab R2017b and bfopen error

PostPosted: Thu Sep 28, 2017 12:51 pm
by Ajaxel
Hi David,
thank you for the suggestion!
Indeed it seems to be the case.

The following command caused the error:
Code: Select all
% Create a loci.formats.ReaderWrapper object
r = javaObject('loci.formats.ChannelSeparator', ...
               javaObject('loci.formats.ChannelFiller'));


And the reason was due to omero_client.jar library before bioformats_package.jar in the path. I updated omero from 5.2.7 to 5.3.4 and now it looks fine.
Thanks a lot again!

Ilya