Problem with ROI (bounding rectangle)

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

Problem with ROI (bounding rectangle)

JCS Trans Jakub Szafarek
Hi,

I am the new user of ImageJ library... So I have got one question.
I want to make PolygonRoi, make it active and add to each pixel in selected ROI some Value.
I wrote code:

roi=new Polygon(xpoints,ypoints, 4, imageplus, Roi.POLYGON);
imageplus.setRoi(roi)
imageprocesor.add(value)


When I Start aplication, roi is made, is selected and "add" operation is done well, but it makes "add" for the selected polygonroi and the bounding rectangle of this roi,

What is wrong? what must I change to work it correct?


Thx a lot

Jakub
Reply | Threaded
Open this post in threaded view
|

Re: Problem with ROI (bounding rectangle)

Michael Schmid
Hi Jacub,

The ImageProcessor operations work on the rectangular area
enclosing the roi.

So you should set the roi to the ImageProcessor and call
ip.reset(ip.getMask()) after the operation.
The ImageProcessor must have a snapshot taken before the
operation: either call ip.snapshot() or in a PlugInFilter
specify the SNAPSHOT flag.

For (Extended)PlugInFilters that do not change the roi, the
PlugInFilterRunner of ImageJ takes care about snapshot and
reset if the SUPPORTS_MASKING flag is set.

Michael
________________________________________________________________

On 15 Jan 2008, at 10:17, JCS Trans Jakub Szafarek wrote:

> Hi,
>
> I am the new user of ImageJ library... So I have got one question.
> I want to make PolygonRoi, make it active and add to each pixel in  
> selected ROI some Value.
> I wrote code:
>
> roi=new Polygon(xpoints,ypoints, 4, imageplus, Roi.POLYGON);
> imageplus.setRoi(roi)
> imageprocesor.add(value)
>
>
> When I Start aplication, roi is made, is selected and "add"  
> operation is done well, but it makes "add" for the selected  
> polygonroi and the bounding rectangle of this roi,
>
> What is wrong? what must I change to work it correct?
>
>
> Thx a lot
>
> Jakub