Hi Christophe and all,
you can add roiManager('update'); at the end of your code to work around
this.
But I agree the difference between 'show all' states can lead to unexpected
behaviours and should be documented if unchanged.
JeromeOn Thu, 9 Jan 2025 at 15:07, Christophe Leterrier < [email protected]> wrote: > Hi, > > I have a problem with setting custom ROI properties in a macro. If I store > a ROI in the ROI manager, then assign it properties while the "Show All" > checkbox is unchecked, the properties are properly assigned to the ROI. > > If I do the same thing with the "Show All" checkbox unchecked, the > properties are not assigned to the ROI. > > To test, run the following code: > > run("AuPbSn 40"); > > roiManager("Show All"); > makeRectangle(122, 76, 181, 141); > roiManager("add"); > roiManager("select",0); > Roi.setProperty("P1", "" + 1); > Roi.setProperty("P2", "Cat" + 1); > > roiManager("Show None"); > makeRectangle(510, 214, 53, 133); > roiManager("add"); > roiManager("select",1); > Roi.setProperty("P1", "" + 2); > Roi.setProperty("P2", "Cat" + 2); > > After that, if you select the first ROI in the ROI manager and click on the > "Properties" button of the ROI manager, in the dialog you will get a "List > Properties (2)" checkbox in the dialog. If you select the second ROI, you > will only get a "No properties" message under the "List coordinates" > checkbox. > > What is strange is that if I try to recall the properties of the second ROI > in the macro itself using "ROi.getProperty", the properties are there and I > can retrieve them. But if I save the two ROIs as a zip ROI set, open it > again, and try to retrieve the properties of the second ROI, they are gone. > > Thank you for your help, > > Christophe > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
