Accessing all pixels in ROI?

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

Accessing all pixels in ROI?

Mohamed Tleis
Dear Folks,

I would like to be directed to some tutorial or samples of how to read all
the pixels of a ROI.
Google didn't help me .

Best Regards,
Mohamed Tleis
Reply | Threaded
Open this post in threaded view
|

Re: Accessing all pixels in ROI?

dscho
Hi,

On Tue, 20 Dec 2011, Mohammed Tlais wrote:

> I would like to be directed to some tutorial or samples of how to read
> all the pixels of a ROI.

In fiji-lib.jar there is some generic RoiStatistics class doing that:
http://fiji.sc/RoiStatistics.java (it is more generic than needed by the
class because I needed to subclass it for another project of mine).
Unfortunately, there is a bug at the moment where it does not work
reliably in all the cases but maybe you're lucky.

Short version is to make a mask, use the correct offset (which is the
problem in some circumstances) and then iterate over the pixels inside the
bounding box and test the mask's pixels.

This is more complicated, but also much faster, than using Roi's
contains() method (which Google or at least a basic search through the
Javadocs should have turned up).

Ciao,
Johannes
Reply | Threaded
Open this post in threaded view
|

Re: Accessing all pixels in ROI?

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Mohamed Tleis
On Dec 20, 2011, at 9:25 AM, Mohammed Tlais wrote:

> Dear Folks,
>
> I would like to be directed to some tutorial or samples of how to read all
> the pixels of a ROI.
> Google didn't help me .

There is an example plugin at

    http://imagej.nih.gov/ij/plugins/calculate-mean.html

that does this.

-wayne