[Insight-users] Re: StartRegistration failed

Luis Ibanez luis.ibanez at kitware.com
Tue, 13 Jan 2004 09:01:23 -0500


Hi Valli,

It looks like the RTTI is not enabled in your project.

That's probably the same reason why your ResampleImageFilter is
not working. Enabling RTTI is required for the dynamic_cast<>
to work properly.

If you were using CMake for configuring your project, RTTI
will be enabled automatically and you wouldn't be having this
problem.


What platform are you using ?
What compiler are you using ?
How did you configured this project ?


Regards,


    Luis



--------------------------
valli gummadi wrote:

>  Dear Mr.Luis,
> 
>           I am working on the registration application. My application is failing at the StartRegistration() function. When I trace the code i found that it is failing at the metric initialization.
> 
> In MattesMutualinformation class at the following line:
> 
> BSplineInterpolatorType * testPtr = dynamic_cast<BSplineInterpolatorType *>(
>     m_Interpolator.GetPointer() );
> 
> Enclosing the code:
> typedef   float    InternalPixelType;
> typedef itk::CenteredAffineTransform< double, Dimension > TransformType;
> typedef itk::RegularStepGradientDescentOptimizer       OptimizerType;
> typedef itk::MattesMutualInformationImageToImageMetric< 		  InternalImageType, InternalImageType >    MetricType;
> typedef itk:: LinearInterpolateImageFunction< InternalImageType,
> 			double>    InterpolatorType;	typedef itk::ImageRegistrationMethod< InternalImageType, InternalImageType >   RegistrationType;
> typedef itk::CenteredTransformInitializer< TransformType,           FixedImageType,MovingImageType >  TransformInitializerType;
> 
> InterpolatorType::Pointer   interpolator  = InterpolatorType::New();
> interpolator->SetInputImage( movingCaster->GetOutput());
> registration->SetInterpolator(  interpolator  );
> 
> MetricType::Pointer         metric        = MetricType::New();
> metric->SetNumberOfHistogramBins(  50);
> metric->SetNumberOfSpatialSamples(1000 );
> registration->SetMetric(        metric        );
> 
> typedef OptimizerType::ScalesType       OptimizerScalesType;
> OptimizerType::Pointer      optimizer     = OptimizerType::New();
> OptimizerScalesType optimizerScales( NoofParams );
> const double translationScale = 1.0 / 1000000;
> for( int i = 0; i <= 8; i++ )
> 	optimizerScales[ i ] =  1.0 / 1.0;//m_scales;
> optimizerScales[ 9 ]  =  translationScale;
> optimizerScales[ 10 ] =  translationScale;
> optimizerScales[ 11 ] =  translationScale;
> optimizerScales[ 12 ] =  translationScale;
> optimizerScales[ 13 ] =  translationScale;
> optimizerScales[ 14 ] =  translationScale;
> optimizer->SetScales( optimizerScales );
> optimizer->SetMaximumStepLength( 4); 
> optimizer->SetMinimumStepLength( 0.001 );
> optimizer->SetNumberOfIterations( 100 ); 
> optimizer->SetMinimize( TRUE );	
> registration->SetOptimizer(     optimizer     );
> 
> TransformType::Pointer      transform     = TransformType::New();
> transform->SetIdentity();
> NoofParams = transform->GetNumberOfParameters();
> registration->SetInitialTransformParameters( transform->GetParameters() );
> registration->SetTransform(     transform     );
> 
> try 
> { 
> 	registration->StartRegistration(); 
> } 
> catch( itk::ExceptionObject & err ) 
> { 
> 	AfxMessageBox( err.GetDescription() );
> 	return false;
> } 
> 
>  
> 
> 
> Please help me in solving the problem.I had very urgent requirement for this.
> 
> Thanking you
> Regards,
> SriValli.
> 
>