<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:&quot;Courier New&quot;;color:blue;mso-no-proof:yes">const</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span><span style="color:blue">unsigned</span> <span style="color:blue">int</span><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">short</span><span style="mso-spacerun:yes">&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::Image&lt; PixelType, Dimension &gt;<span style="mso-spacerun:yes">&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::Image&lt; PixelType, Dimension &gt;<span style="mso-spacerun:yes">&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::ThinPlateSplineKernelTransform&lt; CoordinateRepType, Dimension&gt;
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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::ImageRegistrationMethod&lt; FixedImageType, MovingImageType &gt; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes">&nbsp;&nbsp; </span>itk::Point&lt; CoordinateRepType, Dimension
&gt;<span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes">&nbsp;&nbsp; </span>TransformType::PointSetType<span style="mso-spacerun:yes">&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes">&nbsp;&nbsp; </span>PointSetType::Pointer<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span><span style="mso-spacerun:yes">&nbsp;&nbsp; </span>PointSetType::PointIdentifier<span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::RegularStepGradientDescentOptimizer<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::MutualInformationImageToImageMetric&lt; FixedImageType, MovingImageType
&gt;<span style="mso-spacerun:yes">&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span> itk::
LinearInterpolateImageFunction&lt; MovingImageType, <span style="color:blue">double</span>&gt;<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>OptimizerType::Pointer<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>optimizer<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>InterpolatorType::Pointer<span style="mso-spacerun:yes">&nbsp;&nbsp; </span>interpolator<span style="mso-spacerun:yes">&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>RegistrationType::Pointer<span style="mso-spacerun:yes">&nbsp;&nbsp; </span>registration<span style="mso-spacerun:yes">&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>MetricType::Pointer<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun:yes">&nbsp;&nbsp;</span>metric<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>PointType p1;<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>PointSetType::PointsContainer::Pointer
sourceLandMarkContainer = sourceLandMarks-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>PointSetType::PointsContainer::Pointer
targetLandMarkContainer = targetLandMarks-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>PointIdType id = itk::NumericTraits&lt;
PointIdType &gt;::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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>infile &gt;&gt;<span style="mso-spacerun:yes">&nbsp; </span>p1[0] &gt;&gt; p1[1] &gt;&gt; p2[0] &gt;&gt;
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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>sourceLandMarkContainer-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>targetLandMarkContainer-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>tps-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>tps-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>tps-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>registration-&gt;SetOptimizer(<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp; </span>optimizer<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>registration-&gt;SetTransform(<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp; </span>tps<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>registration-&gt;SetInterpolator(<span style="mso-spacerun:yes">&nbsp; </span>interpolator<span style="mso-spacerun:yes">&nbsp;
</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>registration-&gt;SetMetric(<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>metric<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::ImageFileReader&lt; FixedImageType<span style="mso-spacerun:yes">&nbsp;
</span>&gt; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">typedef</span>
itk::ImageFileReader&lt; MovingImageType &gt; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>FixedImageReaderType::Pointer<span style="mso-spacerun:yes">&nbsp; </span>fixedImageReader<span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>fixedImageReader-&gt;SetFileName(<span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>movingImageReader-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>registration-&gt;SetFixedImage( <span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;</span>fixedImageReader-&gt;GetOutput()<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>registration-&gt;SetMovingImage(<span style="mso-spacerun:yes">&nbsp;&nbsp; </span>movingImageReader-&gt;GetOutput()<span style="mso-spacerun:yes">&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>fixedImageReader-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>registration-&gt;SetFixedImageRegion(
fixedImageReader-&gt;GetOutput()-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>ParametersType initialParameters(
tps-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>initialParameters = tps-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>std::cout &lt;&lt; <span style="color:#A31515">"
TPS Parameters = "</span> &lt;&lt; tps-&gt;GetParameters() &lt;&lt;
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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>std::cout &lt;&lt; <span style="color:#A31515">"
TPS Parameters = "</span> &lt;&lt; initialParameters &lt;&lt; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;
</span>registration-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>optimizer-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span>optimizer-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>registration-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>std::cout &lt;&lt; <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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;&lt;
registration-&gt;GetOptimizer()-&gt;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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;&lt; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp; </span><span style="color:blue">catch</span>(
itk::ExceptionObject &amp; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>std::cout &lt;&lt; <span style="color:#A31515">"ExceptionObject
caught !"</span> &lt;&lt; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span>std::cout &lt;&lt; err &lt;&lt; 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:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </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">&nbsp;&nbsp; &nbsp;</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:&nbsp;</div><div>*********************************************************************************************************</div><div><p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;
mso-ascii-theme-font:major-bidi;mso-hansi-theme-font:major-bidi;mso-bidi-theme-font:
major-bidi">Location: "const class itk::Array2D&lt;double&gt;
&amp;__thiscall itk::KernelTransform&lt;double,2&gt;::GetJacobian(const class
itk::Point&lt;double,2&gt; &amp;) const" <o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;
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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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&nbsp;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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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:&quot;Times New Roman&quot;,&quot;serif&quot;;
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>