Removing multiple ROIs
Posted by Ohkyung on Jun 11, 2010; 9:15pm
URL: http://imagej.273.s1.nabble.com/Removing-multiple-ROIs-tp3687938.html
Dear ImageJ users,
I am trying to remove several ROIs from ROI manager in a macro. I know
there is a way to do so in plugin programming. However, I want to do
this in macro if it is not impossible.
1. No problem to delete one ROI from the manager.
roiManager("Select", index);
roiManager("Delete");.
2. However, when I try to delete several ROIs at the same time, it is
not working. I think that it is due to the fact that roi manager
automatically reassign new index starting from 0 when I delete one Roi
from roi manager. Thus, I cannot delete several ROIs that I want to
delete.
for (iRow = 0; iRow <nResults; iRow++) {
area = getResult("Area", iRow);
if (area >= 200) {
roiManager("Select", iRow);
roiManager("Delete");
}
}
3. I also tried to select multiple ROIs first. Then delete them. But
this also did not work.
for (iRow = 0; iRow <nResults; iRow++) {
area = getResult("Area", iRow);
if (area >= 200) {
roiManager("Select", iRow);
}
}
roiManager("Delete");
Any good ideas? Thanks very much in advance.
Best regards,
Ohkyung
P.S.
To select unwated ROIs, I want to use different parameters that are
not currently supported by ImageJ. I used "Area" just to demonstrate
what I want to do.