Use Weka from ImageJ macro: 'path' is required but unset

495 views Asked by At

I have tried Calling Weka from an ImageJ(Fiji) macro:

run("Trainable Weka Segmentation", "open=C:\\input\\test.tif inputfile=C:\input\test.tif path=[Ljava.lang.String;@77e655d8");

But when I run that I get an error message: 'path' is required but unset

This line is exactly the line I get when recording a macro and opening test.tif when the Trainable Weka Segmentation dialog starts. I have also tried without the inputfile and/or path variables.

How should I call "Trainable Weka Segmentation"?

1

There are 1 answers

0
Jan Eglinger On BEST ANSWER

The Trainable Weka Segmentation plugin doesn't adhere to the macro recording conventions of ImageJ, mainly because of its complex structure.

However, the correct way to interact with the plugin by macro scripting is described extensively in its documentation on the Fiji wiki. In summary, you need to something like:

open("C:\\input\\test.tif"); // open your file
run("Trainable Weka Segmentation"); // then start the plugin

call("trainableSegmentation.Weka_Segmentation.loadClassifier", "C:\\path\\to\\your\\classifier.model");

call("trainableSegmentation.Weka_Segmentation.getProbability");