Login  Register

Re: how to run the same macro to a set of ROIs on 1 image ?

Posted by Aryeh Weiss on Jan 28, 2016; 12:54pm
URL: http://imagej.273.s1.nabble.com/how-to-run-the-same-macro-to-a-set-of-ROIs-on-1-image-tp5015474p5015478.html

On 28/01/2016 1:58 PM, Vero wrote:

> Hello everybody,
> I have to analyze mean gray values (min and max too) for about 50 nuclei, on
> each image of my study (80 images).
> I found a method to determine automatically ROI for each nucleus (by
> tresholding and analyzing particles with adding to Manager). But before
> analyzing mean gray values, the ROI has to be transformed to a band with the
> function Edit / Selection / Make band (automatized in a macro).
> Could someone, please, give me a solution to run the macro on all ROIs of a
> set ? Actually, the ROIs in the Manager are not consider as selections...
> Thanks in advance,
> Vero
>
>

You can loop overall of the ROIs in the ROI manager

         roiCount = roiManager("count");
         for (i=0; i<roiCount; i++) {
             selectImage(edfTitle);  // I made sure the image I wanted
was selected
             roiManager("select", i);  // select teh ROI
             // do whatever you want with the ROI selected

         }


If you intend to delete ROis, then I suggest you loop from the bottom
up. That is
for (i=roiCount; i>0; i--)

Hope this helps
--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html