I am currently trying to apply a classifier which I trained using the
"Trainable Weka Segmentation 3D" plugin on the GUI of Fiji.
If I apply the classifier (“3D classifier”) on any kind of image stack by
using the GUI, it works nicely. However, if I use a Beanshell script to do
the same task, it shows me some errors:
Could not apply classifier! Java.lang.ArrayIndexOutOfBoundsException: 18 ...
In contrast, if I train a classifier (“2D classifier”) using the 2D version
of the Trainable Weka Segmentation, it works on exactly the same stack in
both, using the GUI as well as using exactly the same Beanshell script.
The script I am using is the following:
import trainableSegmentation.*; import ij.io.FileSaver; import ij.IJ; import ij.ImagePlus; testImage = IJ.openImage( "try.tif" ); segmentator = new WekaSegmentation( ); segmentator.loadClassifier( "classifier.model" ); result = segmentator.applyClassifier( testImage, 0, false ); new FileSaver( result ).saveAsTiff( "try_classified.tif" );
In summary, I can apply a 2D classifier on an image stack using the GUI as
well as the above Beanshell script, whereas for the 3D classifier it works
only using the GUI and not for the script.
Does any of you know about this problem?
Thank you and kind regards,