X
5694

How to create a "donut" ROI with IDL

This Help Article explains how to create a "donut" ROI using IDL. A "donut" ROI is a polygon ROI with a hole in the middle.

This type of ROI is defined by 2 Polygons. For example, a “donut” ROI can be define by 2 squares: 1 interior and 1 exterior:

     ;exterior polygon

     part_out=[[100,100],[400,100],[400,400],[100,400],[100,100]]

     ;interior polygon

     part_in=[[200,200],[300,200],[300,300],[200,300],[200,200]]

The ROI should then be created as a ROI group:

     Obj=IDLanROIGroup()

Each polygon should then be added to the ROI group as an exterior and an interior ROI:

     Obj_out = IDLanROI(part_out)

     Obj_in = IDLanROI(part_in,/INTERIOR)

     Obj.add,obj_out

     Obj.add,obj_in

A mask is then computed to create the "donut" ROI:

           Result = Obj.ComputeMask(DIMENSIONS=[500,500])

 

The output mask shows the ROI in black

            im=image(bytscl(result))

 

____________________________________________________________

Reviewed by DS on 1/22/2014