<br>Hi Davoud,<br><br>The TPS class has not implemented its method<br><br>               GetJacobian()<br><br>therefore, you can&#39;t use it with optimizers that<br>require the computation of metric derivatives.<br><br>You may try then, the following two optimizers:<br>
<br>A) OnePlusOneEvolutionaryOptimizer<br><br>B) AmoebaOptimizer<br><br><br>These two optimizers only require Metrics to <br>compute the GetValue() and therefore do not<br>invoke the GetJacobian() method in the <br>Transforms.<br>
<br><br>      Regards,<br><br><br>            Luis<br><br><br>----------------------------------------------------<br><div class="gmail_quote">On Thu, Sep 23, 2010 at 5:21 PM, Dav <span dir="ltr">&lt;<a href="mailto:davoud_zzz@yahoo.com">davoud_zzz@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">
<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    unsigned int    Dimension = 2;</div><div>  typedef  short   PixelType;</div><div>
 </div><div>  typedef itk::Image&lt; PixelType, Dimension &gt;  FixedImageType;</div><div>  typedef itk::Image&lt; PixelType, Dimension &gt;  MovingImageType;</div><div>  typedef double CoordinateRepType;</div><div>  typedef itk::ThinPlateSplineKernelTransform&lt; CoordinateRepType, Dimension&gt;
 TransformType;</div><div>  typedef itk::ImageRegistrationMethod&lt; FixedImageType, MovingImageType &gt; RegistrationType;</div><div>  typedef   itk::Point&lt; CoordinateRepType, Dimension &gt;  PointType;</div><div>  typedef   TransformType::PointSetType   PointSetType;</div>
<div>  typedef   PointSetType::Pointer      PointSetPointer;</div><div>  typedef   PointSetType::PointIdentifier  PointIdType;</div><div>   </div><div>  typedef itk::RegularStepGradientDescentOptimizer       OptimizerType;</div>
<div>  typedef itk::MutualInformationImageToImageMetric&lt; FixedImageType, MovingImageType &gt;   MetricType;</div><div>  typedef itk:: LinearInterpolateImageFunction&lt; MovingImageType, double&gt;    InterpolatorType;</div>
<div> </div><div>  OptimizerType::Pointer
      optimizer     = OptimizerType::New();</div><div>  InterpolatorType::Pointer   interpolator  = InterpolatorType::New();</div><div>  RegistrationType::Pointer   registration  = RegistrationType::New();</div><div>  MetricType::Pointer         metric        = MetricType::New();</div>
<div> </div><div>  //------------------------------------------------------------------------------------------------------//</div><div><br></div><div>  PointSetType::Pointer sourceLandMarks = PointSetType::New();</div><div>
  PointSetType::Pointer targetLandMarks = PointSetType::New();</div><div>  PointType p1;   </div><div>  PointType p2;</div><div>  PointSetType::PointsContainer::Pointer sourceLandMarkContainer =
 sourceLandMarks-&gt;GetPoints();</div><div>  PointSetType::PointsContainer::Pointer targetLandMarkContainer = targetLandMarks-&gt;GetPoints();</div><div>  PointIdType id = itk::NumericTraits&lt; PointIdType &gt;::Zero;</div>
<div>  // Read in the list of landmarks</div><div>  std::ifstream infile;</div><div>  infile.open( argv[1] );</div><div>  while (!infile.eof())</div><div>    {</div><div>    infile &gt;&gt;  p1[0] &gt;&gt; p1[1] &gt;&gt; p2[0] &gt;&gt; p2[1];</div>
<div>    sourceLandMarkContainer-&gt;InsertElement( id, p1 );</div><div>    targetLandMarkContainer-&gt;InsertElement( id++, p2 );</div><div>    }</div><div>  infile.close();</div><div>  TransformType::Pointer tps =
 TransformType::New();</div><div>  tps-&gt;SetSourceLandmarks(sourceLandMarks);</div><div>  tps-&gt;SetTargetLandmarks(targetLandMarks);</div><div>  tps-&gt;ComputeWMatrix();</div><div>  //-------------------------------------------------------------------------------------------------------//</div>
<div><br></div><div>  registration-&gt;SetOptimizer(     optimizer     );</div><div>  registration-&gt;SetTransform(     tps     );</div><div>  registration-&gt;SetInterpolator(  interpolator  );</div><div>  registration-&gt;SetMetric(        metric        );</div>
<div> </div><div>  typedef itk::ImageFileReader&lt; FixedImageType  &gt; FixedImageReaderType;</div><div>  typedef itk::ImageFileReader&lt; MovingImageType &gt;
 MovingImageReaderType;</div><div>  FixedImageReaderType::Pointer  fixedImageReader  = FixedImageReaderType::New();</div><div>  MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();</div><div>  fixedImageReader-&gt;SetFileName(  argv[2] );</div>
<div>  movingImageReader-&gt;SetFileName( argv[3] );</div><div> </div><div>  registration-&gt;SetFixedImage(    fixedImageReader-&gt;GetOutput()    );</div><div>  registration-&gt;SetMovingImage(   movingImageReader-&gt;GetOutput()   );</div>
<div>  fixedImageReader-&gt;Update();</div><div>  registration-&gt;SetFixedImageRegion( fixedImageReader-&gt;GetOutput()-&gt;GetBufferedRegion() );</div><div> </div><div>  typedef RegistrationType::ParametersType ParametersType;</div>
<div>  ParametersType initialParameters(
 tps-&gt;GetNumberOfParameters() );</div><div>  initialParameters = tps-&gt;GetParameters();</div><div>  std::cout &lt;&lt; &quot; TPS Parameters = &quot; &lt;&lt; tps-&gt;GetParameters() &lt;&lt; std::endl;</div><div>  std::cout &lt;&lt; &quot; TPS Parameters = &quot; &lt;&lt; initialParameters &lt;&lt; std::endl;</div>
<div>  registration-&gt;SetInitialTransformParameters( initialParameters );</div><div>  optimizer-&gt;SetNumberOfIterations( 200 );</div><div>  optimizer-&gt;SetRelaxationFactor( 0.9 );</div><div> </div><div>  try</div><div>
    {</div><div>    registration-&gt;StartRegistration();</div><div>    std::cout &lt;&lt; &quot;Optimizer stop condition: &quot;</div><div>              &lt;&lt; registration-&gt;GetOptimizer()-&gt;GetStopConditionDescription()</div>
<div>            
  &lt;&lt; std::endl;</div><div>    }</div><div>  catch( itk::ExceptionObject &amp; err )</div><div>    {</div><div>    std::cout &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl;</div><div>    std::cout &lt;&lt; err &lt;&lt; std::endl;</div>
<div>    return EXIT_FAILURE;</div><div>    }</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: </div>
<div><br></div><div><br></div><div>*********************************************************************************************************</div><div>Location: &quot;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&quot;</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&#39;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&#39;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></tbody></table><br>

      <br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>