Search code examples
javaimagej

ROIListener usage


I'm currently trying to make an ImageJ plugin that will make certain calculations based on two ROIs the user creates.

Currently, I'm just trying to get ROIListener to work correctly. The roiModified() function is never called. Does anyone know what I'm doing wrong? The plugin loads and compiles fine.

public class Event_Listener implements PlugIn, RoiListener {

public void run(String arg) {
    if (IJ.versionLessThan("1.43o")) return;
    Roi.addRoiListener(this);
    IJ.log("Event_Listener started");
}

@Override
public void roiModified(ImagePlus imp, int id) {
    System.out.println(id);
    switch(id) {
    case RoiListener.CREATED:
        imp.getRoi().setFillColor(Color.black);
        System.out.println("ROI Created");
        break;
    }
}

Solution

  • It seems someone (possibly you) have created an issue on github for this, and it has been solved now.

    Note that questions related to ImageJ usage and development are best asked on the ImageJ forum.