Login  Register

Re: Help needed to write a macro to merge several polygon regions into one

Posted by jmutterer on Oct 06, 2009; 8:19pm
URL: http://imagej.273.s1.nabble.com/Help-needed-to-write-a-macro-to-merge-several-polygon-regions-into-one-tp3690917p3690918.html

Dilip,
As you're creating new ROIs, add them to the ROI Manager.
At the end of the loop, use the Combine command. Also check the other
roiManager() functions at:
http://rsb.info.nih.gov/ij/developer/macro/functions.html
jerome

This example creates 2 ROIs and combines them.

run("Blobs (25K)");
makeRectangle(7, 21, 56, 49);
roiManager("Add");
makeRectangle(113, 47, 56, 49);
roiManager("Add");
roiManager("Combine");


On Tue, Oct 6, 2009 at 10:17 AM, Dilip Baluguri <
[hidden email]> wrote:

> Hi,
>   I need a macro to merge several polygon regions into one region.
> Initially I have one selected region and after every iteration of for loop
> I get a new region. By the end of this for loop I should have only one
> polygon which combines all those polygons
>