<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 unsigned int Dimension = 2;</div><div> typedef short PixelType;</div><div> </div><div> typedef itk::Image< PixelType, Dimension > FixedImageType;</div><div> typedef itk::Image< PixelType, Dimension > MovingImageType;</div><div> typedef double CoordinateRepType;</div><div> typedef itk::ThinPlateSplineKernelTransform< CoordinateRepType, Dimension>
TransformType;</div><div> typedef itk::ImageRegistrationMethod< FixedImageType, MovingImageType > RegistrationType;</div><div> typedef itk::Point< CoordinateRepType, Dimension > 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< FixedImageType, MovingImageType > MetricType;</div><div> typedef itk:: LinearInterpolateImageFunction< MovingImageType, double> 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->GetPoints();</div><div> PointSetType::PointsContainer::Pointer targetLandMarkContainer = targetLandMarks->GetPoints();</div><div> PointIdType id = itk::NumericTraits< PointIdType >::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 >> p1[0] >> p1[1] >> p2[0] >> p2[1];</div><div> sourceLandMarkContainer->InsertElement( id, p1 );</div><div> targetLandMarkContainer->InsertElement( id++, p2 );</div><div> }</div><div> infile.close();</div><div> TransformType::Pointer tps =
TransformType::New();</div><div> tps->SetSourceLandmarks(sourceLandMarks);</div><div> tps->SetTargetLandmarks(targetLandMarks);</div><div> tps->ComputeWMatrix();</div><div> //-------------------------------------------------------------------------------------------------------//</div><div><br></div><div> registration->SetOptimizer( optimizer );</div><div> registration->SetTransform( tps );</div><div> registration->SetInterpolator( interpolator );</div><div> registration->SetMetric( metric );</div><div> </div><div> typedef itk::ImageFileReader< FixedImageType > FixedImageReaderType;</div><div> typedef itk::ImageFileReader< MovingImageType >
MovingImageReaderType;</div><div> FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New();</div><div> MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();</div><div> fixedImageReader->SetFileName( argv[2] );</div><div> movingImageReader->SetFileName( argv[3] );</div><div> </div><div> registration->SetFixedImage( fixedImageReader->GetOutput() );</div><div> registration->SetMovingImage( movingImageReader->GetOutput() );</div><div> fixedImageReader->Update();</div><div> registration->SetFixedImageRegion( fixedImageReader->GetOutput()->GetBufferedRegion() );</div><div> </div><div> typedef RegistrationType::ParametersType ParametersType;</div><div> ParametersType initialParameters(
tps->GetNumberOfParameters() );</div><div> initialParameters = tps->GetParameters();</div><div> std::cout << " TPS Parameters = " << tps->GetParameters() << std::endl;</div><div> std::cout << " TPS Parameters = " << initialParameters << std::endl;</div><div> registration->SetInitialTransformParameters( initialParameters );</div><div> optimizer->SetNumberOfIterations( 200 );</div><div> optimizer->SetRelaxationFactor( 0.9 );</div><div> </div><div> try</div><div> {</div><div> registration->StartRegistration();</div><div> std::cout << "Optimizer stop condition: "</div><div> << registration->GetOptimizer()->GetStopConditionDescription()</div><div>
<< std::endl;</div><div> }</div><div> catch( itk::ExceptionObject & err )</div><div> {</div><div> std::cout << "ExceptionObject caught !" << std::endl;</div><div> std::cout << err << 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: "const class itk::Array2D<double>
&__thiscall itk::KernelTransform<double,2>::GetJacobian(const class itk::Point<double,2> &) 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>