Re: Measuring signal intensity from an area enclosed between two ROIs
Posted by dscho on Oct 29, 2010; 8:06am
URL: http://imagej.273.s1.nabble.com/Measuring-signal-intensity-from-an-area-enclosed-between-two-ROIs-tp3686543p3686545.html
Hi,
On Fri, 29 Oct 2010, Avinash Kali wrote:
> I am trying to measure the signal intensity from a ring-like structure
> in my image.
>
> I drew an ROI enclosing the inner circle of the ring and another ROI
> enclosing the outer circle of the ring. I have noticed that in ImageJ
> 1.43 we can select multiple ROIs from ROI manager at the same time. This
> makes the two ROIs appear at the same time on the image. But how can I
> measure the signal intensity from the area enclosed between these two
> ROIs?
Actually, if you have a circular ROI enclosing another circular ROI, you
do not have a region _between_ them, but you have a region that is only in
one of them.
The ROI Manager offers some operations to combine ROIs, such as AND
(intersection) and OR (union), but not XOR (set difference). But you can
use this Javascript snippet to perform the operation:
-- snip --
importClass(Packages.ij.IJ);
importClass(Packages.ij.gui.ShapeRoi);
importClass(Packages.ij.plugin.frame.RoiManager);
roiManager = RoiManager.getInstance();
if (roiManager == null)
IJ.showMessage("No ROI Manager present!");
else {
rois = roiManager.getSelectedRoisAsArray();
if (rois.length != 2)
IJ.showMessage("Need exactly two selected ROIs!");
else {
roi = new ShapeRoi(rois[0]);
roi = roi.xor(new ShapeRoi(rois[1]));
roiManager.addRoi(roi);
}
}
-- snap --
Just open an editor in ImageJ, paste the code, and run it via Run>Run
Javascript (if I remember correctly; I use Fiji's script editor, of
course).
Before running it, you need to select exactly two ROIs in the ROI Manager.
Ciao,
Johannes