NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 671 - Problem with registering BioFormats Extension from macro
Problem with registering BioFormats Extension from macro
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Bio-Formats
unspecified
PC Windows
: P3 major
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2013-10-14 07:29 CDT by Sebastian Rhode
Modified: 2014-06-16 13:36 CDT
1 user (show)

See Also:

Description Sebastian Rhode 2013-10-14 07:29:42 CDT
I start Fiji from the command line with the following command:

ImageJ-win64.exe -macro Zen_Test\Open_CZI_OME_complete.ijm test.czi

The first lines of this macro are shown below:

---   MACRO   ---

name = getArgument;
if (name=="") exit("No argument!");

// install Bio-Formats extension
run("Bio-Formats Macro Extensions");
Ext.setId(name);
imagedir = File.getParent(name);
imagefilename = File.getName(name);
print("Directory :", imagedir);
print("File Name :", imagefilename);

// get dimension of series 
Ext.getSeriesCount(seriesCount);
Ext.getSizeX(sizeX);
Ext.getSizeY(sizeY);
Ext.getSizeZ(sizeZ);
Ext.getSizeC(sizeC);
Ext.getSizeT(sizeT);
...

Unfortunately I always get the following macro error:

"Unrecognized Ext function in line 9. Ext. <setId> (name);"

But when Fiji is already running and I start Fiji as described above from the command line, the problem is gone and the CZI file is correctly opened via BioFormats.

So my question is, why I always get the Extension problem and on any ideas to solve it. My current workaround is to always start Fiji beforehand.

Cheers,

Sebastian
Comment 1 Curtis Rueden 2013-10-23 14:19:24 CDT
I just tested on my OS X 10.9 system and cannot reproduce this problem...
Comment 2 Sebastian Rhode 2013-10-26 04:40:16 CDT
Hi Curtis,

any idea what I could try to pin down the problem?

I use the option to start Fiji from the command line very often from inside our own IronPython Scripts. 
I use Win7 64bit and Fiji 64bit, so nothing really special.

Cheers,

Sebastian
Comment 3 Curtis Rueden 2013-12-02 16:26:14 CST
One thing you could do is verify which versions of ImageJ exhibit the issue. Does the problem happen with, e.g., 1.48a? If there is a particular version where the problem started happening, that would yield a clue to solving it.

Another thing you could do to workaround the problem is to write a small Java plugin that does the same thing as the Bio-Formats Macro Extensions you are calling. In Java you would have access to the full Bio-Formats API which is much more extensive than what you get with macros. Or you could use a different scripting language such as Javascript, Jython or Beanshell and have similarly rich functionality at your disposal.
Comment 4 Sebastian Rhode 2013-12-09 03:08:29 CST
Hi Curtis,

I just updated my Fiji today (every is up-to-date). Then I opened the BioFormats Shortcuts window and pressed "BioFormats Mcro Extension".

Here is the error message I got:

(Fiji Is Just) ImageJ 1.48i; Java 1.7.0_21 [64-bit]; Windows 7 6.1; 52MB of 5000MB (1%)
 
java.lang.NoClassDefFoundError: org/libjpegturbo/turbojpeg/TJ
	at loci.formats.services.JPEGTurboServiceImpl.<init>(JPEGTurboServiceImpl.java:113)
	at loci.formats.in.HamamatsuVMSReader.<init>(HamamatsuVMSReader.java:79)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at java.lang.Class.newInstance0(Class.java:374)
	at java.lang.Class.newInstance(Class.java:327)
	at loci.formats.ImageReader.<init>(ImageReader.java:134)
	at loci.plugins.util.LociPrefs.makeImageReader(LociPrefs.java:84)
	at loci.plugins.macro.LociFunctions.<init>(LociFunctions.java:99)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at java.lang.Class.newInstance0(Class.java:374)
	at java.lang.Class.newInstance(Class.java:327)
	at ij.IJ.runUserPlugIn(IJ.java:194)
	at ij.IJ.runPlugIn(IJ.java:160)
	at ij.IJ.runPlugIn(IJ.java:149)
	at loci.plugins.shortcut.ShortcutPanel$1.run(ShortcutPanel.java:192)
Caused by: java.lang.ClassNotFoundException: org.libjpegturbo.turbojpeg.TJ
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	... 21 more
Comment 5 Curtis Rueden 2013-12-12 15:36:30 CST
* Help > Update Fiji
* Advanced mode
* View Options -> "View all files"
* Type "turbo" into the Search

Do you see "Jars/bio-formats/turbojpeg.jar" listed as "Up-to-date"?
Comment 6 Sebastian Rhode 2013-12-17 02:41:10 CST
Hi Curtis,

I updated my Fiji today (2013_12_17) and now the problem is gone. And turbojpeg.jar is listed now.

Honestly I have no idea why is that, but let´s close the bug for now.

Cheers,

Sebi
Comment 7 Curtis Rueden 2014-06-16 13:36:36 CDT
OK, closed.