Re: how to access the ROI programmatically?
Posted by
William O'Connell on
Jul 04, 2006; 12:10am
URL: http://imagej.273.s1.nabble.com/how-to-access-the-ROI-programmatically-tp3702303p3702312.html
Hi Per,
Maybe check that roi isn't null, then something like this:
Roi roi =imp.getRoi();
Rectangle rect = roi.getBounds();
rx = rect.x; ry = rect.y; w = rect.width; h = rect.height;
for(int y=ry; y<ry+h; y++)
for(int x=rx; x<rx+w; x++) {
if(roi.contains(x, y)) {
......do what you want to do
}
-------------- Original message ----------------------
From: Per Christian Henden <
[hidden email]>
> Hi group,
>
> I need to do a check for whether or not a certain point/pixel coordinate is
> contained in the ROI.
> My code is of the form
> for all pixels, if pixels is in ROI, do stuff
> The ROI is a path resulting from freehand selection.
>
> I was not able to find such a function in the API documentation. Is there a
> function like the one I'm describing? Any suggestions on how to implement it?
>
> Cheers,
>
> PER