Programatically getting area of ROI

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

Programatically getting area of ROI

Petula Lau
Hi all,

I am working on a plugin that uses the ImageJ library.

We have ROIs stored as byte arrays in a postgresql database associated with an image.  What I have to do now is calculate the area of the ROI and store it back to the database – however I cannot use the ImageStatistics class since roi.getImage (once I convert the ROI back from bytes) is null.

How do I achieve this if I have the image's width/height in cm stored in the database?

Thanks a lot for your help.

Kind Regards,
Petula Lau
Software Developer
NIWA
--
Please consider the environment before printing this email.
NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Programatically getting area of ROI

C Heeney
> We have ROIs stored as byte arrays in a postgresql database associated with an image.  What I have to do now is
> calculate the area of the ROI and store it back to the database – however I cannot use the ImageStatistics class
> since roi.getImage (once I convert the ROI back from bytes) is null.

> How do I achieve this if I have the image's width/height in cm stored in the database?



Calculating the Area of the ROI can be done by summing over the ROI byte array (this is the area in Pixels). Note that it will be a negative value (pixels inside the ROI are given the value -1).

To calculate a physical area, you will need to know the pixel dimensions of the original image as well as the physical dimensions (so that you can work out the area of 1 pixel and therefore scale up to the area of the ROI)

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html