<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Greetings dear members,<div>I am trying to register pair of CT images using the Thin-Plate Spline (TPS) transform and the following source code is the section related to TPS registration:</div><div><br></div><div>**********************************************************************************************************</div><div><p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">const</span><span style="font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">unsigned</span> <span style="color:blue">int</span><span style="mso-spacerun:yes">
</span>Dimension = 2;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes"> </span><span style="color:blue">short</span><span style="mso-spacerun:yes"> </span>PixelType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::Image< PixelType, Dimension ><span style="mso-spacerun:yes">
</span>FixedImageType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::Image< PixelType, Dimension ><span style="mso-spacerun:yes">
</span>MovingImageType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span> <span style="color:blue">double</span> CoordinateRepType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::ThinPlateSplineKernelTransform< CoordinateRepType, Dimension>
TransformType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::ImageRegistrationMethod< FixedImageType, MovingImageType > RegistrationType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes"> </span>itk::Point< CoordinateRepType, Dimension
><span style="mso-spacerun:yes"> </span>PointType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes"> </span>TransformType::PointSetType<span style="mso-spacerun:yes"> </span>PointSetType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes"> </span>PointSetType::Pointer<span style="mso-spacerun:yes"> </span>PointSetPointer;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes"> </span>PointSetType::PointIdentifier<span style="mso-spacerun:yes"> </span>PointIdType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::RegularStepGradientDescentOptimizer<span style="mso-spacerun:yes">
</span>OptimizerType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::MutualInformationImageToImageMetric< FixedImageType, MovingImageType
><span style="mso-spacerun:yes"> </span>MetricType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span> itk::
LinearInterpolateImageFunction< MovingImageType, <span style="color:blue">double</span>><span style="mso-spacerun:yes"> </span>InterpolatorType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>OptimizerType::Pointer<span style="mso-spacerun:yes"> </span>optimizer<span style="mso-spacerun:yes"> </span>= OptimizerType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>InterpolatorType::Pointer<span style="mso-spacerun:yes"> </span>interpolator<span style="mso-spacerun:yes">
</span>= InterpolatorType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>RegistrationType::Pointer<span style="mso-spacerun:yes"> </span>registration<span style="mso-spacerun:yes">
</span>= RegistrationType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>MetricType::Pointer<span style="mso-spacerun:yes"> </span><span style="mso-spacerun:yes"> </span>metric<span style="mso-spacerun:yes">
</span>= MetricType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:green">//------------------------------------------------------------------------------------------------------//<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>PointSetType::Pointer sourceLandMarks =
PointSetType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>PointSetType::Pointer targetLandMarks = PointSetType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>PointType p1;<span style="mso-spacerun:yes"> </span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>PointType p2;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>PointSetType::PointsContainer::Pointer
sourceLandMarkContainer = sourceLandMarks->GetPoints();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>PointSetType::PointsContainer::Pointer
targetLandMarkContainer = targetLandMarks->GetPoints();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>PointIdType id = itk::NumericTraits<
PointIdType >::Zero;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:green">// Read in the list
of landmarks<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>std::ifstream infile;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>infile.open( argv[1] );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">while</span>
(!infile.eof())<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>infile >><span style="mso-spacerun:yes"> </span>p1[0] >> p1[1] >> p2[0] >>
p2[1]; <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>sourceLandMarkContainer->InsertElement(
id, p1 );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>targetLandMarkContainer->InsertElement(
id++, p2 );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>} <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>infile.close();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>TransformType::Pointer tps =
TransformType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>tps->SetSourceLandmarks(sourceLandMarks);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>tps->SetTargetLandmarks(targetLandMarks);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>tps->ComputeWMatrix();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:green">//-------------------------------------------------------------------------------------------------------//<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->SetOptimizer(<span style="mso-spacerun:yes"> </span>optimizer<span style="mso-spacerun:yes"> </span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->SetTransform(<span style="mso-spacerun:yes"> </span>tps<span style="mso-spacerun:yes">
</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->SetInterpolator(<span style="mso-spacerun:yes"> </span>interpolator<span style="mso-spacerun:yes">
</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->SetMetric(<span style="mso-spacerun:yes"> </span>metric<span style="mso-spacerun:yes"> </span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::ImageFileReader< FixedImageType<span style="mso-spacerun:yes">
</span>> FixedImageReaderType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
itk::ImageFileReader< MovingImageType > MovingImageReaderType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>FixedImageReaderType::Pointer<span style="mso-spacerun:yes"> </span>fixedImageReader<span style="mso-spacerun:yes"> </span>= FixedImageReaderType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>MovingImageReaderType::Pointer
movingImageReader = MovingImageReaderType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>fixedImageReader->SetFileName(<span style="mso-spacerun:yes"> </span>argv[2] );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>movingImageReader->SetFileName( argv[3] );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->SetFixedImage( <span style="mso-spacerun:yes"> </span>fixedImageReader->GetOutput()<span style="mso-spacerun:yes"> </span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->SetMovingImage(<span style="mso-spacerun:yes"> </span>movingImageReader->GetOutput()<span style="mso-spacerun:yes"> </span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>fixedImageReader->Update();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->SetFixedImageRegion(
fixedImageReader->GetOutput()->GetBufferedRegion() );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">typedef</span>
RegistrationType::ParametersType ParametersType;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>ParametersType initialParameters(
tps->GetNumberOfParameters() );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>initialParameters = tps->GetParameters();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>std::cout << <span style="color:#A31515">"
TPS Parameters = "</span> << tps->GetParameters() <<
std::endl;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>std::cout << <span style="color:#A31515">"
TPS Parameters = "</span> << initialParameters << std::endl;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes">
</span>registration->SetInitialTransformParameters( initialParameters );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>optimizer->SetNumberOfIterations( 200 );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>optimizer->SetRelaxationFactor( 0.9 );<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">try</span> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>{ <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>registration->StartRegistration(); <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>std::cout << <span style="color:#A31515">"Optimizer
stop condition: "<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><<
registration->GetOptimizer()->GetStopConditionDescription()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><< std::endl;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>} <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">catch</span>(
itk::ExceptionObject & err ) <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>{ <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>std::cout << <span style="color:#A31515">"ExceptionObject
caught !"</span> << std::endl; <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span>std::cout << err << std::endl; <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes"><span style="mso-spacerun:yes"> </span><span style="color:blue">return</span>
EXIT_FAILURE;<o:p></o:p></span></p>
<div><span class="Apple-style-span" style="font-family: 'Courier New'; "><span style="mso-spacerun:yes"> </span>}</span></div><div>*********************************************************************************************************</div><div><br></div><div><span class="Apple-style-span" style="font-family: 'Courier New'; "></span>This code is suppose to register two CT images with predefined landmarks which are the TPS transformation parameters. The code compiles just fine however in time of execution I get the following error: </div><div>*********************************************************************************************************</div><div><p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">Location: "const class itk::Array2D<double>
&__thiscall itk::KernelTransform<double,2>::GetJacobian(const class
itk::Point<double,2> &) const" <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">File: e:\research programs\[][ir] itk\insighttoolkit-3.18.0\code\common\itkKernelTransform.txx<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">Line: 455<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">Description: itk::ERROR: ThinPlateSplineKernelTransform(01571248):
GetJacobian must be implemented in subclasses of KernelTransform.<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">***************************************************************************</span></p><p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">The used landmark file is similar to what have been used for the ThinPlateSplineWarp example in the ITK framework and I don't think that is the cause of error. My guess is that the parameters initialization of the registration method is not configured properly but I don't know how to correct that. I would appreciate any help to solve this issue.</span></p><p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">Best regards,</span></p><p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">Davoud.</span></p><p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi"><br></span></p><p class="MsoNormal"><span style="font-family:"Times New Roman","serif";
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi"><br></span></p></div></div></td></tr></table><br>