WekaSegmentation - Classifier with "Structure Feature" on Linux machine

imagescience
weka
linux
headless
segmentation
Tags: #<Tag:0x00007fd6a0814588> #<Tag:0x00007fd6a081ff28> #<Tag:0x00007fd6a081f960> #<Tag:0x00007fd6a081f578> #<Tag:0x00007fd6a081f190>

#1

Dear all,

I want to run the WekaSegmentation in headless mode on a Linux machine (connected via SSH) to apply a trained classifier to several images. The script and workflow I use on the Linux machine work just fine with several classifiers. However, whenever I try to use classifiers which use “Structure” as a training feature I get the following error message:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
    Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
    WARNING: core mtj jar files are not available as resources to this classloader (sun.misc.Launcher$AppClassLoader@764c12b6)
    Field of view: max sigma = 16.0, min sigma = 0.0
    Membrane thickness: 1, patch size: 19
    Read class name: TAs
    Read class name: Normal Cortex
    Processing slices of 11611_2461_4_1010.tif in 1 thread(s)...
    Starting thread 0 processing 1 slices, starting with 1
    Creating features for slice 1...
    Exception in thread "Thread-3" java.lang.NoClassDefFoundError: imagescience/image/Image
            trainableSegmentation.FeatureStack.computeStructure(FeatureStack.java:3369)
            trainableSegmentation.FeatureStack.addStructure(FeatureStack.java:1574)
            trainableSegmentation.FeatureStack.updateFeaturesST(FeatureStack.java:2681)
            trainableSegmentation.WekaSegmentation$1ApplyClassifierThread.run(WekaSegmentation.java:4994)

            at trainableSegmentation.FeatureStack.computeStructure(FeatureStack.java:3369)
            at trainableSegmentation.FeatureStack.addStructure(FeatureStack.java:1574)
            at trainableSegmentation.FeatureStack.updateFeaturesST(FeatureStack.java:2681)
            at trainableSegmentation.WekaSegmentation$1ApplyClassifierThread.run(WekaSegmentation.java:4994)
    Caused by: java.lang.ClassNotFoundException: imagescience.image.Image
            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
            ... 4 more
    java.lang.NullPointerException
            trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:5058)
            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            java.lang.reflect.Method.invoke(Method.java:497)
            bsh.Reflect.invokeMethod(Reflect.java:131)
            bsh.Reflect.invokeObjectMethod(Reflect.java:77)
            bsh.Name.invokeMethod(Name.java:852)
            bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
            bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
            bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
            bsh.BSHAssignment.eval(BSHAssignment.java:71)
            bsh.BSHBlock.evalBlock(BSHBlock.java:125)
            bsh.BSHBlock.eval(BSHBlock.java:75)
            bsh.BSHBlock.eval(BSHBlock.java:41)
            bsh.BSHIfStatement.eval(BSHIfStatement.java:42)
            bsh.BSHBlock.evalBlock(BSHBlock.java:125)
            bsh.BSHBlock.eval(BSHBlock.java:75)
            bsh.BSHBlock.eval(BSHBlock.java:41)
            bsh.BSHIfStatement.eval(BSHIfStatement.java:42)
            bsh.BSHBlock.evalBlock(BSHBlock.java:125)
            bsh.BSHBlock.eval(BSHBlock.java:75)
            bsh.BSHBlock.eval(BSHBlock.java:41)
            bsh.BSHForStatement.eval(BSHForStatement.java:105)
            bsh.Interpreter.eval(Interpreter.java:659)
            bsh.Interpreter.eval(Interpreter.java:750)
            bsh.Interpreter.eval(Interpreter.java:739)
            org.scijava.plugins.scripting.beanshell.BeanshellScriptEngine.eval(BeanshellScriptEngine.java:68)
            org.scijava.script.ScriptModule.run(ScriptModule.java:159)
            org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
            org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
            org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
            org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:237)
            java.util.concurrent.FutureTask.run(FutureTask.java:266)
            java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            java.lang.Thread.run(Thread.java:745)

            at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:5058)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:497)
            at bsh.Reflect.invokeMethod(Reflect.java:131)
            at bsh.Reflect.invokeObjectMethod(Reflect.java:77)
            at bsh.Name.invokeMethod(Name.java:852)
            at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
            at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
            at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
            at bsh.BSHAssignment.eval(BSHAssignment.java:71)
            at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
            at bsh.BSHBlock.eval(BSHBlock.java:75)
            at bsh.BSHBlock.eval(BSHBlock.java:41)
            at bsh.BSHIfStatement.eval(BSHIfStatement.java:42)
            at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
            at bsh.BSHBlock.eval(BSHBlock.java:75)
            at bsh.BSHBlock.eval(BSHBlock.java:41)
            at bsh.BSHIfStatement.eval(BSHIfStatement.java:42)
            at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
            at bsh.BSHBlock.eval(BSHBlock.java:75)
            at bsh.BSHBlock.eval(BSHBlock.java:41)
            at bsh.BSHForStatement.eval(BSHForStatement.java:105)
            at bsh.Interpreter.eval(Interpreter.java:659)
            at bsh.Interpreter.eval(Interpreter.java:750)
            at bsh.Interpreter.eval(Interpreter.java:739)
            at org.scijava.plugins.scripting.beanshell.BeanshellScriptEngine.eval(BeanshellScriptEngine.java:68)
            at org.scijava.script.ScriptModule.run(ScriptModule.java:159)
            at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
            at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
            at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
            at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:237)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

I know that I have to add ImageScience to my Update sites before using the structure feature which I did and updated several times on my linux machine. The classifiers work just fine on my windows-based desktop. When I check the current update sites on the linux machine I get the following:

~ $ /homeb/.../Fiji.app/ImageJ-linux64 --update list-update-sites
ImageJ: http://update.imagej.net/
Fiji: http://update.fiji.sc/
Java-8: http://sites.imagej.net/Java-8/
ImageScience: http://sites.imagej.net/ImageScience/

However, I still get the error message with classifiers using “Structure” as mentioned above.

How can I use classifiers with the “Structure” feature on my Linux machine?

Thank you!
Lars


#2

Hello @ladida ,

That feature is part of ImageScience, so you need to add its corresponding update site in order to use it as explained in the plugin wiki site:

NOTE: The features named Derivatives, Laplacian and Structure belong to the ImageScience suite and need to be activated by enabling the ImageScience update site in the updater.

I hope this helps!

ignacio


#3

Hello Ignacio!

thank you very much for your reply. I already added imageScience to the update site, and when I check the update site using ~ $ /homeb/.../Fiji.app/ImageJ-linux64 --update list-update-sites it confirms that ImageScience has been added to the update sites. However, the classifier still isn’t working.

Best wishes,
Lars

BTW @iarganda: Great work with weka! I love it!


#4

Dear @ladida,

Do you have an imagescience.jar file in Fiji.app/jars/?

Best,
Stefan


#5

Maybe you didn’t restart Fiji after getting the ImageScience jar?