Login  Register

Re: Bug with ROI properties

Posted by Wayne Rasband-2 on Feb 07, 2018; 9:45pm
URL: http://imagej.273.s1.nabble.com/Bug-with-ROI-properties-tp5020023p5020025.html

> On Feb 7, 2018, at 11:10 AM, Christophe Leterrier <[hidden email]> wrote:
>
> Hi Wayne and the ImageJers,
>
> There is something strange in the ROI properties. If I run this macro:

After making a change to an ROI you need to call roiManager("update”) to update the corresponding ROI on the ROI Manager.

   run("Select All");
  roiManager("Add");
  roiManager("select", roiManager("count")-1);
  Roi.setProperty("TracingType", "" + 1);
  roiManager("update”);
  roiManager("select", roiManager("count")-1);
  print(Roi.getName);
  print(Roi.getProperties);
  print(Roi.getProperty("TracingType"));

-wayne

> run("Select All");
> roiManager("Add");
> roiManager("select", roiManager("count")-1);
> Roi.setProperty("TracingType", "" + 1);
> // roiManager("select", roiManager("count")-1);
> print(Roi.getName);
> print(Roi.getProperties);
> print(Roi.getProperty("TracingType"));
>
> The output is :
> 0001-1024-1024
> TracingType: 1
> 1
>
> But if I re-select the ROI before asking for its properties (note the
> uncommented line):
>
> run("Select All");
> roiManager("Add");
> roiManager("select", roiManager("count")-1);
> Roi.setProperty("TracingType", "" + 1);
> roiManager("select", roiManager("count")-1);
> print(Roi.getName);
> print(Roi.getProperties);
> print(Roi.getProperty("TracingType"));
>
> Then the output is OK for the name, but the properties are now an empty
> string:
> 0001-1024-1024
>
> I use properties to "tag" ROIs between macros so right now the properties
> are lost, due to this bug I think.
>
> Thanks for your help,
>
> Christophe

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