<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div>Greetings dear members,</div><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><br></div><div>const &nbsp; &nbsp;unsigned int &nbsp; &nbsp;Dimension = 2;</div><div>&nbsp;&nbsp;typedef &nbsp;short &nbsp; PixelType;</div><div>&nbsp;</div><div>&nbsp;&nbsp;typedef itk::Image&lt; PixelType, Dimension &gt; &nbsp;FixedImageType;</div><div>&nbsp;&nbsp;typedef itk::Image&lt; PixelType, Dimension &gt; &nbsp;MovingImageType;</div><div>&nbsp;&nbsp;typedef double CoordinateRepType;</div><div>&nbsp;&nbsp;typedef itk::ThinPlateSplineKernelTransform&lt; CoordinateRepType, Dimension&gt;
 TransformType;</div><div>&nbsp;&nbsp;typedef itk::ImageRegistrationMethod&lt; FixedImageType, MovingImageType &gt; RegistrationType;</div><div>&nbsp;&nbsp;typedef &nbsp; itk::Point&lt; CoordinateRepType, Dimension &gt; &nbsp;PointType;</div><div>&nbsp;&nbsp;typedef &nbsp; TransformType::PointSetType &nbsp; PointSetType;</div><div>&nbsp;&nbsp;typedef &nbsp; PointSetType::Pointer &nbsp; &nbsp; &nbsp;PointSetPointer;</div><div>&nbsp;&nbsp;typedef &nbsp; PointSetType::PointIdentifier &nbsp;PointIdType;</div><div>&nbsp;&nbsp;&nbsp;</div><div>&nbsp;&nbsp;typedef itk::RegularStepGradientDescentOptimizer &nbsp; &nbsp; &nbsp; OptimizerType;</div><div>&nbsp;&nbsp;typedef itk::MutualInformationImageToImageMetric&lt; FixedImageType, MovingImageType &gt; &nbsp; MetricType;</div><div>&nbsp;&nbsp;typedef itk:: LinearInterpolateImageFunction&lt; MovingImageType, double&gt; &nbsp; &nbsp;InterpolatorType;</div><div>&nbsp;</div><div>&nbsp;&nbsp;OptimizerType::Pointer
 &nbsp; &nbsp; &nbsp;optimizer &nbsp; &nbsp; = OptimizerType::New();</div><div>&nbsp;&nbsp;InterpolatorType::Pointer &nbsp; interpolator &nbsp;= InterpolatorType::New();</div><div>&nbsp;&nbsp;RegistrationType::Pointer &nbsp; registration &nbsp;= RegistrationType::New();</div><div>&nbsp;&nbsp;MetricType::Pointer &nbsp; &nbsp; &nbsp; &nbsp; metric &nbsp; &nbsp; &nbsp; &nbsp;= MetricType::New();</div><div>&nbsp;</div><div>&nbsp;&nbsp;//------------------------------------------------------------------------------------------------------//</div><div><br></div><div>&nbsp;&nbsp;PointSetType::Pointer sourceLandMarks = PointSetType::New();</div><div>&nbsp;&nbsp;PointSetType::Pointer targetLandMarks = PointSetType::New();</div><div>&nbsp;&nbsp;PointType p1; &nbsp;&nbsp;</div><div>&nbsp;&nbsp;PointType p2;</div><div>&nbsp;&nbsp;PointSetType::PointsContainer::Pointer sourceLandMarkContainer =
 sourceLandMarks-&gt;GetPoints();</div><div>&nbsp;&nbsp;PointSetType::PointsContainer::Pointer targetLandMarkContainer = targetLandMarks-&gt;GetPoints();</div><div>&nbsp;&nbsp;PointIdType id = itk::NumericTraits&lt; PointIdType &gt;::Zero;</div><div>&nbsp;&nbsp;// Read in the list of landmarks</div><div>&nbsp;&nbsp;std::ifstream infile;</div><div>&nbsp;&nbsp;infile.open( argv[1] );</div><div>&nbsp;&nbsp;while (!infile.eof())</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp;infile &gt;&gt; &nbsp;p1[0] &gt;&gt; p1[1] &gt;&gt; p2[0] &gt;&gt; p2[1];</div><div>&nbsp;&nbsp; &nbsp;sourceLandMarkContainer-&gt;InsertElement( id, p1 );</div><div>&nbsp;&nbsp; &nbsp;targetLandMarkContainer-&gt;InsertElement( id++, p2 );</div><div>&nbsp;&nbsp; &nbsp;}</div><div>&nbsp;&nbsp;infile.close();</div><div>&nbsp;&nbsp;TransformType::Pointer tps =
 TransformType::New();</div><div>&nbsp;&nbsp;tps-&gt;SetSourceLandmarks(sourceLandMarks);</div><div>&nbsp;&nbsp;tps-&gt;SetTargetLandmarks(targetLandMarks);</div><div>&nbsp;&nbsp;tps-&gt;ComputeWMatrix();</div><div>&nbsp;&nbsp;//-------------------------------------------------------------------------------------------------------//</div><div><br></div><div>&nbsp;&nbsp;registration-&gt;SetOptimizer( &nbsp; &nbsp; optimizer &nbsp; &nbsp; );</div><div>&nbsp;&nbsp;registration-&gt;SetTransform( &nbsp; &nbsp; tps &nbsp; &nbsp; );</div><div>&nbsp;&nbsp;registration-&gt;SetInterpolator( &nbsp;interpolator &nbsp;);</div><div>&nbsp;&nbsp;registration-&gt;SetMetric( &nbsp; &nbsp; &nbsp; &nbsp;metric &nbsp; &nbsp; &nbsp; &nbsp;);</div><div>&nbsp;</div><div>&nbsp;&nbsp;typedef itk::ImageFileReader&lt; FixedImageType &nbsp;&gt; FixedImageReaderType;</div><div>&nbsp;&nbsp;typedef itk::ImageFileReader&lt; MovingImageType &gt;
 MovingImageReaderType;</div><div>&nbsp;&nbsp;FixedImageReaderType::Pointer &nbsp;fixedImageReader &nbsp;= FixedImageReaderType::New();</div><div>&nbsp;&nbsp;MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();</div><div>&nbsp;&nbsp;fixedImageReader-&gt;SetFileName( &nbsp;argv[2] );</div><div>&nbsp;&nbsp;movingImageReader-&gt;SetFileName( argv[3] );</div><div>&nbsp;</div><div>&nbsp;&nbsp;registration-&gt;SetFixedImage( &nbsp; &nbsp;fixedImageReader-&gt;GetOutput() &nbsp; &nbsp;);</div><div>&nbsp;&nbsp;registration-&gt;SetMovingImage( &nbsp; movingImageReader-&gt;GetOutput() &nbsp; );</div><div>&nbsp;&nbsp;fixedImageReader-&gt;Update();</div><div>&nbsp;&nbsp;registration-&gt;SetFixedImageRegion( fixedImageReader-&gt;GetOutput()-&gt;GetBufferedRegion() );</div><div>&nbsp;</div><div>&nbsp;&nbsp;typedef RegistrationType::ParametersType ParametersType;</div><div>&nbsp;&nbsp;ParametersType initialParameters(
 tps-&gt;GetNumberOfParameters() );</div><div>&nbsp;&nbsp;initialParameters = tps-&gt;GetParameters();</div><div>&nbsp;&nbsp;std::cout &lt;&lt; " TPS Parameters = " &lt;&lt; tps-&gt;GetParameters() &lt;&lt; std::endl;</div><div>&nbsp;&nbsp;std::cout &lt;&lt; " TPS Parameters = " &lt;&lt; initialParameters &lt;&lt; std::endl;</div><div>&nbsp;&nbsp;registration-&gt;SetInitialTransformParameters( initialParameters );</div><div>&nbsp;&nbsp;optimizer-&gt;SetNumberOfIterations( 200 );</div><div>&nbsp;&nbsp;optimizer-&gt;SetRelaxationFactor( 0.9 );</div><div>&nbsp;</div><div>&nbsp;&nbsp;try</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp;registration-&gt;StartRegistration();</div><div>&nbsp;&nbsp; &nbsp;std::cout &lt;&lt; "Optimizer stop condition: "</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; registration-&gt;GetOptimizer()-&gt;GetStopConditionDescription()</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp;&lt;&lt; std::endl;</div><div>&nbsp;&nbsp; &nbsp;}</div><div>&nbsp;&nbsp;catch( itk::ExceptionObject &amp; err )</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp;std::cout &lt;&lt; "ExceptionObject caught !" &lt;&lt; std::endl;</div><div>&nbsp;&nbsp; &nbsp;std::cout &lt;&lt; err &lt;&lt; std::endl;</div><div>&nbsp;&nbsp; &nbsp;return EXIT_FAILURE;</div><div>&nbsp;&nbsp; &nbsp;}</div><div>*********************************************************************************************************</div><div><br></div><div><br></div><div>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><br></div><div><br></div><div>*********************************************************************************************************</div><div>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"</div><div>File: e:\research programs\[][ir] itk\insighttoolkit-3.18.0\code\common\itkKernelTransform.txx</div><div>Line: 455</div><div>Description: itk::ERROR: ThinPlateSplineKernelTransform(01571248): GetJacobian must be implemented in subclasses of KernelTransform.</div><div><br></div><div>***************************************************************************</div><div><br></div><div>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.</div><div>Best regards,</div><div>Davoud.</div></td></tr></table><br>