Re: ROI intersection
Posted by Wayne Rasband on Jul 08, 2006; 5:04pm
URL: http://imagej.273.s1.nabble.com/ROI-intersection-tp3701011p3701013.html
>> Has anybody an idea how to create a ROI intersection in a macro
>> easily?
Here is a macro that creates the intersection of two ROI Manager
selections. It requires ImageJ 1.37j, which adds the
Edit>Selection>Create Selection command.
requires("1.37j");
orig = getImageID();
setBatchMode(true);
if (roiManager("Count")!=2)
exit("Two ROIs in ROI Manager required");
roiManager("Select", 0);
run("Create Mask");
rename("Mask1");
mask1 = getImageID();
roiManager("Select", 1);
run("Create Mask");
mask2 = getImageID();
imageCalculator("AND", mask2, mask1);
run("Create Selection");
roiManager("Add");
selectImage(orig);
roiManager("Select", 2);
roiManager("Rename", "Intersection");
-wayne