Login  Register

Re: A problem with Roi.setProperty

Posted by Avital Steinberg on Apr 28, 2015; 4:08am
URL: http://imagej.273.s1.nabble.com/A-problem-with-Roi-setProperty-tp5012625p5012632.html

Hi Wayne,
Thank you for your answer - now I can use this feature to classify my ROIs,

Avital

On Tue, Apr 28, 2015 at 6:21 AM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> > On Apr 27, 2015, at 11:32 AM, Avital Steinberg <
> [hidden email]> wrote:
> >
> > Hi,
> > I'm having trouble with Roi.setProperty (or Roi.getProperty). The
> following
> > code requires an image to be open and requires one ROI to be added to the
> > ROI manager:
> >
> > roiManager("select", 0);
> > Roi.setProperty("narrow",1);
> > print(Roi.getProperty("narrow"));
> >
> > print("Property before re-select=" + Roi.getProperty("narrow"));
> >
> > roiManager("select", 0);
> > print("Property after re-select=" + Roi.getProperty("narrow"));
> >
> > When I run these lines of code, I get the following output:
> >
> > 1
> > Property before re-select=1
> > Property after re-select=
> >
> > Why can't I select the ROI from the ROI manager again and get the
> property?
>
> You need to update the version of the ROI in the ROI Manager after making
> changes. This version of your macro
>
>   roiManager("select", 0);
>   Roi.setProperty("narrow",1);
>   roiManager("update");
>   print("Property before re-select=" + Roi.getProperty("narrow"));
>   roiManager("select", 0);
>   print("Property after re-select=" + Roi.getProperty("narrow"));
>
> outputs
>
>   Property before re-select=1
>   Property after re-select=1
>
> -wayne
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html