I was wondering what the commands were for creating a set of multi-point selections in the ImageJ API? I feel like I’m missing something obvious.
Hi @Llamero,
you can use the PointRoi(int[], int[], int)
contstructor to create a multi-point selection.
An example Groovy script to create three points along the diagonal on the active image:
import ij.gui.PointRoi;
import ij.IJ;
pointRoi = new PointRoi([0, 10, 20] as int[], [0, 10, 20] as int[], 3);
imagePlus = IJ.getImage();
imagePlus.setRoi(pointRoi);
Best,
Stefan
You can also record your actions (selections, etc.) with the Macro Recorder to get the required commands easily:
https://imagej.nih.gov/ij/docs/guide/146-31.html#sub:Record…
In the case of multi-point selections, this is not true.
When in Macro recording mode, the recorder will only record the first point you clicked. In Javascript or Java mode, these actions are currently not recorded at all in Fiji.
But you can always refer to the macro functions (makePoint
and makeSelection
) or the ImageJ Javadoc (see ImagePlus#setRoi
and the the subclasses of Roi
)
Yes multipoint are an exception. However it is easy to create a mutlipoint selection:
makeSelection("point", newArray(50,100,150,140), newArray(40,25,50,100));
See:
Awesome, that’s super easy.