<div>Hi,</div>  <div>&nbsp;</div>  <div>I am trying to register 2 3D labelled volumes, using ITK<FONT color=#008000 size=2></div>  <div>BSplineDeformableTransform , metric is set <FONT size=2></div>  <div>itkMatchCardinalityImageToImageMetric and <FONT size=2></div>  <div>itkLBFGSBOptimizer as it is recommended for registration of labelled volume...</div>  <div>&nbsp;</div>  <div>I set <FONT size=2>AffineTransform as bulkTransform in the code. </FONT></div>  <div><FONT size=2></FONT>&nbsp;</div>  <div><FONT size=2><FONT size=2>I have experimented with various on-image grid sizes of ( 8x8x8, 12x12x3 , 27x27x3 ). </FONT></FONT></div>  <div>&nbsp;</div>  <div>The border grid size was kept fixed.</div>  <div>&nbsp;</div>  <div>The results were exactly the same as using only affine transforms.</div>  <div>&nbsp;</div>  <div>Am I doing anything wrong? please advise</div>  <div>&nbsp;</div> 
 <div>*************************************************************************************************</div><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkImageRegistrationMethod.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkMattesMutualInformationImageToImageMetric.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkLinearInterpolateImageFunction.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkImage.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkTimeProbesCollectorBase.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkMatchCardinalityImageToImageMetric.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT
 size=2><FONT color=#000000> "itkNearestNeighborInterpolateImageFunction.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> &lt;conio.h&gt;</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkCenteredTransformInitializer.h"</FONT></div></FONT><FONT color=#0000ff size=2>  <div>#include</FONT><FONT size=2><FONT color=#000000> "itkAffineTransform.h"</FONT></div></FONT>  <div>&nbsp;</div>  <div>#include "itkBSplineDeformableTransform.h"<BR>#include "itkLBFGSBOptimizer.h"<BR>// Software Guide : EndCodeSnippet</div>  <div>//&nbsp; Software Guide : BeginLatex<BR>//&nbsp; <BR>//&nbsp; The parameter space of the \code{BSplineDeformableTransform} is composed by<BR>//&nbsp; the set of all the deformations associated with the nodes of the BSpline<BR>//&nbsp; grid.&nbsp; This large number of parameters makes possible to represent a wide<BR>//&nbsp; variety of deformations, but it
 also has the price of requiring a<BR>//&nbsp; significant amount of computation time.<BR>//<BR>//&nbsp; \index{itk::BSplineDeformableTransform!header}<BR>// <BR>//&nbsp; Software Guide : EndLatex </div>  <div>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"</div>  <div>#include "itkResampleImageFilter.h"<BR>#include "itkCastImageFilter.h"<BR>#include "itkSquaredDifferenceImageFilter.h"</div>  <div><BR>//&nbsp; The following section of code implements a Command observer<BR>//&nbsp; used to monitor the evolution of the registration process.<BR>//<BR>#include "itkCommand.h"<BR>class CommandIterationUpdate : public itk::Command <BR>{<BR>public:<BR>&nbsp; typedef&nbsp; CommandIterationUpdate&nbsp;&nbsp; Self;<BR>&nbsp; typedef&nbsp; itk::Command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Superclass;<BR>&nbsp; typedef itk::SmartPointer&lt;Self&gt;&nbsp; Pointer;<BR>&nbsp; itkNewMacro( Self );<BR>protected:<BR>&nbsp;
 CommandIterationUpdate() {};<BR>public:<BR>&nbsp; typedef itk::LBFGSBOptimizer&nbsp;&nbsp;&nbsp;&nbsp; OptimizerType;<BR>&nbsp; typedef&nbsp;&nbsp; const OptimizerType&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp; OptimizerPointer;</div>  <div>&nbsp; void Execute(itk::Object *caller, const itk::EventObject &amp; event)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Execute( (const itk::Object *)caller, event);<BR>&nbsp;&nbsp;&nbsp; }</div>  <div>&nbsp; void Execute(const itk::Object * object, const itk::EventObject &amp; event)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OptimizerPointer optimizer = <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dynamic_cast&lt; OptimizerPointer &gt;( object );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( typeid( event ) != typeid( itk::IterationEvent ) )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 std::cout &lt;&lt; optimizer-&gt;GetCurrentIteration() &lt;&lt; "&nbsp;&nbsp; ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; optimizer-&gt;GetValue() &lt;&lt; "&nbsp;&nbsp; ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; optimizer-&gt;GetInfinityNormOfProjectedGradient() &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; }<BR>};</div>  <div><BR>int main( int argc, char *argv[] )<BR>{<BR>&nbsp; if( EXEC_MODE )<BR>&nbsp; {<BR>&nbsp;if( argc &lt; 4 )<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;std::cerr &lt;&lt; "Missing Parameters " &lt;&lt; std::endl;<BR>&nbsp;&nbsp;std::cerr &lt;&lt; "Usage: " &lt;&lt; argv[0];<BR>&nbsp;&nbsp;std::cerr &lt;&lt; " fixedImageFile&nbsp; movingImageFile outputImagefile&nbsp; ";<BR>&nbsp;&nbsp;std::cerr &lt;&lt; " [differenceOutputfile] [differenceBeforeRegistration] ";<BR>&nbsp;&nbsp;std::cerr &lt;&lt; "[xy-size] [z-size] "; <BR>&nbsp;&nbsp;std::cerr &lt;&lt; " [deformationField] ";<BR>&nbsp;&nbsp;return 1;<BR>&nbsp;&nbsp;}<BR>&nbsp; }&nbsp;
 </div>  <div><BR>&nbsp; const&nbsp;&nbsp;&nbsp; unsigned int&nbsp;&nbsp;&nbsp; ImageDimension = 3;<BR>&nbsp; typedef&nbsp; unsigned char&nbsp;&nbsp; PixelType;</div>  <div>&nbsp; typedef itk::Image&lt; PixelType, ImageDimension &gt;&nbsp; FixedImageType;<BR>&nbsp; typedef itk::Image&lt; PixelType, ImageDimension &gt;&nbsp; MovingImageType;</div>  <div><BR>&nbsp; //&nbsp; Software Guide : BeginLatex<BR>&nbsp; //<BR>&nbsp; //&nbsp; We instantiate now the type of the \code{BSplineDeformableTransform} using<BR>&nbsp; //&nbsp; as template parameters the type for coordinates representation, the<BR>&nbsp; //&nbsp; dimension of the space, and the order of the BSpline. <BR>&nbsp; // <BR>&nbsp; //&nbsp; \index{BSplineDeformableTransform|New}<BR>&nbsp; //&nbsp; \index{BSplineDeformableTransform|Instantiation}<BR>&nbsp; //<BR>&nbsp; //&nbsp; Software Guide : EndLatex </div>  <div>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp; const unsigned int SpaceDimension =
 ImageDimension;<BR>&nbsp; const unsigned int SplineOrder = 3;<BR>&nbsp; typedef double CoordinateRepType;</div>  <div>&nbsp; typedef itk::BSplineDeformableTransform&lt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CoordinateRepType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SpaceDimension,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SplineOrder &gt;&nbsp;&nbsp;&nbsp;&nbsp; TransformType;</div>  <div>&nbsp; typedef itk::AffineTransform&lt;&nbsp;&nbsp; double,
 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageDimension&nbsp; &gt;&nbsp;&nbsp;&nbsp;&nbsp; BulkTransformType;</div>  <div>&nbsp; // Software Guide : EndCodeSnippet</div>  <div><BR>&nbsp; typedef itk::LBFGSBOptimizer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OptimizerType;</div>  <div><BR>&nbsp; /*<BR>&nbsp; typedef itk::MattesMutualInformationImageToImageMetric&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MovingImageType
 &gt;&nbsp;&nbsp;&nbsp; MetricType;<BR>&nbsp; */<BR>&nbsp; typedef itk::MatchCardinalityImageToImageMetric&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MovingImageType &gt;&nbsp;&nbsp;&nbsp; MetricType;<BR>&nbsp; <BR>&nbsp; /*<BR>&nbsp; typedef itk:: LinearInterpolateImageFunction&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 MovingImageType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&nbsp;&nbsp;&nbsp; InterpolatorType;<BR>&nbsp; */<BR>&nbsp; typedef itk::NearestNeighborInterpolateImageFunction&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MovingImageType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&nbsp;&nbsp;&nbsp; InterpolatorType;<BR>&nbsp; &nbsp;<BR>&nbsp;
 typedef itk::ImageRegistrationMethod&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MovingImageType &gt;&nbsp;&nbsp;&nbsp; RegistrationType;</div>  <div>&nbsp; MetricType::Pointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; metric&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = MetricType::New();<BR>&nbsp; metric-&gt;MeasureMatchesOff();</div>  <div><BR>&nbsp; OptimizerType::Pointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; optimizer&nbsp;&nbsp;&nbsp;&nbsp; = OptimizerType::New();<BR>&nbsp; InterpolatorType::Pointer&nbsp;&nbsp; interpolator&nbsp; = InterpolatorType::New();<BR>&nbsp;
 RegistrationType::Pointer&nbsp;&nbsp; registration&nbsp; = RegistrationType::New();<BR>&nbsp; </div>  <div>&nbsp; registration-&gt;SetMetric(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; metric&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<BR>&nbsp; registration-&gt;SetOptimizer(&nbsp;&nbsp;&nbsp;&nbsp; optimizer&nbsp;&nbsp;&nbsp;&nbsp; );<BR>&nbsp; registration-&gt;SetInterpolator(&nbsp; interpolator&nbsp; );</div>  <div><BR>&nbsp; //&nbsp; Software Guide : BeginLatex<BR>&nbsp; //<BR>&nbsp; //&nbsp; The transform object is constructed below and passed to the registration<BR>&nbsp; //&nbsp; method.<BR>&nbsp; //&nbsp; \index{itk::RegistrationMethod!SetTransform()}<BR>&nbsp; //<BR>&nbsp; //&nbsp; Software Guide : EndLatex </div>  <div>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp; TransformType::Pointer&nbsp; transform = TransformType::New();<BR>&nbsp; BulkTransformType::Pointer&nbsp; bulkTransform = BulkTransformType::New();</div>  <div>&nbsp;
 registration-&gt;SetTransform( transform );<BR>&nbsp; // Software Guide : EndCodeSnippet</div>  <div>&nbsp; typedef itk::ImageFileReader&lt; FixedImageType&nbsp; &gt; FixedImageReaderType;<BR>&nbsp; typedef itk::ImageFileReader&lt; MovingImageType &gt; MovingImageReaderType;</div>  <div>&nbsp; FixedImageReaderType::Pointer&nbsp; fixedImageReader&nbsp; = FixedImageReaderType::New();<BR>&nbsp; MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();</div>  <div>&nbsp;&nbsp; if( EXEC_MODE )<BR>&nbsp;fixedImageReader-&gt;SetFileName(&nbsp; argv[1] );<BR>&nbsp; else<BR>&nbsp;&nbsp;&nbsp; fixedImageReader-&gt;SetFileName(&nbsp; STR_FIXED_IMAGE );</div>  <div>&nbsp; fixedImageReader-&gt;Update();</div>  <div>&nbsp; if( EXEC_MODE )<BR>&nbsp;movingImageReader-&gt;SetFileName( argv[2] );<BR>&nbsp; else<BR>&nbsp;movingImageReader-&gt;SetFileName( STR_MOVING_IMAGE );</div>  <div>&nbsp; movingImageReader-&gt;Update();</div>  <div>&nbsp;
 FixedImageType::ConstPointer fixedImage = fixedImageReader-&gt;GetOutput();</div>  <div>&nbsp; registration-&gt;SetFixedImage(&nbsp; fixedImage&nbsp;&nbsp; );<BR>&nbsp; registration-&gt;SetMovingImage(&nbsp;&nbsp; movingImageReader-&gt;GetOutput()&nbsp;&nbsp; );</div>  <div>&nbsp; FixedImageType::RegionType fixedRegion = fixedImage-&gt;GetBufferedRegion();<BR>&nbsp; <BR>&nbsp;registration-&gt;SetFixedImageRegion( fixedRegion );</div>  <div>&nbsp; //&nbsp; Software Guide : BeginLatex<BR>&nbsp; //<BR>&nbsp; //&nbsp; Here we define the parameters of the BSplineDeformableTransform grid.&nbsp; We<BR>&nbsp; //&nbsp; arbitrarily decide to use a grid with $5 \times 5$ nodes within the image. <BR>&nbsp; //&nbsp; The reader should note that the BSpline computation requires a<BR>&nbsp; //&nbsp; finite support region ( 1 grid node at the lower borders and 2<BR>&nbsp; //&nbsp; grid nodes at upper borders). Therefore in this example, we set<BR>&nbsp; //&nbsp; the grid size to be $8
 \times 8$ and place the grid origin such that<BR>&nbsp; //&nbsp; grid node (1,1) coinicides with the first pixel in the fixed image.<BR>&nbsp; // <BR>&nbsp; //&nbsp; \index{BSplineDeformableTransform}<BR>&nbsp; //<BR>&nbsp; //&nbsp; Software Guide : EndLatex </div>  <div>&nbsp;// setup affine transform<BR>&nbsp; typedef itk::CenteredTransformInitializer&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BulkTransformType, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType,
 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MovingImageType &gt;&nbsp; TransformInitializerType;<BR>&nbsp; TransformInitializerType::Pointer initializer = TransformInitializerType::New();<BR>&nbsp; initializer-&gt;SetTransform(&nbsp;&nbsp; bulkTransform );<BR>&nbsp; initializer-&gt;SetFixedImage(&nbsp; fixedImageReader-&gt;GetOutput() );<BR>&nbsp; initializer-&gt;SetMovingImage( movingImageReader-&gt;GetOutput() );<BR>&nbsp; initializer-&gt;MomentsOn();<BR>&nbsp; initializer-&gt;InitializeTransform();</div>  <div>&nbsp;<BR>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp; typedef TransformType::RegionType RegionType;<BR>&nbsp; RegionType bsplineRegion;<BR>&nbsp; RegionType::SizeType&nbsp;&nbsp; gridSizeOnImage;<BR>&nbsp; RegionType::SizeType&nbsp;&nbsp; gridBorderSize;<BR>&nbsp;
 RegionType::SizeType&nbsp;&nbsp; totalGridSize;</div>  <div>&nbsp; gridSizeOnImage.Fill( atoi( argv[6] ) );<BR>&nbsp; gridSizeOnImage[2] = atoi( argv[7] );<BR>&nbsp; gridBorderSize.Fill( 3 );&nbsp;&nbsp;&nbsp; // Border for spline order = 3 ( 1 lower, 2 upper )<BR>&nbsp; totalGridSize = gridSizeOnImage + gridBorderSize;</div>  <div>&nbsp; bsplineRegion.SetSize( totalGridSize );</div>  <div>&nbsp; typedef TransformType::SpacingType SpacingType;<BR>&nbsp; SpacingType spacing = fixedImage-&gt;GetSpacing();</div>  <div>&nbsp; typedef TransformType::OriginType OriginType;<BR>&nbsp; OriginType origin = fixedImage-&gt;GetOrigin();;</div>  <div>&nbsp; FixedImageType::SizeType fixedImageSize = fixedRegion.GetSize();</div>  <div>&nbsp; for(unsigned int r=0; r&lt;ImageDimension; r++)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; spacing[r] *= floor( static_cast&lt;double&gt;(fixedImageSize[r] - 1)&nbsp; /
 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static_cast&lt;double&gt;(gridSizeOnImage[r] - 1) );<BR>&nbsp;&nbsp;&nbsp; origin[r]&nbsp; -=&nbsp; spacing[r]; <BR>&nbsp;&nbsp;&nbsp; }</div>  <div>&nbsp; transform-&gt;SetGridSpacing( spacing );<BR>&nbsp; transform-&gt;SetGridOrigin( origin );<BR>&nbsp; transform-&gt;SetGridRegion( bsplineRegion );<BR>&nbsp; </div>  <div>&nbsp; typedef TransformType::ParametersType&nbsp;&nbsp;&nbsp;&nbsp; ParametersType;</div>  <div>&nbsp; const unsigned int numberOfParameters =<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; transform-&gt;GetNumberOfParameters();<BR>&nbsp; <BR>&nbsp; ParametersType parameters( numberOfParameters );</div>  <div>&nbsp; parameters.Fill( 0.0 );</div>  <div>&nbsp; transform-&gt;SetParameters( parameters );</div>  <div>&nbsp; transform-&gt;SetBulkTransform( bulkTransform );</div>  <div>&nbsp; //&nbsp; Software
 Guide : EndCodeSnippet</div>  <div>&nbsp;</div>  <div>&nbsp; //&nbsp; Software Guide : BeginLatex<BR>&nbsp; //&nbsp; <BR>&nbsp; //&nbsp; We now pass the parameters of the current transform as the initial<BR>&nbsp; //&nbsp; parameters to be used when the registration process starts. <BR>&nbsp; //<BR>&nbsp; //&nbsp; Software Guide : EndLatex </div>  <div>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp; registration-&gt;SetInitialTransformParameters( transform-&gt;GetParameters() );<BR>&nbsp; // Software Guide : EndCodeSnippet</div>  <div>&nbsp;// std::cout &lt;&lt; "Intial Parameters = " &lt;&lt; std::endl;<BR>&nbsp; //&nbsp; std::cout &lt;&lt; transform-&gt;GetParameters() &lt;&lt; std::endl;</div>  <div>&nbsp; //&nbsp; Software Guide : BeginLatex<BR>&nbsp; //&nbsp; <BR>&nbsp; //&nbsp; Next we set the parameters of the LBFGSB Optimizer. <BR>&nbsp; //<BR>&nbsp; //&nbsp; Software Guide : EndLatex </div>  <div><BR>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp;
 OptimizerType::BoundSelectionType boundSelect( transform-&gt;GetNumberOfParameters() );<BR>&nbsp; OptimizerType::BoundValueType upperBound( transform-&gt;GetNumberOfParameters() );<BR>&nbsp; OptimizerType::BoundValueType lowerBound( transform-&gt;GetNumberOfParameters() );</div>  <div>&nbsp; boundSelect.Fill( 0 );<BR>&nbsp; upperBound.Fill( 0.0 );<BR>&nbsp; lowerBound.Fill( 0.0 );</div>  <div>&nbsp; optimizer-&gt;SetBoundSelection( boundSelect );<BR>&nbsp; optimizer-&gt;SetUpperBound( upperBound );<BR>&nbsp; optimizer-&gt;SetLowerBound( lowerBound );</div>  <div>&nbsp; optimizer-&gt;SetCostFunctionConvergenceFactor( 1e+7 );<BR>&nbsp; optimizer-&gt;SetProjectedGradientTolerance( 1e-4 );<BR>&nbsp; optimizer-&gt;SetMaximumNumberOfIterations( 500 );<BR>&nbsp; optimizer-&gt;SetMaximumNumberOfEvaluations( 500 );<BR>&nbsp; optimizer-&gt;SetMaximumNumberOfCorrections( 12 );</div>  <div>&nbsp; // Software Guide : EndCodeSnippet</div>  <div>&nbsp; // Create the Command observer and
 register it with the optimizer.<BR>&nbsp; //<BR>&nbsp; CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New();<BR>&nbsp; optimizer-&gt;AddObserver( itk::IterationEvent(), observer );</div>  <div><BR>&nbsp; //&nbsp; Software Guide : BeginLatex<BR>&nbsp; //&nbsp; <BR>&nbsp; //&nbsp; Next we set the parameters of the Mattes Mutual Information Metric. <BR>&nbsp; //<BR>&nbsp; //&nbsp; Software Guide : EndLatex </div>  <div>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp; //metric-&gt;SetNumberOfHistogramBins( 50 );<BR>&nbsp; <BR>&nbsp; //const unsigned int numberOfSamples = fixedRegion.GetNumberOfPixels() / 10;</div>  <div>&nbsp; //metric-&gt;SetNumberOfSpatialSamples( numberOfSamples );<BR>&nbsp; // Software Guide : EndCodeSnippet<BR>&nbsp;</div>  <div>&nbsp; //&nbsp; Software Guide : BeginLatex<BR>&nbsp; //&nbsp; <BR>&nbsp; //&nbsp; Given that the Mattes Mutual Information metric uses a random iterator in<BR>&nbsp; //&nbsp; order to collect the samples
 from the images, it is usually convenient to<BR>&nbsp; //&nbsp; initialize the seed of the random number generator.<BR>&nbsp; //<BR>&nbsp; //&nbsp; Software Guide : EndLatex </div>  <div>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp; vnl_sample_reseed( 76926294 );<BR>&nbsp; // Software Guide : EndCodeSnippet</div>  <div><BR>&nbsp; // Add a time probe<BR>&nbsp; itk::TimeProbesCollectorBase collector;</div>  <div>&nbsp; std::cout &lt;&lt; std::endl &lt;&lt; "Starting Registration" &lt;&lt; std::endl;</div>  <div>&nbsp; try <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp; collector.Start( "Registration" );<BR>&nbsp;&nbsp;&nbsp; registration-&gt;StartRegistration(); <BR>&nbsp;&nbsp;&nbsp; collector.Stop( "Registration" );<BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp; catch( itk::ExceptionObject &amp; err ) <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "ExceptionObject caught !" &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; err &lt;&lt;
 std::endl; <BR>&nbsp;&nbsp;&nbsp; return -1;<BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp; OptimizerType::ParametersType finalParameters = <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; registration-&gt;GetLastTransformParameters();</div>  <div>//&nbsp; std::cout &lt;&lt; "Last Transform Parameters" &lt;&lt; std::endl;<BR>//&nbsp; std::cout &lt;&lt; finalParameters &lt;&lt; std::endl;</div>  <div><BR>&nbsp; // Report the time taken by the registration<BR>&nbsp; collector.Report();</div>  <div>&nbsp; // Software Guide : BeginCodeSnippet<BR>&nbsp; transform-&gt;SetParameters( finalParameters );<BR>&nbsp; // Software Guide : EndCodeSnippet</div>  <div><BR>&nbsp; typedef itk::ResampleImageFilter&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MovingImageType,
 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType &gt;&nbsp;&nbsp;&nbsp; ResampleFilterType;</div>  <div>&nbsp; ResampleFilterType::Pointer resample = ResampleFilterType::New();</div>  <div>&nbsp; resample-&gt;SetTransform( transform );<BR>&nbsp; resample-&gt;SetInput( movingImageReader-&gt;GetOutput() );</div>  <div>&nbsp; resample-&gt;SetSize(&nbsp;&nbsp;&nbsp; fixedImage-&gt;GetLargestPossibleRegion().GetSize() );<BR>&nbsp; resample-&gt;SetOutputOrigin(&nbsp; fixedImage-&gt;GetOrigin() );<BR>&nbsp; resample-&gt;SetOutputSpacing( fixedImage-&gt;GetSpacing() );<BR>&nbsp; resample-&gt;SetDefaultPixelValue( 0 );<BR>&nbsp; resample-&gt;SetInterpolator( interpolator );<BR>&nbsp; <BR>&nbsp; typedef&nbsp; unsigned char&nbsp; OutputPixelType;</div>  <div>&nbsp; typedef itk::Image&lt; OutputPixelType, ImageDimension &gt; OutputImageType;<BR>&nbsp;
 <BR>&nbsp; typedef itk::CastImageFilter&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputImageType &gt; CastFilterType;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp; typedef itk::ImageFileWriter&lt; OutputImageType &gt;&nbsp; WriterType;</div>  <div><BR>&nbsp; WriterType::Pointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer =&nbsp; WriterType::New();<BR>&nbsp; CastFilterType::Pointer&nbsp; caster =&nbsp; CastFilterType::New();</div>  <div><BR>&nbsp;&nbsp; // write aligned image<BR>&nbsp; if( EXEC_MODE )<BR>&nbsp;writer-&gt;SetFileName( argv[3] );<BR>&nbsp; else<BR>&nbsp;writer-&gt;SetFileName( STR_OUTPUT_IMAGE );</div>  <div><BR>&nbsp;
 caster-&gt;SetInput( resample-&gt;GetOutput() );<BR>&nbsp; writer-&gt;SetInput( caster-&gt;GetOutput()&nbsp;&nbsp; );</div>  <div><BR>&nbsp; try<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; writer-&gt;Update();<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; catch( itk::ExceptionObject &amp; err ) <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "ExceptionObject caught !" &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; err &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp; return -1;<BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp;</div>  <div><BR>&nbsp; typedef itk::SquaredDifferenceImageFilter&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType,
 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FixedImageType, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputImageType &gt; DifferenceFilterType;</div>  <div>&nbsp; DifferenceFilterType::Pointer difference = DifferenceFilterType::New();</div>  <div>&nbsp; WriterType::Pointer writer2 = WriterType::New();<BR>&nbsp; writer2-&gt;SetInput( difference-&gt;GetOutput() );&nbsp; <BR>&nbsp; </div>  <div>&nbsp; // Compute the difference image between the <BR>&nbsp; // fixed and resampled moving image.<BR>&nbsp; difference-&gt;SetInput1( fixedImageReader-&gt;GetOutput() );<BR>&nbsp; difference-&gt;SetInput2( resample-&gt;GetOutput() );</div>  <div>&nbsp;&nbsp; if(
 EXEC_MODE )<BR>&nbsp;writer2-&gt;SetFileName( argv[5] );<BR>&nbsp; else<BR>&nbsp;writer2-&gt;SetFileName( STR_DIFF_AFTER_IMAGE );</div>  <div>&nbsp;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer2-&gt;Update();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject &amp; err ) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "ExceptionObject caught !" &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; err &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </div>  <div>&nbsp; // Compute the difference image between the <BR>&nbsp; // fixed and moving image before registration.</div>  <div>&nbsp;&nbsp; <BR>&nbsp;if( EXEC_MODE )<BR>&nbsp;&nbsp;writer2-&gt;SetFileName( argv[4] );<BR>&nbsp;else<BR>&nbsp;&nbsp;writer2-&gt;SetFileName( STR_DIFF_BEFORE_IMAGE );</div>  <div>&nbsp;&nbsp;&nbsp;
 difference-&gt;SetInput1( fixedImageReader-&gt;GetOutput() );<BR>&nbsp;&nbsp;&nbsp; difference-&gt;SetInput2( movingImageReader-&gt;GetOutput() );<BR>&nbsp;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer2-&gt;Update();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject &amp; err ) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "ExceptionObject caught !" &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; err &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </div>  <div><BR>&nbsp; // Generate the explicit deformation field resulting from <BR>&nbsp; // the registration.<BR>&nbsp; if( EXEC_MODE &amp;&amp; argc &gt;= 8 )<BR>&nbsp;&nbsp;&nbsp; {</div>  <div>&nbsp;&nbsp;&nbsp; typedef itk::Vector&lt; float, ImageDimension &gt;&nbsp; VectorType;<BR>&nbsp;&nbsp;&nbsp; typedef
 itk::Image&lt; VectorType, ImageDimension &gt;&nbsp; DeformationFieldType;</div>  <div>&nbsp;&nbsp;&nbsp; DeformationFieldType::Pointer field = DeformationFieldType::New();<BR>&nbsp;&nbsp;&nbsp; field-&gt;SetRegions( fixedRegion );<BR>&nbsp;&nbsp;&nbsp; field-&gt;SetOrigin( fixedImage-&gt;GetOrigin() );<BR>&nbsp;&nbsp;&nbsp; field-&gt;SetSpacing( fixedImage-&gt;GetSpacing() );<BR>&nbsp;&nbsp;&nbsp; field-&gt;Allocate();</div>  <div>&nbsp;&nbsp;&nbsp; typedef itk::ImageRegionIterator&lt; DeformationFieldType &gt; FieldIterator;<BR>&nbsp;&nbsp;&nbsp; FieldIterator fi( field, fixedRegion );</div>  <div>&nbsp;&nbsp;&nbsp; fi.GoToBegin();</div>  <div>&nbsp;&nbsp;&nbsp; TransformType::InputPointType&nbsp; fixedPoint;<BR>&nbsp;&nbsp;&nbsp; TransformType::OutputPointType movingPoint;<BR>&nbsp;&nbsp;&nbsp; DeformationFieldType::IndexType index;</div>  <div>&nbsp;&nbsp;&nbsp; VectorType displacement;</div>  <div>&nbsp;&nbsp;&nbsp; while( ! fi.IsAtEnd()
 )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index = fi.GetIndex();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; field-&gt;TransformIndexToPhysicalPoint( index, fixedPoint );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; movingPoint = transform-&gt;TransformPoint( fixedPoint );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displacement[0] = movingPoint[0] - fixedPoint[0];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displacement[1] = movingPoint[1] - fixedPoint[1];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi.Set( displacement );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++fi;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>  <div>&nbsp;</div>  <div>&nbsp;&nbsp;&nbsp; typedef itk::ImageFileWriter&lt; DeformationFieldType &gt;&nbsp; FieldWriterType;<BR>&nbsp;&nbsp;&nbsp; FieldWriterType::Pointer fieldWriter = FieldWriterType::New();</div>  <div>&nbsp;&nbsp;&nbsp; fieldWriter-&gt;SetInput( field );</div>  <div>&nbsp;&nbsp;&nbsp; fieldWriter-&gt;SetFileName( argv[8] );<BR>&nbsp;&nbsp;&nbsp;
 try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fieldWriter-&gt;Update();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject &amp; excp )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception thrown " &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; excp &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }</div>  <div>&nbsp; return 0;<BR>}</div>  <div>&nbsp;</div>  <div><FONT size=2><FONT size=2></FONT></FONT>&nbsp;</div>  <div>&nbsp;</div>  <div><FONT size=2><FONT size=2>&nbsp;</div></FONT></FONT></FONT></FONT></FONT><p>&#32;

<hr size=1>Get your email and see which of your friends are online - Right on the <a href="http://us.rd.yahoo.com/evt=42973/*http://www.yahoo.com/preview"> new Yahoo.com</a>