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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Vero

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
Reply | Threaded
Open this post in threaded view
|

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

Aryeh Weiss
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
Reply | Threaded
Open this post in threaded view
|

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

Krs5
In reply to this post by Vero
Dear Vero,

You have to do this for each ROI individually. The code below will do this.

for (i=0; i<roiManager("count");i++){
        roiManager("Select", i);
        run("Make Band...", "band=5");
        roiManager("Update"); //In case you want to have the band selection replacing the original selection, otherwise delete the line
}


Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Vero
Sent: 28 January 2016 11:59
To: [hidden email]
Subject: how to run the same macro to a set of ROIs on 1 image ?

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



--
View this message in context: http://imagej.1557.x6.nabble.com/how-to-run-the-same-macro-to-a-set-of-ROIs-on-1-image-tp5015474.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

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