Hi John<div><br></div><div>It all comes down to see if this same code is being compiled in Debug mode (very slow) or in Release mode (much faster)</div><div>The setting of release/debug is compiler/IDE dependant. You have to select one or another. Probably, you are compiling by default in Debug mode.</div>
<div><br></div><div>1 hour doing a complex task is not strange when using Debug Code on 3D images if they are big enough. Check your compiler settings to see how to switch to release mode and rerun the example.</div><div>
<br></div><div>Regards</div><div><br><div class="gmail_quote">On Tue, Apr 12, 2011 at 1:17 PM, john smith <span dir="ltr"><<a href="mailto:mkitkinsightuser@gmail.com">mkitkinsightuser@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Here is the code for "GeodesicActiveContourImageFilter". It is quite similar with the "ShapeDetectionLevelSetFilter". I took it drom the software guide for itk, but I use it for 3D image.<br>
<br>////////// code /////////////////<br>
/*=========================================================================<br><br> Program: Insight Segmentation & Registration Toolkit<br> Module: $RCSfile: GeodesicActiveContourImageFilter.cxx,v $<br> Language: C++<br>
Date: $Date: 2009-03-17 21:44:42 $<br> Version: $Revision: 1.45 $<br><br> Copyright (c) Insight Software Consortium. All rights reserved.<br> See ITKCopyright.txt or <a href="http://www.itk.org/HTML/Copyright.htm" target="_blank">http://www.itk.org/HTML/Copyright.htm</a> for details.<br>
<br> This software is distributed WITHOUT ANY WARRANTY; without even <br> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR <br> PURPOSE. See the above copyright notices for more information.<br>
<br> =========================================================================*/<br>#if defined(_MSC_VER)<br>#pragma warning ( disable : 4786 )<br>#endif<br><br>#ifdef __BORLANDC__<br>#define ITK_LEAN_AND_MEAN<br>#endif<br>
<br>// Software Guide : BeginCommandLineArgs<br>// INPUTS: {BrainProtonDensitySlice.png}<br>// OUTPUTS: {GeodesicActiveContourImageFilterOutput5.png}<br>// 81 114 5 1.0 -0.5 3.0 2<br>// Software Guide : EndCommandLineArgs<br>
// Software Guide : BeginCommandLineArgs<br>// INPUTS: {BrainProtonDensitySlice.png}<br>// OUTPUTS: {GeodesicActiveContourImageFilterOutput6.png}<br>// 99 114 5 1.0 -0.5 3.0 2<br>// Software Guide : EndCommandLineArgs<br>
// Software Guide : BeginCommandLineArgs<br>// INPUTS: {BrainProtonDensitySlice.png}<br>// OUTPUTS: {GeodesicActiveContourImageFilterOutput8.png}<br>// 40 90 5 0.5 -0.3 2.0 10<br>// Software Guide : EndCommandLineArgs<br>
// Software Guide : BeginCommandLineArgs<br>// INPUTS: {BrainProtonDensitySlice.png}<br>// OUTPUTS: {GeodesicActiveContourImageFilterOutput7.png}<br>// OUTPUTS: [GeodesicActiveContourImageFilterOutput1.png]<br>
// OUTPUTS: [GeodesicActiveContourImageFilterOutput2.png]<br>
// OUTPUTS: [GeodesicActiveContourImageFilterOutput3.png]<br>// 56 92 5 1.0 -0.3 2.0 10<br>// Software Guide : EndCommandLineArgs<br><br>// Software Guide : BeginLatex<br>//<br>// The use of the \doxygen{GeodesicActiveContourLevelSetImageFilter} is<br>
// illustrated in the following example. The implementation of this filter in<br>// ITK is based on the paper by Caselles \cite{Caselles1997}. This<br>// implementation extends the functionality of the<br>// \doxygen{ShapeDetectionLevelSetImageFilter} by the addition of a third<br>
// advection term which attracts the level set to the object boundaries.<br>//<br>// GeodesicActiveContourLevelSetImageFilter expects two inputs. The first is<br>// an initial level set in the form of an \doxygen{Image}. The second input<br>
// is a feature image. For this algorithm, the feature image is an edge<br>// potential image that basically follows the same rules used for the<br>// ShapeDetectionLevelSetImageFilter discussed in<br>// Section~\ref{sec:ShapeDetectionLevelSetFilter}. The configuration of this<br>
// example is quite similar to the example on the use of the<br>// ShapeDetectionLevelSetImageFilter. We omit most of the redundant<br>// description. A look at the code will reveal the great degree of similarity<br>// between both examples.<br>
//<br>// \begin{figure} \center<br>// \includegraphics[width=\textwidth]{GeodesicActiveContoursCollaborationDiagram1.eps}<br>// \itkcaption[GeodesicActiveContourLevelSetImageFilter collaboration<br>// diagram]{Collaboration diagram for the GeodesicActiveContourLevelSetImageFilter<br>
// applied to a segmentation task.}<br>// \label{fig:GeodesicActiveContoursCollaborationDiagram}<br>// \end{figure}<br>//<br>// Figure~\ref{fig:GeodesicActiveContoursCollaborationDiagram} shows the major<br>// components involved in the application of the<br>
// GeodesicActiveContourLevelSetImageFilter to a segmentation task.<br>// This pipeline is quite similar to the one used by the<br>// ShapeDetectionLevelSetImageFilter in<br>// section~\ref{sec:ShapeDetectionLevelSetFilter}.<br>
//<br>// The pipeline involves a first stage of smoothing using the<br>// \doxygen{CurvatureAnisotropicDiffusionImageFilter}. The smoothed image is<br>// passed as the input to the<br>// \doxygen{GradientMagnitudeRecursiveGaussianImageFilter} and then to the<br>
// \doxygen{SigmoidImageFilter} in order to produce the edge potential image.<br>// A set of user-provided seeds is passed to a<br>// \doxygen{FastMarchingImageFilter} in order to compute the distance map. A<br>// constant value is subtracted from this map in order to obtain a level set<br>
// in which the \emph{zero set} represents the initial contour. This level<br>// set is also passed as input to the<br>// GeodesicActiveContourLevelSetImageFilter.<br>// <br>// Finally, the level set generated by the<br>
// GeodesicActiveContourLevelSetImageFilter is passed to a<br>
// \doxygen{BinaryThresholdImageFilter} in order to produce a binary mask<br>// representing the segmented object.<br>//<br>// Let's start by including the headers of the main filters involved in the<br>// preprocessing. <br>
//<br>// Software Guide : EndLatex <br><br><br>// Software Guide : BeginCodeSnippet<br>#include "itkImage.h"<br>#include "itkGeodesicActiveContourLevelSetImageFilter.h"<br>// Software Guide : EndCodeSnippet<br>
<br><br>#include "itkCurvatureAnisotropicDiffusionImageFilter.h"<br>#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"<br>#include "itkSigmoidImageFilter.h"<br>#include "itkFastMarchingImageFilter.h"<br>
#include "itkRescaleIntensityImageFilter.h"<br>#include "itkBinaryThresholdImageFilter.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br><br><br>int main( int argc, char *argv[] )<br>
{<br> if( argc < 11 )<br> {<br> std::cerr << "Missing Parameters " << std::endl;<br> std::cerr << "Usage: " << argv[0];<br> std::cerr << " inputImage outputImage";<br>
std::cerr << " seedX seedY seedZ InitialDistance";<br> std::cerr << " Sigma SigmoidAlpha SigmoidBeta";<br> std::cerr << " PropagationScaling" << std::endl;<br>
return 1;<br> }<br><br><br> // Software Guide : BeginLatex<br> // <br> // We now define the image type using a particular pixel type and<br> // dimension. In this case the \code{float} type is used for the pixels<br>
// due to the requirements of the smoothing filter.<br> //<br> // Software Guide : EndLatex <br><br> // Software Guide : BeginCodeSnippet<br> typedef float InternalPixelType;<br> const unsigned int Dimension = 3;<br>
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<br> // Software Guide : EndCodeSnippet<br> <br><br> // The following lines instantiate the thresholding filter that will<br>
// process the final level set at the output of the<br> // GeodesicActiveContourLevelSetImageFilter.<br> //<br> typedef unsigned char OutputPixelType;<br> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br>
typedef itk::BinaryThresholdImageFilter< <br> InternalImageType, <br> OutputImageType > ThresholdingFilterType;<br> <br> ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();<br>
<br> thresholder->SetLowerThreshold( -1000.0 );<br> thresholder->SetUpperThreshold( 0.0 );<br><br> thresholder->SetOutsideValue( 0 );<br> thresholder->SetInsideValue( 255 );<br>
<br><br> // We instantiate reader and writer types in the following lines.<br> //<br> typedef itk::ImageFileReader< InternalImageType > ReaderType;<br> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br>
<br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br><br> reader->SetFileName( argv[1] );<br> writer->SetFileName( argv[2] );<br><br><br> // The RescaleIntensityImageFilter type is declared below. This filter will<br>
// renormalize image before sending them to writers.<br> //<br> typedef itk::RescaleIntensityImageFilter< <br> InternalImageType, <br> OutputImageType > CastFilterType;<br>
<br><br> // The \doxygen{CurvatureAnisotropicDiffusionImageFilter} type is<br> // instantiated using the internal image type. <br> //<br> typedef itk::CurvatureAnisotropicDiffusionImageFilter< <br> InternalImageType, <br>
InternalImageType > SmoothingFilterType;<br><br> SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();<br><br><br> // The types of the<br> // GradientMagnitudeRecursiveGaussianImageFilter and<br>
// SigmoidImageFilter are instantiated using the internal image<br> // type.<br> //<br> typedef itk::GradientMagnitudeRecursiveGaussianImageFilter< <br> InternalImageType, <br> InternalImageType > GradientFilterType;<br>
typedef itk::SigmoidImageFilter<<br> InternalImageType, <br> InternalImageType > SigmoidFilterType;<br><br> GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();<br>
<br> SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();<br><br><br> // The minimum and maximum values of the SigmoidImageFilter output<br> // are defined with the methods \code{SetOutputMinimum()} and<br>
// \code{SetOutputMaximum()}. In our case, we want these two values to be<br> // $0.0$ and $1.0$ respectively in order to get a nice speed image to feed<br> // the \code{FastMarchingImageFilter}. Additional details on the user of the<br>
// \doxygen{SigmoidImageFilter} are presented in<br> // section~\ref{sec:IntensityNonLinearMapping}.<br><br> sigmoid->SetOutputMinimum( 0.0 );<br> sigmoid->SetOutputMaximum( 1.0 );<br><br><br> // We declare now the type of the FastMarchingImageFilter that<br>
// will be used to generate the initial level set in the form of a distance<br> // map.<br> //<br> typedef itk::FastMarchingImageFilter< <br> InternalImageType, <br> InternalImageType > FastMarchingFilterType;<br>
<br><br> // Next we construct one filter of this class using the \code{New()}<br> // method.<br> //<br> FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();<br> <br> // Software Guide : BeginLatex<br>
// <br> // In the following lines we instantiate the type of the<br> // GeodesicActiveContourLevelSetImageFilter and create an object of this<br> // type using the \code{New()} method.<br> //<br> // Software Guide : EndLatex <br>
<br> // Software Guide : BeginCodeSnippet<br> typedef itk::GeodesicActiveContourLevelSetImageFilter< InternalImageType, <br> InternalImageType > GeodesicActiveContourFilterType;<br> GeodesicActiveContourFilterType::Pointer geodesicActiveContour = <br>
GeodesicActiveContourFilterType::New();<br> // Software Guide : EndCodeSnippet<br><br> <br> // Software Guide : BeginLatex<br> // <br> // For the GeodesicActiveContourLevelSetImageFilter, scaling parameters<br>
// are used to trade off between the propagation (inflation), the<br> // curvature (smoothing) and the advection terms. These parameters are set<br> // using methods \code{SetPropagationScaling()},<br> // \code{SetCurvatureScaling()} and \code{SetAdvectionScaling()}. In this<br>
// example, we will set the curvature and advection scales to one and let<br> // the propagation scale be a command-line argument.<br> //<br> // \index{itk::Geodesic\-Active\-Contour\-LevelSet\-Image\-Filter!SetPropagationScaling()}<br>
// \index{itk::Segmentation\-Level\-Set\-Image\-Filter!SetPropagationScaling()}<br> // \index{itk::Geodesic\-Active\-Contour\-LevelSet\-Image\-Filter!SetCurvatureScaling()}<br> // \index{itk::Segmentation\-Level\-Set\-Image\-Filter!SetCurvatureScaling()}<br>
// \index{itk::Geodesic\-Active\-Contour\-LevelSet\-Image\-Filter!SetAdvectionScaling()}<br> // \index{itk::Segmentation\-Level\-Set\-Image\-Filter!SetAdvectionScaling()}<br> //<br> // Software Guide : EndLatex <br>
<br> const double propagationScaling = atof( argv[10] );<br><br> // Software Guide : BeginCodeSnippet<br> geodesicActiveContour->SetPropagationScaling( propagationScaling );<br> geodesicActiveContour->SetCurvatureScaling( 1.0 );<br>
geodesicActiveContour->SetAdvectionScaling( 1.0 );<br> // Software Guide : EndCodeSnippet <br><br> // Once activiated the level set evolution will stop if the convergence<br> // criteria or if the maximum number of iterations is reached. The<br>
// convergence criteria is defined in terms of the root mean squared (RMS)<br> // change in the level set function. The evolution is said to have<br> // converged if the RMS change is below a user specified threshold. In a<br>
// real application is desirable to couple the evolution of the zero set<br> // to a visualization module allowing the user to follow the evolution of<br> // the zero set. With this feedback, the user may decide when to stop the<br>
// algorithm before the zero set leaks through the regions of low gradient<br> // in the contour of the anatomical structure to be segmented.<br><br> geodesicActiveContour->SetMaximumRMSError( 0.02 );<br> geodesicActiveContour->SetNumberOfIterations( 800 );<br>
<br><br> // Software Guide : BeginLatex<br> // <br> // The filters are now connected in a pipeline indicated in<br> // Figure~\ref{fig:GeodesicActiveContoursCollaborationDiagram} using the<br> // following lines:<br>
//<br> // Software Guide : EndLatex <br><br> // Software Guide : BeginCodeSnippet<br> smoothing->SetInput( reader->GetOutput() );<br> gradientMagnitude->SetInput( smoothing->GetOutput() );<br> sigmoid->SetInput( gradientMagnitude->GetOutput() );<br>
<br> geodesicActiveContour->SetInput( fastMarching->GetOutput() );<br> geodesicActiveContour->SetFeatureImage( sigmoid->GetOutput() );<br><br> thresholder->SetInput( geodesicActiveContour->GetOutput() );<br>
writer->SetInput( thresholder->GetOutput() );<br> // Software Guide : EndCodeSnippet<br><br><br> // The CurvatureAnisotropicDiffusionImageFilter requires a couple of<br> // parameter to be defined. The following are typical values for $2D$<br>
// images. However they may have to be adjusted depending on the amount of<br> // noise present in the input image. This filter has been discussed in<br> // section~\ref{sec:GradientAnisotropicDiffusionImageFilter}.<br>
<br> smoothing->SetTimeStep( 0.0625 );<br> smoothing->SetNumberOfIterations( 5 );<br> smoothing->SetConductanceParameter( 9.0 );<br><br><br> // The GradientMagnitudeRecursiveGaussianImageFilter performs the<br>
// equivalent of a convolution with a Gaussian kernel, followed by a<br> // derivative operator. The sigma of this Gaussian can be used to control<br> // the range of influence of the image edges. This filter has been discussed<br>
// in Section~\ref{sec:GradientMagnitudeRecursiveGaussianImageFilter}<br><br> const double sigma = atof( argv[7] );<br> gradientMagnitude->SetSigma( sigma );<br><br><br> // The SigmoidImageFilter requires two parameters that define the linear<br>
// transformation to be applied to the sigmoid argument. This parameters<br> // have been discussed in Sections~\ref{sec:IntensityNonLinearMapping} and<br> // \ref{sec:FastMarchingImageFilter}.<br><br> const double alpha = atof( argv[8] );<br>
const double beta = atof( argv[9] );<br><br> sigmoid->SetAlpha( alpha );<br> sigmoid->SetBeta( beta );<br> <br><br> // The FastMarchingImageFilter requires the user to provide a seed<br> // point from which the level set will be generated. The user can actually<br>
// pass not only one seed point but a set of them. Note the the<br> // FastMarchingImageFilter is used here only as a helper in the<br> // determination of an initial level set. We could have used the<br> // \doxygen{DanielssonDistanceMapImageFilter} in the same way.<br>
//<br> // The seeds are passed stored in a container. The type of this<br> // container is defined as \code{NodeContainer} among the<br> // FastMarchingImageFilter traits.<br> //<br> typedef FastMarchingFilterType::NodeContainer NodeContainer;<br>
typedef FastMarchingFilterType::NodeType NodeType;<br><br> NodeContainer::Pointer seeds = NodeContainer::New();<br><br> InternalImageType::IndexType seedPosition;<br> <br> seedPosition[0] = atoi( argv[3] );<br>
seedPosition[1] = atoi( argv[4] );<br> seedPosition[2] = atoi( argv[5] );<br><br> // Nodes are created as stack variables and initialized with a value and an<br> // \doxygen{Index} position. Note that here we assign the value of minus the<br>
// user-provided distance to the unique node of the seeds passed to the<br> // FastMarchingImageFilter. In this way, the value will increment<br> // as the front is propagated, until it reaches the zero value corresponding<br>
// to the contour. After this, the front will continue propagating until it<br> // fills up the entire image. The initial distance is taken here from the<br> // command line arguments. The rule of thumb for the user is to select this<br>
// value as the distance from the seed points at which she want the initial<br> // contour to be.<br> const double initialDistance = atof( argv[6] );<br><br> NodeType node;<br><br> const double seedValue = - initialDistance;<br>
<br> node.SetValue( seedValue );<br> node.SetIndex( seedPosition );<br><br><br> // The list of nodes is initialized and then every node is inserted using<br> // the \code{InsertElement()}.<br><br> seeds->Initialize();<br>
seeds->InsertElement( 0, node );<br><br><br> // The set of seed nodes is passed now to the<br> // FastMarchingImageFilter with the method<br> // \code{SetTrialPoints()}.<br> //<br> fastMarching->SetTrialPoints( seeds );<br>
<br><br> // Since the FastMarchingImageFilter is used here just as a<br> // Distance Map generator. It does not require a speed image as input.<br> // Instead the constant value $1.0$ is passed using the<br> // \code{SetSpeedConstant()} method.<br>
//<br> fastMarching->SetSpeedConstant( 1.0 );<br><br><br> // Here we configure all the writers required to see the intermediate<br> // outputs of the pipeline. This is added here only for<br> // pedagogical/debugging purposes. These intermediate output are normaly not<br>
// required. Only the output of the final thresholding filter should be<br> // relevant. Observing intermediate output is helpful in the process of<br> // fine tuning the parameters of filters in the pipeline. <br>
//<br> CastFilterType::Pointer caster1 = CastFilterType::New();<br> CastFilterType::Pointer caster2 = CastFilterType::New();<br> CastFilterType::Pointer caster3 = CastFilterType::New();<br> CastFilterType::Pointer caster4 = CastFilterType::New();<br>
<br> WriterType::Pointer writer1 = WriterType::New();<br> WriterType::Pointer writer2 = WriterType::New();<br> WriterType::Pointer writer3 = WriterType::New();<br> WriterType::Pointer writer4 = WriterType::New();<br>
<br>
caster1->SetInput( smoothing->GetOutput() );<br> writer1->SetInput( caster1->GetOutput() );<br> writer1->SetFileName("GeodesicActiveContourImageFilterOutput1.hdr");<br> caster1->SetOutputMinimum( 0 );<br>
caster1->SetOutputMaximum( 255 );<br> writer1->Update();<br><br> caster2->SetInput( gradientMagnitude->GetOutput() );<br> writer2->SetInput( caster2->GetOutput() );<br> writer2->SetFileName("GeodesicActiveContourImageFilterOutput2.hdr");<br>
caster2->SetOutputMinimum( 0 );<br> caster2->SetOutputMaximum( 255 );<br> writer2->Update();<br><br> caster3->SetInput( sigmoid->GetOutput() );<br> writer3->SetInput( caster3->GetOutput() );<br>
writer3->SetFileName("GeodesicActiveContourImageFilterOutput3.hdr");<br> caster3->SetOutputMinimum( 0 );<br> caster3->SetOutputMaximum( 255 );<br> writer3->Update();<br><br> caster4->SetInput( fastMarching->GetOutput() );<br>
writer4->SetInput( caster4->GetOutput() );<br> writer4->SetFileName("GeodesicActiveContourImageFilterOutput4.hdr");<br> caster4->SetOutputMinimum( 0 );<br> caster4->SetOutputMaximum( 255 );<br>
<br><br> // The FastMarchingImageFilter requires the user to specify the<br> // size of the image to be produced as output. This is done using the<br> // \code{SetOutputSize()}. Note that the size is obtained here from the<br>
// output image of the smoothing filter. The size of this image is valid<br> // only after the \code{Update()} methods of this filter has been called<br> // directly or indirectly.<br> //<br> fastMarching->SetOutputSize( <br>
reader->GetOutput()->GetBufferedRegion().GetSize() );<br><br> <br> // Software Guide : BeginLatex<br> // <br> // The invocation of the \code{Update()} method on the writer triggers the<br> // execution of the pipeline. As usual, the call is placed in a<br>
// \code{try/catch} block should any errors occur or exceptions be thrown.<br> //<br> // Software Guide : EndLatex <br><br> // Software Guide : BeginCodeSnippet<br> try<br> {<br> writer->Update();<br> }<br>
catch( itk::ExceptionObject & excep )<br> {<br> std::cerr << "Exception caught !" << std::endl;<br> std::cerr << excep << std::endl;<br> }<br> // Software Guide : EndCodeSnippet<br>
<br> // Print out some useful information <br> std::cout << std::endl;<br> std::cout << "Max. no. iterations: " << geodesicActiveContour->GetNumberOfIterations() << std::endl;<br> std::cout << "Max. RMS error: " << geodesicActiveContour->GetMaximumRMSError() << std::endl;<br>
std::cout << std::endl;<br> std::cout << "No. elpased iterations: " << geodesicActiveContour->GetElapsedIterations() << std::endl;<br> std::cout << "RMS change: " << geodesicActiveContour->GetRMSChange() << std::endl;<br>
<br> writer4->Update();<br><br><br> // The following writer type is used to save the output of the time-crossing<br> // map in a file with apropiate pixel representation. The advantage of saving<br> // this image in native format is that it can be used with a viewer to help<br>
// determine an appropriate threshold to be used on the output of the<br> // fastmarching filter.<br> //<br> // typedef itk::ImageFileWriter< InternalImageType > InternalWriterType;<br><br> // InternalWriterType::Pointer mapWriter = InternalWriterType::New();<br>
// mapWriter->SetInput( fastMarching->GetOutput() );<br> // mapWriter->SetFileName("GeodesicActiveContourImageFilterOutput4.mha");<br> // mapWriter->Update();<br><br> // InternalWriterType::Pointer speedWriter = InternalWriterType::New();<br>
// speedWriter->SetInput( sigmoid->GetOutput() );<br> // speedWriter->SetFileName("GeodesicActiveContourImageFilterOutput3.mha");<br> // speedWriter->Update();<br><br> // InternalWriterType::Pointer gradientWriter = InternalWriterType::New();<br>
// gradientWriter->SetInput( gradientMagnitude->GetOutput() );<br> // gradientWriter->SetFileName("GeodesicActiveContourImageFilterOutput2.mha");<br>// gradientWriter->Update();<br><br><br> // Software Guide : BeginLatex<br>
//<br> // Let's now run this example using as input the image<br> // \code{BrainProtonDensitySlice.png} provided in the directory<br> // \code{Examples/Data}. We can easily segment the major anatomical<br> // structures by providing seeds in the appropriate locations.<br>
// Table~\ref{tab:GeodesicActiveContourImageFilterOutput2} presents the<br> // parameters used for some structures.<br> //<br> // \begin{table}<br> // \begin{center}<br> // \begin{tabular}{|l|c|c|c|c|c|c|c|c|}<br>
// \hline<br> // Structure & Seed Index & Distance & $\sigma$ &<br> // $\alpha$ & $\beta$ & Propag. & Output Image \\ \hline <br> // Left Ventricle & $(81,114)$ & 5.0 & 1.0 & -0.5 & 3.0 & 2.0 & First \\ \hline<br>
// Right Ventricle & $(99,114)$ & 5.0 & 1.0 & -0.5 & 3.0 & 2.0 & Second \\ \hline<br> // White matter & $(56, 92)$ & 5.0 & 1.0 & -0.3 & 2.0 & 10.0 & Third \\ \hline<br>
// Gray matter & $(40, 90)$ & 5.0 & 0.5 & -0.3 & 2.0 & 10.0 & Fourth \\ \hline<br> // \end{tabular}<br> // \end{center}<br> // \itkcaption[GeodesicActiveContour segmentation example parameters]{Parameters used<br>
// for segmenting some brain structures shown in<br> // Figure~\ref{fig:GeodesicActiveContourImageFilterOutput2} using the filter<br> // GeodesicActiveContourLevelSetImageFilter. <br> // \label{tab:GeodesicActiveContourImageFilterOutput2}}<br>
// \end{table}<br> //<br> // Figure~\ref{fig:GeodesicActiveContourImageFilterOutput} presents the<br> // intermediate outputs of the pipeline illustrated in<br> // Figure~\ref{fig:GeodesicActiveContoursCollaborationDiagram}. They are<br>
// from left to right: the output of the anisotropic diffusion filter, the<br> // gradient magnitude of the smoothed image and the sigmoid of the gradient<br> // magnitude which is finally used as the edge potential for the<br>
// GeodesicActiveContourLevelSetImageFilter.<br> //<br> // \begin{figure} \center<br> // \includegraphics[height=0.40\textheight]{BrainProtonDensitySlice.eps}<br> // \includegraphics[height=0.40\textheight]{GeodesicActiveContourImageFilterOutput1.eps}<br>
// \includegraphics[height=0.40\textheight]{GeodesicActiveContourImageFilterOutput2.eps}<br> // \includegraphics[height=0.40\textheight]{GeodesicActiveContourImageFilterOutput3.eps}<br> // \itkcaption[GeodesicActiveContourLevelSetImageFilter intermediate<br>
// output]{Images generated by the segmentation process based on the<br> // GeodesicActiveContourLevelSetImageFilter. From left to right and top to<br> // bottom: input image to be segmented, image smoothed with an<br>
// edge-preserving smoothing filter, gradient magnitude of the smoothed<br> // image, sigmoid of the gradient magnitude. This last image, the sigmoid, is<br> // used to compute the speed term for the front propagation.}<br>
// \label{fig:GeodesicActiveContourImageFilterOutput} \end{figure}<br> // <br> // Segmentations of the main brain structures are presented in<br> // Figure~\ref{fig:GeodesicActiveContourImageFilterOutput2}. The results<br>
// are quite similar to those obtained with the<br> // ShapeDetectionLevelSetImageFilter in<br> // Section~\ref{sec:ShapeDetectionLevelSetFilter}.<br> //<br> // Note that a relatively larger propagation scaling value was required to<br>
// segment the white matter. This is due to two factors: the lower<br> // contrast at the border of the white matter and the complex shape of the<br> // structure. Unfortunately the optimal value of these scaling parameters<br>
// can only be determined by experimentation. In a real application we<br> // could imagine an interactive mechanism by which a user supervises the<br> // contour evolution and adjusts these parameters accordingly.<br>
//<br> // \begin{figure} \center<br> // \includegraphics[width=0.24\textwidth]{GeodesicActiveContourImageFilterOutput5.eps}<br> // \includegraphics[width=0.24\textwidth]{GeodesicActiveContourImageFilterOutput6.eps}<br>
// \includegraphics[width=0.24\textwidth]{GeodesicActiveContourImageFilterOutput7.eps}<br> // \includegraphics[width=0.24\textwidth]{GeodesicActiveContourImageFilterOutput8.eps}<br> // \itkcaption[GeodesicActiveContourImageFilter segmentations]{Images generated by the<br>
// segmentation process based on the GeodesicActiveContourImageFilter.