Geodesic Active Contour Segmentation

What is the Purpose of this Application?
This application illustrates the application of the GeodesicActiveContour filter to a segmentation task. This filter implements a Level Set approach to segmentation. A contour is represented in the form of a zero set of a function. The function evolves and carries with it the zero set. Evolution of the function is controlled by a partial differential equation in which a speed term is involved. This speed is computed based on an image provided by the user. A typical speed image is produced by a mapping of the gradient magnitude of the original image. The mapping is selected in such a way that regions with high contrast will have low speeds while homogeneous regions will have high speed. In this application the mapping of the gradient magnitude is made with a sigmoid function. This is very convenient since the sigmoid offers four parameters that can be tuned in order to select the features of interest from the input image. The differential equation includes an additional term representing an inflation force. The strength of this force can be regulated in order to make the contour expand and eventually overcome small edges. In order to initialize the GeodesicActiveContour filter, an input level set is required. It is desirable for this initial contour to be relatively close to the final edges of the anatomical structure to be segmented. In this application, a FastMarchingImageFilter is used to produce a rough contour from a set of seeds. In order to initialize the FastMarching filter, the user selects a set of seed points in the viewer of the input image. The fast marching filter will propagate a front starting from the seeds and traveling at constant speed until the front reaches a user-specified distance. At that point the front is passed to the GeodesicActiveContour filter which will use the partial differential equation in order to continue the evolution of the contour. The GeodesicActiveContour filter also uses a speed computed from the speed image. This should result in the contour slowing down close to object edges. The final output of the filter is a level set in which the zero set represents the object borders. The number of iterations to run this filter is a critical parameter since too many iteration will always result in the contour leaking through the regions of low contrast of the anatomical object borders.

About the GUI
This application presents a workbench on which an image can be read and displayed. The gradient magnitude of the image is computed by the equivalent of convolving with derivatives of the gaussian. The user can select the value of sigma for this gaussian. Moderate values should be used, since large sigmas produce low ridges in the speed image increasing the risk of leaks for the contour when evolving. The user can invoke an interactive viewer on the input image, where he can click and select a set of seed points. The more seed points the better, since the front will propagate in parallel starting from all of them. The initial level set produced by the FastMarching filter can be visualized overlayed on top of the input image. This level set is the input to the GeodesicActiveContour filter. Visual feedback of the execution of the filters is managed by events sent from the Toolkit to the GUI. The GUI for this application uses FLTK which is an open source multi-platform toolkit for GUI development. It can be downloaded from

The image below shows the graphic interface of the application. The distribution of buttons on the GUI represent the internal connection of filters on the pipeline. Blue lines show the flow of image data through the pipeline. The green bar at the bottom displays the percent of progress for each filter as it runs.

Graphical User Interface
Graphic User Interface using FLTK

One slice of the images along the pipeline is shown below. From left to right, the input image, the input level set produced by the FastMarching filter, the image resulting from the sigmoid mapping, and finally the thresholded level set resulting from the GeodesicActiveContour. This binary image is overlayed in red color over the input image.

Graphical User Interface
Graphic User Interface using FLTK

Communications Between ITK and the GUI
Some of the components used in this GUI are available in the Insight/Auxiliary directory. In particular the fltk::LightButton and the fltk::ProgressBar. These components use the ITK mechanism of events based on the Observer/Command design pattern [2]. The basic elements for this mechanism are the ITK classes:

ITK filters invoke "Events" that can be "Observed" by "Command" classes. Typically, events are invoked when a filter is about to start, when the filter has just finished processing its data and when the output of the filter becomes invalid due to changes in the filter parameters. Sequential events are also invoked in order to indicate the filter's percent of progress. The buttons in this GUI change colors according to itk::StartEvent, itk::EndEvent and itk::ModifiedEvent events. The progress bar in the bottom reacts to the itk::ProgressEvent of the filter that is being currently executed.

What ITK Classes Made This Application Possible?
The ITK filters used to compute these images are the following:
[1] J. A. Sethian, "Level Set Methods and Fast Marching Methods", Cambridge University Press, 1996.

Go to next application.