Problem using ROIs

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

Problem using ROIs

Franz Graf-2
Hello,

I'm using ImageJ for a project at university and came across a problem
when using ROIs. I've created a (quick & dirty) sample plugin to
demonstrate my problem: http://www.cip.ifi.lmu.de/~graff/uni/ROI_Marker.java

The paintRoi() method creates an OvalRoi and colors the masked pixels
(within the oval) red. At least it's supposed to do that.

It's no problem when it's called from the run() method. But when it's
called from the JFrame (which is opened by the plugin) the OvalRoi is
shown, but all pixels in the bounding rectangle are colored red.

Why is it like that? Can I only create and apply ROIs within the run()
method or what's the correct way to achieve the correct masking?

Regards,
Franz
Reply | Threaded
Open this post in threaded view
|

Re: Problem using ROIs

Wayne Rasband
> I'm using ImageJ for a project at university and came across
> a problem when using ROIs. I've created a (quick & dirty)
> sample plugin to demonstrate my problem:
> http://www.cip.ifi.lmu.de/~graff/uni/ROI_Marker.java
>
> The paintRoi() method creates an OvalRoi and colors the
> masked pixels (within the oval) red. At least it's supposed
> to do that.
>
> It's no problem when it's called from the run() method. But
> when it's called from the JFrame (which is opened by the
> plugin) the OvalRoi is shown, but all pixels in the bounding
> rectangle are colored red.
>
> Why is it like that? Can I only create and apply ROIs within
> the run() method or what's the correct way to achieve the
> correct masking?

Use the ImageProcessor.reset(mask) method to do the masking. I updated
the sample program to do this.

     http://rsb.info.nih.gov/ij/plugins/download/misc/ROI_Marker.java

-wayne