Routines (alphabetical) > Routines: D > DRAW_ROI Procedure

# DRAW_ROI Procedure

The DRAW_ROI procedure draws a region or group of regions to the current Direct Graphics device. The primitives used to draw each ROI are based on the TYPE property of the given IDLanROI object. The TYPE property selects between points, polylines, and filled polygons.

## Examples

The following example displays an image and collects data for a region of interest. The resulting ROI is displayed as a filled polygon.

PRO roi_ex
; Load and display an image.
img=READ_DICOM(FILEPATH('mr_knee.dcm',SUBDIR=['examples','data']))
WINDOW, 0, XSIZE = 256, YSIZE = 400
TV, img
XYOUTS, 20, 350, 'To create a region:', CHARSIZE=1.25, /DEVICE
XYOUTS, 20, 325, 'Left mouse: select points for a region', /DEVICE
XYOUTS, 20, 310, 'Right mouse: complete the region', /DEVICE
XYOUTS, 20, 285, '(Click right mouse before closing)', /DEVICE
; Create a polygon region object.
oROI = OBJ_NEW('IDLanROI', TYPE=2)
; Collect first vertex for the region.
CURSOR, xOrig, yOrig, /UP, /DEVICE
oROI->AppendData, xOrig, yOrig
PLOTS, xOrig, yOrig, PSYM=1, /DEVICE
;Continue to collect vertices for region until right mouse button.
x1 = xOrig
y1 = yOrig
while !MOUSE.BUTTON ne 4 do begin
x0 = x1
y0 = y1
CURSOR, x1, y1, /UP, /DEVICE
PLOTS, [x0,x1], [y0,y1], /DEVICE
oROI->AppendData, x1, y1
endwhile
PLOTS, [x1,xOrig], [y1,yOrig], /DEVICE
; Draw the the region with a line fill.
DRAW_ROI, oROI, /LINE_FILL, SPACING=0.2, ORIENTATION=45, /DEVICE
END

## Syntax

DRAW_ROI, oROI [, /LINE_FILL] [, SPACING=value]

Graphics Keywords: [, CLIP=[X0, Y0, X1, Y1]] [, COLOR=value] [, /DATA | , /DEVICE | , /NORMAL] [, LINESTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, /NOCLIP] [, ORIENTATION=ccw_degrees_from_horiz] [, PSYM=integer{0 to 10}] [, SYMSIZE=value] [, /T3D] [, THICK=value]

## Arguments

### oROI

A reference to an IDLanROI object to be drawn.

## Keywords

### LINE_FILL

Set this keyword to indicate that polygonal regions are to be filled with parallel lines, rather than using the default solid fill. When using a line fill, the thickness, linestyle, orientation, and spacing of the lines may be specified by keywords.

### SPACING

The spacing, in centimeters, between the parallel lines used to fill polygons.

### Graphics Keywords Accepted

CLIP, COLOR, DATA, DEVICE, LINESTYLE, NOCLIP, NORMAL, ORIENTATION, PSYM, SYMSIZE, T3D, THICK

## Version History

5.3 | Introduced