Login  Register

Re: Not so easy ROI Manager macro

Posted by CARL Philippe (LBP) on Sep 05, 2014; 7:08am
URL: http://imagej.273.s1.nabble.com/Not-so-easy-ROI-Manager-macro-tp5009440p5009516.html

Dear all,
I was finally able to write the macro I requested some help for and the
result is the following:

        run("Clear Results");
        for(k = 0; k != roiManager("count"); k++)
        {
                roiManager("select", k);
                Roi.getBounds(x, y, width, height);
                for(i = x; i <= x + width; i++)
                        for(j = y; j <= y + height; j++)
                                if(selectionContains(i, j))
                                {
                                        nbPixels = nResults;
                                        setResult("x"    , nbPixels, i);
                                        setResult("Y"    , nbPixels, j);
                                        setResult("index", nbPixels, k);
                                }
        }

My problem about developing this macro is that I wasn't aware about the
"selectionContains(x, y)" function that I was looking for within the "ROI
Functions".
My best regards,
Philippe

On Sep 1, 2014, at 9:23 AM, Philippe CARL wrote:

> Dear all,
>
> I have a whole bunch of ROIs saved within the ROI Manager for which I
> would like to create a macro that creates me a file (or alternatively
> a results
> window) containing the x, y positions (2 first columns) of all the
> pixels within the different ROIs together with a tag (3rd column)
> referring to the given ROI ID within the ROI Manager (= ROI Name
> within
 the ROI Manager).

>
> You ideas on the best strategies for writing such a macro are more
> than welcome.
>
> Also the link:
>
> http://rsbweb.nih.gov/ij/docs/macros/Roi_Properties_Test.txt
>
> that is given as example for the getProperty(), setProperty() and
> getProperties() methods additions of Jérôme on the 1.48h 30 November
> 2013 update seems to be broken.
>
> I thank you very much in advance.
>
> My best regards,
>
> Philippe
>
>
>
> Philippe CARL
>
> Laboratoire de Biophotonique et Pharmacologie
>
> UMR 7213 CNRS - Université de Strasbourg
>
> Faculté de Pharmacie
>
> 74 route du Rhin
>
> 67401 ILLKIRCH
>
> Tel : +33(0)3 68 85 41 84

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