Login  Register

Re: Removing multiple ROIs

Posted by Oky on Jun 11, 2010; 10:31pm
URL: http://imagej.273.s1.nabble.com/Removing-multiple-ROIs-tp3687938p3687940.html

Yes, it is working. Simple. :)

Thanks very much.

On Fri, Jun 11, 2010 at 2:50 PM, Johannes Schindelin
<[hidden email]> wrote:

> Hi,
>
> On Fri, 11 Jun 2010, Ohkyung wrote:
>
>> 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.
>
> Yes, it must do that, as there cannot be a ROI without an index all of a
> sudden.
>
>> 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");
>>                       }
>>               }
>
> Why not just go backwards?
>
>                for (iRow = nResults - 1; iRow >= 0; iRow--)
>                ...
>
> Hth,
> Johannes
>



--
Ohkyung Kwon

http://www.linkedin.com/in/ohkyung
http://www.wpskorea.org
http://ncmir.ucsd.edu