Login  Register

Re: subtraction of ROIs

Posted by Ben.BigHair on Jun 06, 2007; 1:28pm
URL: http://imagej.273.s1.nabble.com/subtraction-of-ROIs-tp3699147p3699154.html

Philippe Rosay wrote:

> Mark Besonen idea works, i've tried to record it as a macro...
> Can someone help me, as I do not want to use ROI no 3 and 4, but the last
> and  the penultimate (n th and n-1 th)?
> Philippe Rosay
>
>
> // macro sur une idée de Mark Besonen
> // soustraire deux régions donc une incluse dans l'autre
>
>  if (roiManager("Count")!=4)
>       exit("il n'y a pas exactement 4 ROI");
> // test car on utilise la ROI 3 et 4
>
> roiManager("Select", 2);
> run("Create Mask");
> // on prends la partie la plus grande dans un masque ici hilus et supra
>
> roiManager("Select", 3);
> run("Clear");
> // on selectionne la petite partie, ici le hilus et on retranche de la grande
>
> run("Create Selection");
> roiManager("Add");
> close();
> // on selectionne le résultat, et ajoute au ROI. On ferme la fenetre masque
>
> roiManager("Select", 4);
> roiManager("Rename", "supra");
> // simple renommage
>
Hi,

You can use the "count" method for roiManager to get objects near the
end of the roi list.

roiManager("select", roiManager("count")-1);  = n th
roiManager("select", roiManager("count")-2);  = n-1 th

Cheers,
Ben