Re: trouble defining an ROI in python -solved

Posted by Aryeh Weiss on
URL: http://imagej.273.s1.nabble.com/trouble-defining-an-ROI-in-python-tp5020088p5020089.html

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