Coyote Graphics Active Contour Routines

Date: Sat Oct 26 10:20:40 2013

single page | use frames     summary     class     fields     routine details     file attributes

.\

activecontour__define.pro

Graphics, Analysis


This program allows the user to experiment with a Gradient Vector Flow active contour algorithm, as described by Chenyang Xu and Jerry L. Prince in "Snakes, Shapes, and Gradient Vector Flow" in the March 1998 IEEE Transactions on Image Processing, Vol. 7, No.3. Additional information, including references to research papers, is available via Cheyang Xu's web page.

Active contours are also described as "snakes", because they writhe and move under the influence of external and internal forces, toward a feature of interest in an image, usually an edge. This program gives the user the opportunity to control both external and internal forces to find an optimal set of active contour parameters. Active contours are most often used with images to find and describe regions of interest.

The Coyote Library is required to run this program.

This program set can be purchased from the Coyote Store.

Class description for ActiveContour

Inheritance

Properties

Properties in ActiveContour

SCALE get
DELTA_MIN get set init
DRAW_CREATE get
MU get set init
GVF_ITERATIONS get set init
DELTA_MAX get set init
X get set
Y get set
GRADIENTSCALE get set init
MIN_VALUE get set init
BLUR get set init
KAPPA get set init
GAMMA get set init
SPATIAL_SCALE get set init
DRAWID get set init
MAX_VALUE get set init
PALETTE get set init
ALPHA get set init
NOTIFY_EVENT get set init
COLOR get set init
SIGMA get set init
DISPLAY_IMAGE init
IMAGE get set
ITERATIONS get set init
BETA get set init
ROI get

Fields

Fields in IDL_OBJECT

Fields in ActiveContour

DEMO_VERSION 0L
APPLYID 0L
YSNAKE_F ptr_new()
XSIZE 0L
DRAW_CREATE 0L
MU 0.000000
SIGMAOBJ obj_new()
GVF_ITERATIONS 0L
YSIZE 0L
FORCEWID 0L
MUOBJ obj_new()
DMINOBJ obj_new()
U ptr_new()
V ptr_new()
ORIGINAL ptr_new()
GRADIENTWID 0L
GRADIENTSCALE 0.000000
EDGEMAP ptr_new()
XSNAKE_F ptr_new()
DRAW_EVENTS intarr(6)
SELECTMAP 0L
TLB_YOFFSET 0L
GAUSSON 0L
BLUR 0L
KAPPA 0.000000
GAMMA 0.000000
NPTS 0L
VALUEID 0L
SPATIAL_SCALE [0.00000000D, 0.00000000D]
GVFITEROBJ obj_new()
MIN_V 0.000000
WID 0L
XRANGE [0.000000, 0.000000]
XSNAKE ptr_new()
GAUSSOFF 0L
DRAW_EH_FUNC ''
BETAOBJ obj_new()
PERIMETERID 0L
DMIN 0.000000
KAPPAOBJ obj_new()
INITIALROI 0B
DRAWID 0L
TLB_XOFFSET 0L
PIXMAP 0L
PALETTE bytarr(256, 3)
FX ptr_new()
ALPHA 0.000000
FY ptr_new()
UNDOID 0L
YRANGE [0.000000, 0.000000]
YSNAKE ptr_new()
NOTIFY_EVENT ''
DMAX 0.000000
DRAW_UVALUE ptr_new()
ITEROBJ obj_new()
ROISAVEID 0L
COLOR ''
SIGMA 0.000000
CONTROL_TLB 0L
GAMMAOBJ obj_new()
IMAGE ptr_new()
ITERATIONS 0L
DRAW_EH_PRO ''
MAX_V 0.000000
AREAID 0L
DMAXOBJ obj_new()
BETA 0.000000
ROI obj_new()
ALPHAOBJ obj_new()
UNDO ptr_new()
GSCALEOBJ obj_new()

Author information

Author

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright

Copyright (c) 2003-2013, Fanning Software Consulting, Inc.

History

Modification History:

Written by David W. Fanning, 1 December 2003. Removed the Coyote Library from the ActiveContour distribution. 15 June 2005. Extensive updates for the latest Coyote Library routines and to make the program easier to use. 24 Oct 2011. DWF. When an initial ROI was being specified (via X and Y parameters to INIT method), the ROI was not being drawn properly. Fixed. Now assume initial ROI values are in image pixel coordinates. 13 October 2013. DWF.

Routines

ActiveContour::ArcSample, x_in, y_in [, x_out] [, y_out] [, PHASE=float] [, POINTS=integer]

This procedure takes a closed curve in X and Y and re-samples it in equal arc lengths.

result = ActiveContour::ApplyGVFSnake( [/Cancel] [, /NOBLINK])

This function runs the GVF Active Contour code to completion.

ActiveContour::ClearWindow

This procedure clears the display window and gets it ready for drawing a contour.

ActiveContour::Contrast_Stretch, info

This procedure receives stretch information from cgStretch when the image changes or is stretched.

ActiveContour::Controls

This procedure displays the active contour control panel.

ActiveContour::DestroyControls

This procedure destroys the active contour control panel.

ActiveContour::Draw_Widget_Events, event

This event handler handles all events from the draw widget.

ActiveContour::Edgemap

This method calculates the edgemap for the object image.

ActiveContour::Event_Handler, event

This event handler is the main event handler for the program.

result = ActiveContour::GaussianBlur(image [, Scale=float])

This function applies a Gaussian filter function to the image.

ActiveContour::GetProperty [, ALPHA=float] [, BETA=float] [, /BLUR] [, COLOR=string] [, DELTA_MAX=float] [, DELTA_MIN=float], DRAW_CREATE=DRAW_CREATE [, DRAWID=long] [, NOTIFY_EVENT=string] [, GAMMA=float], IMAGE=IMAGE [, ITERATIONS=integer] [, KAPPA=float] [, GRADIENTSCALE=float] [, GVF_ITERATIONS=integer] [, MAX_VALUE=varies] [, MIN_VALUE=varies] [, MU=float] [, PALETTE=byte] [, ROI=float] [, SCALE=float] [, SIGMA=float] [, SPATIAL_SCALE=double] [, X=float] [, Y=float]

This method allows the user to get various properties of the object.

result = ActiveContour::Gradient(image [, direction])

This function calculates and returns the gradient of an image.

result = ActiveContour::Laplacian(image)

This function applies and returns the Laplacian filtered image.

ActiveContour::ResetDisplay

This procedure resets the display window to its original condition.

ActiveContour::SendEvent [, DATA=varies] [, TYPE=string]

This procedure sends an event to the specified event handler.

ActiveContour::SetDisplay

This procedure sets up the display window to respond to active contour events.

ActiveContour::SetProperty [, ALPHA=float] [, BETA=float] [, /BLUR] [, COLOR=string] [, DELTA_MAX=float] [, DELTA_MIN=float] [, DRAWID=long] [, NOTIFY_EVENT=string] [, GAMMA=float] [, IMAGE=IMAGE] [, ITERATIONS=integer] [, KAPPA=float] [, GRADIENTSCALE=float] [, GVF_ITERATIONS=integer] [, MAX_VALUE=varies] [, MIN_VALUE=varies] [, MU=float] [, PALETTE=byte] [, SIGMA=float] [, SPATIAL_SCALE=double] [, X=float] [, Y=float]

This method allows the user to set various properties of the object.

result = ActiveContour::SnakeDeform(x, y)

This function deforms the snake according to the pressures applied by the parameters.

result = ActiveContour::SnakeInterpolate(pts)

This function interpolates the snake adaptively.

ActiveContour::Threshold, min_t, max_t

This methods updates the thresholded image.

ActiveContour::UpdateImage

This methods updates the image on the display

ActiveContour::UpdateParameters

This methods reads the parameters from the controls panel, if there is one.

ActiveContour::CLEANUP

This is the clean-up routine for the object.

result = ActiveContour::INIT( [image] [, x] [, y] [, ALPHA=float] [, BETA=float] [, /BLUR] [, COLOR=string] [, DELTA_MAX=float] [, DELTA_MIN=float], DISPLAY_IMAGE=DISPLAY_IMAGE [, DRAWID=long] [, GAMMA=float] [, GRADIENTSCALE=float] [, GVF_ITERATIONS=integer] [, ITERATIONS=integer] [, KAPPA=float] [, MAX_VALUE=varies] [, MIN_VALUE=varies] [, NOTIFY_EVENT=string] [, MU=float] [, PALETTE=byte] [, SIGMA=float] [, SPATIAL_SCALE=double])

This program allows the user to experiment with a Gradient Vector Flow active contour algorithm, as described by Chenyang Xu and Jerry L.

ActiveContour_ControlsCleanup, controlTLB

When the Controls TLB dies, we come here to clean up.

ActiveContour_WidgetEvents, event

All widget events come through here first, where they are routed to the appropriate event handler method.

ActiveContour__Define [, class]

This is the class definition module.

Routine details

top ActiveContour::ArcSample

ActiveContour::ArcSample, x_in, y_in [, x_out] [, y_out] [, PHASE=float] [, POINTS=integer]

This procedure takes a closed curve in X and Y and re-samples it in equal arc lengths. The purpose is to have a curve with approximately equally-spaced intervals along its length. This is essential for getting a good fit with the ActiveContour algorithm.

Parameters

x_in in required type=vector

The X locations of the input curve.

y_in in required type=vector

The Y locations of the input curve.

x_out out optional type=vector

The X locations of the output curve.

y_out out optional type=vector

The Y locations of the output curve.

Keywords

PHASE in optional type=float default=0.0

A parameter that takes the phase of the curve into account. Its value should be between 0.0 and 1.0 and is confined to be so.

POINTS in optional type=integer default=50

The number of points in the output curve.

top ActiveContour::ApplyGVFSnake

result = ActiveContour::ApplyGVFSnake( [/Cancel] [, /NOBLINK])

This function runs the GVF Active Contour code to completion.

Return value

Returns a structure containing the active contour results. A value is only returned if the program is not running in demo mode:

retValue = {NPTS:N_Elements(x), X:x, Y:y, $ PERIMETER:perimeter, AREA:area, $ VALUES:(*self.original)[Round(x),Round(y)]}

Keywords

Cancel out optional type=boolean default=0

On exit, this value will be set to 1 if the user cancelled the active contour operation.

Normally, the final contour is blinked with the starting contour as an indication the active contouring is completed. Setting this keyword will inhibit this blinking operation.

top ActiveContour::ClearWindow

ActiveContour::ClearWindow

This procedure clears the display window and gets it ready for drawing a contour.

top ActiveContour::Contrast_Stretch

ActiveContour::Contrast_Stretch, info

This procedure receives stretch information from cgStretch when the image changes or is stretched. The image and stretch parameters are updated in the object.

Parameters

info in required type=structure

The info structure returned from cgStretch when the image is stretched there.

top ActiveContour::Controls

ActiveContour::Controls

This procedure displays the active contour control panel.

top ActiveContour::DestroyControls

ActiveContour::DestroyControls

This procedure destroys the active contour control panel.

top ActiveContour::Draw_Widget_Events

ActiveContour::Draw_Widget_Events, event

This event handler handles all events from the draw widget.

Parameters

event in required type=structure

The event structure passed by the window manager to this program when called. The events handled here are passed to the program from the draw widget.

top ActiveContour::Edgemap

ActiveContour::Edgemap

This method calculates the edgemap for the object image. The edgemap is stored in the pointer self.edgemap.

top ActiveContour::Event_Handler

ActiveContour::Event_Handler, event

This event handler is the main event handler for the program. It handles everything but draw widget events.

Parameters

event in required type=structure

The event structure passed by the window manager to this program when called.

top ActiveContour::GaussianBlur

result = ActiveContour::GaussianBlur(image [, Scale=float])

This function applies a Gaussian filter function to the image.

Return value

Returns a blurred image.

Parameters

image in required

The image to be blurred.

Keywords

Scale in optional type=float default=1.0

A scale factor that is multiplied to the Gaussian mask.

top ActiveContour::GetProperty

ActiveContour::GetProperty [, ALPHA=float] [, BETA=float] [, /BLUR] [, COLOR=string] [, DELTA_MAX=float] [, DELTA_MIN=float], DRAW_CREATE=DRAW_CREATE [, DRAWID=long] [, NOTIFY_EVENT=string] [, GAMMA=float], IMAGE=IMAGE [, ITERATIONS=integer] [, KAPPA=float] [, GRADIENTSCALE=float] [, GVF_ITERATIONS=integer] [, MAX_VALUE=varies] [, MIN_VALUE=varies] [, MU=float] [, PALETTE=byte] [, ROI=float] [, SCALE=float] [, SIGMA=float] [, SPATIAL_SCALE=double] [, X=float] [, Y=float]

This method allows the user to get various properties of the object. In general, the same keywords that are used for the INIT method can be used here.

Keywords

ALPHA out optional type=float default=0.10

The elasticity parameter of the active contour. It reflects the contour's ability to stretch along its length.

BETA out optional type=float default=0.25

The rigidity parameter of the active contour. It reflects the contour's ability to bend, as, for example, around corners.

BLUR out optional type=boolean default=1

Set this keyword to 1 if you want a Gaussian Blur applied to image before processing. Set it to 0 otherwise.

COLOR out optional type=string default=red

The name of a color for the snake. See the documentation for cgColor for a list of possible color names.

DELTA_MAX out optional type=float default=5.50

The maximum pixel distance for adaptive interpolation.

DELTA_MIN out optional type=float default=0.25

The minimum pixel distance for adaptive interpolation.

DRAW_CREATE
DRAWID out optional type=long

The draw widget identifier where the image is displayed. The image CANNOT be displayed in a normal IDL graphics window. The event handler for this draw widget will be changed for snake processing, and then returned to its original state when the Active Contour control panel is destroyed. If this parameter is not supplied or is invalid, the program will create its own display window.

NOTIFY_EVENT out optional type=string

The name of an event handler that should be called when users interact with the object.

GAMMA out optional type=float default=1.0

The viscosity parameter. Larger values make it harder to deform the active contour in space.

IMAGE
ITERATIONS out optional type=integer default=120

The number of iterations to use in calculating the snake positions.

KAPPA out optional type=float default=1.25

The external force weight.

GRADIENTSCALE out optional type=float default=1.75

A multiplication factor for the gradient calculations.

GVF_ITERATIONS out optional type=integer default=30

The number of iterations for calculating the Gradient Vector Flow (GVF).

MAX_VALUE out optional type=varies

The maximum value for scaling the image data for display.

MIN_VALUE out optional type=varies

The minimum value for scaling the image data for display.

MU out optional type=float default=0.10

The regularization parameter. This should be set according to the amount of noise in the image. Use a larger value for noisier images.

PALETTE out optional type=byte

A 256x3 byte array containing the color table vectors for display of the image.

ROI out optional type=float

The final contour, stored as an IDLanROI object. Not available in the demo version of the program.

SCALE out optional type=float default=1.0

Set this keyword to a scaling factor for the image. This keyword is set automatically according to the size of the input image, unless specified explicitly. Scaling only applies when the program creates it own image display window (i.e., the DRAWID keyword is not used).

SIGMA out optional type=float default=1.0

The standard deviation or sigma of the Gaussian function used in Gaussian blurring.

SPATIAL_SCALE out optional type=double default=1.0D

Set this keyword to a two-element array that specifies the pixel scale in the X and Y directions ([xscale, yscale]). The scale factors are applied when the perimeter and area calculations for the final contour is made. Default is [1.0D, 1.0D].

X out optional type=float

The X points of the current active contour or snake.

Y out optional type=float

The Y points of the current active contour or snake

top ActiveContour::Gradient

result = ActiveContour::Gradient(image [, direction])

This function calculates and returns the gradient of an image.

Return value

Returns the gradient image.

Parameters

image in required

The image for which the gradient is to be calculated.

direction in optional type=boolean default=0

The direction the gradient is to be applied. 0 indicates the X direction and 1 indicates the Y direction.

top ActiveContour::Laplacian

result = ActiveContour::Laplacian(image)

This function applies and returns the Laplacian filtered image.

Return value

Returns the Laplacian image.

Parameters

image in required

The image for which the Laplacian filter is to be applied.

top ActiveContour::ResetDisplay

ActiveContour::ResetDisplay

This procedure resets the display window to its original condition.

top ActiveContour::SendEvent

ActiveContour::SendEvent [, DATA=varies] [, TYPE=string]

This procedure sends an event to the specified event handler.

Keywords

DATA in optional type=varies

Set this keyword to an IDL variable that will be sent as the "data" along with the event.

TYPE in optional type=string default=POINTS_COLLECTED

The type of event to send.

top ActiveContour::SetDisplay

ActiveContour::SetDisplay

This procedure sets up the display window to respond to active contour events.

top ActiveContour::SetProperty

ActiveContour::SetProperty [, ALPHA=float] [, BETA=float] [, /BLUR] [, COLOR=string] [, DELTA_MAX=float] [, DELTA_MIN=float] [, DRAWID=long] [, NOTIFY_EVENT=string] [, GAMMA=float] [, IMAGE=IMAGE] [, ITERATIONS=integer] [, KAPPA=float] [, GRADIENTSCALE=float] [, GVF_ITERATIONS=integer] [, MAX_VALUE=varies] [, MIN_VALUE=varies] [, MU=float] [, PALETTE=byte] [, SIGMA=float] [, SPATIAL_SCALE=double] [, X=float] [, Y=float]

This method allows the user to set various properties of the object. In general, the same keywords that are used for the INIT method can be used here.

Keywords

ALPHA in optional type=float default=0.10

The elasticity parameter of the active contour. It reflects the contour's ability to stretch along its length.

BETA in optional type=float default=0.25

The rigidity parameter of the active contour. It reflects the contour's ability to bend, as, for example, around corners.

BLUR in optional type=boolean default=1

Set this keyword to 1 if you want a Gaussian Blur applied to image before processing. Set it to 0 otherwise.

COLOR in optional type=string default=red

The name of a color for the snake. See the documentation for cgColor for a list of possible color names.

DELTA_MAX in optional type=float default=5.50

The maximum pixel distance for adaptive interpolation.

DELTA_MIN in optional type=float default=0.25

The minimum pixel distance for adaptive interpolation.

DRAWID in optional type=long

The draw widget identifier where the image is displayed. The image CANNOT be displayed in a normal IDL graphics window. The event handler for this draw widget will be changed for snake processing, and then returned to its original state when the Active Contour control panel is destroyed. If this parameter is not supplied or is invalid, the program will create its own display window.

NOTIFY_EVENT in optional type=string

The name of an event handler that should be called when users interact with the object.

GAMMA in optional type=float default=1.0

The viscosity parameter. Larger values make it harder to deform the active contour in space.

IMAGE in optional

A 2D image array.

ITERATIONS in optional type=integer default=120

The number of iterations to use in calculating the snake positions.

KAPPA in optional type=float default=1.25

The external force weight.

GRADIENTSCALE in optional type=float default=1.75

A multiplication factor for the gradient calculations.

GVF_ITERATIONS in optional type=integer default=30

The number of iterations for calculating the Gradient Vector Flow (GVF).

MAX_VALUE in optional type=varies

The maximum value for scaling the image data for display.

MIN_VALUE in optional type=varies

The minimum value for scaling the image data for display.

MU in optional type=float default=0.10

The regularization parameter. This should be set according to the amount of noise in the image. Use a larger value for noisier images.

PALETTE in optional type=byte

A 256x3 byte array containing the color table vectors for display of the image.

SIGMA in optional type=float default=1.0

The standard deviation or sigma of the Gaussian function used in Gaussian blurring.

SPATIAL_SCALE in optional type=double default=1.0D

Set this keyword to a two-element array that specifies the pixel scale in the X and Y directions ([xscale, yscale]). The scale factors are applied when the perimeter and area calculations for the final contour is made. Default is [1.0D, 1.0D].

X in optional type=float

The initial X points of the active contour or snake. Optional. Must be used with Y.

Y in optional type=float

The initial Y points of the active contour or snake. Optional. Must be used with X.

top ActiveContour::SnakeDeform

result = ActiveContour::SnakeDeform(x, y)

This function deforms the snake according to the pressures applied by the parameters. The method was adapted for IDL from Xu and Prince's MatLab program for Active Contouring, available on their web page: http://iacl.ece.jhu.edu/projects/gvf/.

Return value

Returns an [n,2] array of deformed data points.

Parameters

x in required type=float

The X points of the current snake.

y in required type=float

The Y points of the current snake.

top ActiveContour::SnakeInterpolate

result = ActiveContour::SnakeInterpolate(pts)

This function interpolates the snake adaptively. If the distance between two adjacent points is greater than self.dmax, then a point is inserted between them. If the distance between two adjacent points is less than self.dmin, then either point i or point i+1 is removed.

Return value

Returns an [n,2] array of interpolated data points.

Parameters

pts in required type=float

An [n,2] array containing the current active contour points.

top ActiveContour::Threshold

ActiveContour::Threshold, min_t, max_t

This methods updates the thresholded image.

Parameters

min_t in required type=float

The minimum threshold value.

max_t in required type=float

The maximum threshold value.

top ActiveContour::UpdateImage

ActiveContour::UpdateImage

This methods updates the image on the display

top ActiveContour::UpdateParameters

ActiveContour::UpdateParameters

This methods reads the parameters from the controls panel, if there is one.

top ActiveContour::CLEANUP

ActiveContour::CLEANUP

This is the clean-up routine for the object. Anything that may leak memory is cleaned up or destroyed here.

top ActiveContour::INIT

result = ActiveContour::INIT( [image] [, x] [, y] [, ALPHA=float] [, BETA=float] [, /BLUR] [, COLOR=string] [, DELTA_MAX=float] [, DELTA_MIN=float], DISPLAY_IMAGE=DISPLAY_IMAGE [, DRAWID=long] [, GAMMA=float] [, GRADIENTSCALE=float] [, GVF_ITERATIONS=integer] [, ITERATIONS=integer] [, KAPPA=float] [, MAX_VALUE=varies] [, MIN_VALUE=varies] [, NOTIFY_EVENT=string] [, MU=float] [, PALETTE=byte] [, SIGMA=float] [, SPATIAL_SCALE=double])

This program allows the user to experiment with a Gradient Vector Flow active contour algorithm, as described by Chenyang Xu and Jerry L. Prince in "Snakes, Shapes, and Gradient Vector Flow" in the March 1998 IEEE Transactions on Image Processing, Vol. 7, No.3. Additional information, including references to research papers, is available via Cheyang Xu's web page: http://iacl.ece.jhu.edu/projects/gvf/.

Parameters

image in optional

The image for which the active contour (snake) will be applied. This argument must be 2D. The user will be asked to select an image file if this argument is not provided.

x in optional type=float

The initial X points of the active contour or snake. Optional. Must be used with Y. Assume values are pixel locations within image.

y in optional type=float

The initial Y points of the active contour or snake. Optional. Must be used with X. Assume values are pixel locations within image.

Keywords

ALPHA in optional type=float default=0.10

The elasticity parameter of the active contour. It reflects the contour's ability to stretch along its length.

BETA in optional type=float default=0.25

The rigidity parameter of the active contour. It reflects the contour's ability to bend, as, for example, around corners.

BLUR in optional type=boolean default=1

Set this keyword to 1 if you want a Gaussian Blur applied to image before processing. Set it to 0 otherwise.

COLOR in optional type=string default=red

The name of a color for the snake. See the documentation for cgColor for a list of possible color names.

DELTA_MAX in optional type=float default=5.50

The maximum pixel distance for adaptive interpolation.

DELTA_MIN in optional type=float default=0.25

The minimum pixel distance for adaptive interpolation.

DISPLAY_IMAGE
DRAWID in optional type=long

The draw widget identifier where the image is displayed. The image CANNOT be displayed in a normal IDL graphics window. The event handler for this draw widget will be changed for snake processing, and then returned to its original state when the Active Contour control panel is destroyed. If this parameter is not supplied or is invalid, the program will create its own display window.

GAMMA in optional type=float default=1.0

The viscosity parameter. Larger values make it harder to deform the active contour in space.

GRADIENTSCALE in optional type=float default=1.75

A multiplication factor for the gradient calculations.

GVF_ITERATIONS in optional type=integer default=30

The number of iterations for calculating the Gradient Vector Flow (GVF).

ITERATIONS in optional type=integer default=120

The number of iterations to use in calculating the snake positions.

KAPPA in optional type=float default=1.25

The external force weight.

MAX_VALUE in optional type=varies

The maximum value for scaling the image data for display.

MIN_VALUE in optional type=varies

The minimum value for scaling the image data for display.

NOTIFY_EVENT in optional type=string

The name of an event handler that should be called when users interact with the object. Events are sent when the initial contour points are selected, and when the active contour controls are destroyed. The event structure is an anonymous structure defined like this:

event = {ID: 0L, TOP: 0L, HANDLER: 0L, TYPE: "", DATA: roiStruct)

Where ID is the identifier of the draw widget where the initial contour is drawn, TOP is the widget at the top of that draw widget's hierarchy, HANDLER is filled out by the window manager, TYPE is set to "POINTS_COLLECTED", "CONTROLS_KILLED" or "ROI_COMPLETED" to indicate the type of event. DATA is only available if the TYPE is ROI_COMPLETED. DATA will be a structure that is identical to the structure returned from the ApplyGVFSnake method:

roiStruct = { NPTS:N_Elements(x), X:x, Y:x, $ PERIMETER:perimeter, AREA:area, $ VALUES:(*self.original)[x,y]}

The X and Y fields are set to the floating point pixel locations of the ROI in the image device coordinate system. The perimeter and area are given in terms of the total pixels inside the ROI, multiplyed by the SPATIAL_SCALE factors. The VALUES field contains the original image values at the locations specified in X and Y. NPTS, of course, contains the number of points in the ROI.

MU in optional type=float default=0.10

The regularization parameter. This should be set according to the amount of noise in the image. Use a larger value for noisier images.

PALETTE in optional type=byte

A 256x3 byte array containing the color table vectors for display of the image.

SIGMA in optional type=float default=1.0

The standard deviation or sigma of the Gaussian function used in Gaussian blurring.

SPATIAL_SCALE in optional type=double default=1.0D

Set this keyword to a two-element array that specifies the pixel scale in the X and Y directions ([xscale, yscale]). The scale factors are applied when the perimeter and area calculations for the final contour is made. Default is [1.0D, 1.0D].

top ActiveContour_ControlsCleanup

ActiveContour_ControlsCleanup, controlTLB

When the Controls TLB dies, we come here to clean up. If we created the image display window, then we should destroy ourselves, since all windows have now disappeared.

Parameters

controlTLB in required

The widget identifier of the top-level base that just died.

top ActiveContour_WidgetEvents

ActiveContour_WidgetEvents, event

All widget events come through here first, where they are routed to the appropriate event handler method.

Parameters

event

top ActiveContour__Define

ActiveContour__Define [, class]

This is the class definition module. Structures used to manipulate map projectatum information are also created here.

Parameters

class out optional type=structure

Occasionally, it is useful to have an object class definition as a structure variable. Using this output keyword will allow that.

File attributes

Modification date: Fri Oct 25 18:08:42 2013
Lines: 2,933
Docformat: rst rst