Posted by
Maurice Argive on
URL: http://imagej.273.s1.nabble.com/Weka-3D-Trainable-Segmentation-in-Java-code-tp5019213.html
I'm using the following code to classify images from the command line:
ImagePlus image = IJ.openImage("image-file-to-be-classified.tif");
WekaSegmentation ws = new WekaSegmentation(image);
ws.loadClassifier("saved-model-file.model");
ImagePlus output = ws.applyClassifier(image, 0, false);
IJ.save(output, "output.tif");
output.close();
image.close();
and this has been working well for me for a few years. I noticed in a
recent Fiji upgrade that there is now a 3D menu option. I'm trying to use
that feature in code so I use:
ImagePlus image = IJ.openImage("image-file-to-be-classified.tif");
WekaSegmentation ws = new WekaSegmentation(true);
ws.setTrainingImage(image);
ws.loadClassifier("saved-model-file.model");
ImagePlus output = ws.applyClassifier(image, 0, false);
IJ.save(output, "output.tif");
output.close();
image.close();
and it seems to be working until the applyClassifier method runs. I then
get a number of HeadlessExceptions that I never got before. Is there a way
to run the 3D segmentation in code without the GUI?
Thanks!
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html