trouble defining an ROI in python

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

trouble defining an ROI in python

Aryeh Weiss
I am trying to define an ROI within which teh particle analyzer will
operate.

so I tried the following

imp.setRoi(rm.select(i))   #rm is an existing RoiManager
     IJ.run(imp, "Analyze Particles...", "size=1-Infinity summarize
in_situ")

but this measured on the entire image.

I also tried

     options = PA.SHOW_SUMMARY
     parameters = PA.AREA
     rt = ResultsTable()

     myPA = PA(options, parameters, rt, 1,100000 )

     ip - imp.getProcessor()

     roi = rm.select(i)
     imp.setRoi(roi)
     ip.setRoi(roi)
     imp.updateAndDraw()
     myPA.analyze(imp, ip)

In both cases, the measurement is done over the entire image, and not
within the ROI.

What am I doing wrong?

--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: trouble defining an ROI in python -solved

Aryeh Weiss
My mistake was using roi = rm.select(i), which returns None.
I needed roi = rm.getRoi(i), which returns an Roi.


On 13/02/2018 21:22, Aryeh Weiss wrote:
>
> I am trying to define an ROI within which teh particle analyzer will
> operate.
>
> so I tried the following
>
> imp.setRoi(rm.select(i))   #rm is an existing RoiManager
>
should be imp.setRoi(rm.getRoi(i))

>
>     IJ.run(imp, "Analyze Particles...", "size=1-Infinity summarize
> in_situ")
>
> but this measured on the entire image.
>
> I also tried
>
>     options = PA.SHOW_SUMMARY
>     parameters = PA.AREA
>     rt = ResultsTable()
>
>     myPA = PA(options, parameters, rt, 1,100000 )
>
>     ip - imp.getProcessor()
>
>     roi = rm.select(i)
>
should be rm.getRoi()

>
>     imp.setRoi(roi)
>     ip.setRoi(roi)
>     imp.updateAndDraw()
>     myPA.analyze(imp, ip)
>
> In both cases, the measurement is done over the entire image, and not
> within the ROI.
>
> What am I doing wrong?
>
> --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