Posted by
Wayne Rasband-2 on
URL: http://imagej.273.s1.nabble.com/Issue-with-the-RoiManager-getSelectedIndexes-method-tp5023885p5023886.html
> On Aug 28, 2020, at 6:56 PM, CARL Philippe (LBP) <
[hidden email]> wrote:
>
> Dear all (probably Wayne),
> In the case the Labels option is activated within the RoiManager, the Java method getSelectedIndexes() of the RoiManager class will then be returning the indexes of all the ROIs within the RoiManager and this independently whether they had been selected or not.
> And when the Labels option is desactivated, the getSelectedIndexes() method is then working as expected.
I am unable to reproduce this problem using the following JavaScript code:
img = IJ.createImage("Untitled", "8-bit black", 400, 400, 1);
img.show();
rm = RoiManager.getRoiManager();
rm.reset();
for (i=0; i<5; i++) {
roi = OvalRoi.create(i*70, i*70, 70, 70);
rm.addRoi(roi);
}
rm.setSelectedIndexes([2,4]);
rm.runCommand(img,"Show All with labels");
indexes = rm.getSelectedIndexes();
for (i=0; i<indexes.length; i++)
print(i+" "+indexes[i]);
This is the output:
0 2
1 4
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html