Login  Register

Re: Problem with plugin 3 points ROI

Posted by Rasband, Wayne (NIH/NIMH) [E] on Feb 17, 2011; 8:37pm
URL: http://imagej.273.s1.nabble.com/Problem-with-plugin-3-points-ROI-tp3685654p3685655.html

On Feb 17, 2011, at 1:05 PM, Eric Leroy wrote:

> Hello
>
> I included the plugin from G Landini called 3 points ROI into a macro to
> measure bubbles. The macro is :
> macro "3Points [F6]" {
> run("ThreePointCircularROI ");
> run("Measure");
> //run("Select None");
> }
>
> My problem is that the macro works for one or two points and after it
> crashes and I have the following message :
>
> java.lang.NullPointerException
>      at ij.ImagePlus.setRoi(ImagePlus.java:1325)
>      at ij.ImagePlus.setRoi(ImagePlus.java:1302)

You can create a three point circular selection by defining three points with the multi-point tool and then using the Edit>Selection>Fit Circle command, which was added in v1.44m.

  macro "3Points [F6]" {
    requires("1.44m");
    getSelectionCoordinates(x,y);
    if (selectionType!=10 || x.length!=3)
         exit("3 point selection required");
    run("Fit Circle");
    run("Measure");
  }

-wayne