[Insight-users] Strange problems with multiresolution registration

Patrik.Br. patrik.brynolfsson at gmail.com
Fri Jul 17 07:54:44 EDT 2009


Hello all,

I have some problems implementing a multiresolution registration. My plan is
to change transform from TranslationTransform to CenteredRigid2DTransform
between levels, but I run into some problems.

I'm using MultiResImageRegistration1.cxx as a start, and have added a few
lines of code to change the transform. This is the only thing I have changed
or added to the code, and I put it in the RegistrationInterfaceCommand
class, for the last level in the image pyramid.

          typedef itk::Image<unsigned short,2> FixedImageType;
	  typedef itk::Image<unsigned short,2> MovingImageType;
	  typedef itk::CenteredRigid2DTransform<double> TransformType;

	  TransformType::Pointer transform = TransformType::New();

	  FixedImageType::Pointer  fixedImage   =
(FixedImageType*)(registration->GetFixedImage());
	  MovingImageType::Pointer movingImage  =
(MovingImageType*)(registration->GetMovingImage());

	  TransformType::InputPointType centerFixed;
	  TransformType::InputPointType centerMoving;
	  TransformType::TranslationType translation;

	  centerFixed[0] = fixedImage->GetOrigin()[0] +
(fixedImage->GetSpacing()[0])*(fixedImage->GetLargestPossibleRegion().GetSize()[0])/2.0;
	  centerFixed[1] = fixedImage->GetOrigin()[1] +
(fixedImage->GetSpacing()[1])*(fixedImage->GetLargestPossibleRegion().GetSize()[1])/2.0;
	  centerMoving[0] = movingImage->GetOrigin()[0] +
(movingImage->GetSpacing()[0])*(movingImage->GetLargestPossibleRegion().GetSize()[0])/2.0;
	  centerMoving[1] = movingImage->GetOrigin()[1] +
(movingImage->GetSpacing()[1])*(movingImage->GetLargestPossibleRegion().GetSize()[1])/2.0;
	  translation[0] =
registration->GetInitialTransformParametersOfNextLevel()[0];
	  translation[1] =
registration->GetInitialTransformParametersOfNextLevel()[1];

	  transform->SetCenter( centerFixed );
	  transform->SetTranslation( translation );
	  transform->SetAngle( 0.0 );
	  
	  registration->SetTransform( transform );
	  registration->SetInitialTransformParameters( transform->GetParameters()
);

	  OptimizerType::ScalesType optimizerScales(
transform->GetNumberOfParameters() );
	  const double translationScale = 1.0 / 1000.0;
	  
	  optimizerScales[0] = 1.0;
	  optimizerScales[1] = translationScale;
	  optimizerScales[2] = translationScale;
	  optimizerScales[3] = translationScale;
	  optimizerScales[4] = translationScale;

	  optimizer->SetScales( optimizerScales );

Here comes the strange part. 

If I compile in Debug mode, I get this error:
Line 1110
Description: itk::ERROR:
MattesMutualInformationImageToImageMetric(019B9BF0): Too many samples map
outside moving image buffer: 0 / 50000

BUT 
if I compile in Release mode, I get this error:

Line 188
Description: itk:ERROR: RegularStepGradientOptimizer(014A1C60): The size of
Scales is 5, but the NumberOfParameters for the CostFunction is 2.

I'm using MS Visual C++ 2008. What is going on here? Can anyone help me? If
someone has a working code for changing components between levels I would be
very happy if you want to share them!

Thanks in advance!

//Patrik
-- 
View this message in context: http://www.nabble.com/Strange-problems-with-multiresolution-registration-tp24533070p24533070.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list