Cut-off Value Weka segmentation


#1

Hi everyone!

I’m using the script I found here (http://imagej.net/Scripting_the_Trainable_Segmentation#Example:_apply_classifier_to_all_images_in_folder) to segment a great number of images. However for some images I get the error message:

Could not apply Classifier!

These all seem to be images that have a very low mean (i.e. most of the picture is black)
So I was wondering if there is some cut-off value for using Weka. Then I could select these files before, because now the batchprocessing has to be started over each time.

Thank you for helping me out!


Sensitivity of Weka Segmentation Scripts / Input images
#2

Hello @EmmaC,

Is this the only error you get? Can you tell me what is written in the console as well, please?

Also, it would help if you tell us a few more details, namely: the operative system you are using; how much RAM you have on your machine; the number, size and type of the images you use, etc.

Thanks in advance!


Problem in running Weka Segmentation script
#3

Hi @iarganda,

I’m fairly new in using ImageJ and not much of a computer buff, but I’ll try answering your questions as best I can :wink:

The error I get in the console is this:

Sourced file: null : Object constructor : at Line: 37 : in file: : new FileSaver ( result )

Target exception: java.lang.NullPointerException

at bsh.BSHAllocationExpression.constructObject(BSHAllocationExpression.java:126)
at bsh.BSHAllocationExpression.objectAllocation(BSHAllocationExpression.java:108)
at bsh.BSHAllocationExpression.eval(BSHAllocationExpression.java:56)
at bsh.BSHPrimarySuffix.doSuffix(BSHPrimarySuffix.java:97)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:74)
at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
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 org.scijava.plugins.scripting.beanshell.BeanshellScriptEngine.eval(BeanshellScriptEngine.java:80)
at org.scijava.script.ScriptModule.run(ScriptModule.java:177)
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$2.call(DefaultThreadService.java:191)
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)

Caused by: java.lang.NullPointerException
at ij.io.FileSaver.(FileSaver.java:35)
at sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at bsh.Reflect.constructObject(Reflect.java:621)
at bsh.BSHAllocationExpression.constructObject(BSHAllocationExpression.java:117)
… 28 more

I’m using Fiji on Windows, RAM is 8GB, the biggest batch of images I have is about 7000 images each 120x120 pixels in jpeg format.

Hopefully this helps!


#4

Sure, no worries!

This seems a secondary error produced when attempting to save the output of the classification because the classifier failed. Don’t you get any message before your close the window that reads “Could not apply classifier!”?

Would it be possible for your to send me the problematic images and the classifier you are using?


#5

I can’t open the classifier here apparently but the images I’m having problems with are like these:

Thanks you for helping me out!


Sensitivity of Weka Segmentation Scripts / Input images
#6

If the classifier files is not too large, can you send it to my e-mail? Otherwise, please upload it to Dropbox or Google drive. That way I will be able to reproduce the problem on my computer.

Thanks!


#7

It seems @EmmaC trained her classifier on RGB images but applied it on an 8-bit image. That was the origin of the error, so I’m going to marked this issue as solved.

Cheers!