[Insight-users] Controlling optimizer search space

Luis Ibanez luis.ibanez at kitware.com
Sat Feb 7 12:18:01 EST 2009


Hi Guillaume,

It seems that you have not set the array of Optimizer scales.

Therefore the optimizer is assuming that the units of rotation
are the same as the units for translation. Which is a great
mistake, given that the rotation is in the order of "radians"
while translations tend to be in the order of "millimeters".

Therefore 1.0 is a HUGE rotation, (because it is measured in
radians), while 1.0 is a rather small translation.

Please use the OptimizerScales array, so that you can tell the
optimizer that there is a difference of two orders of magnitude
between the values used for the rotation matrix and the values
used for the Translational vector.

You will find useful to look at the code in:


      Insight/Examples/Registration/
                 ImageRegistration9.cxx


Lines 288-298:


   typedef OptimizerType::ScalesType       OptimizerScalesType;
   OptimizerScalesType optimizerScales( 
transform->GetNumberOfParameters() );

   optimizerScales[0] =  1.0;
   optimizerScales[1] =  1.0;
   optimizerScales[2] =  1.0;
   optimizerScales[3] =  1.0;
   optimizerScales[4] =  translationScale;
   optimizerScales[5] =  translationScale;

   optimizer->SetScales( optimizerScales );



   Regards,


       Luis


------------------
Poirier, Guillaume wrote:
> 
> Hello,
> 
> I am fairly new to ITK so I apologize in advance for this question...
> 
> I am using an AffineTransform to perform image registration. I know
> for example that the rotation I am looking for will be between -10
> and 10 degrees. For a specific test, it is about one degree.
> 
> I initialize the transform like this:
> 
> // set initial transform matrix to identity and rotation center to image 
> center
> typedef itk::CenteredTransformInitializer< TransformType, 
> FixedImageType, MovingImageType >  TransformInitializerType;
> typename TransformInitializerType::Pointer initializer = 
> TransformInitializerType::New();
> initializer->SetTransform( transform );
> initializer->SetFixedImage( fixedImageReader->GetOutput() );
> initializer->SetMovingImage( movingImageReader->GetOutput() );
> initializer->GeometryOn();
> initializer->InitializeTransform();
> typename RegistrationType::ParametersType initialParameters = 
> transform->GetParameters();
> initialParameters[0] = 1.0;
> initialParameters[1] = 0.0;
> initialParameters[2] = 0.0;
> initialParameters[3] = 1.0;
> registration->SetInitialTransformParameters( initialParameters );
> 
> Now when I run this, the first iteration of the registration process yields:
> 
> Using initial center of rotation: (1751.5, 1167.5)
> Using initial translation: (0, 0)
> Using initial scale 1: 1
> Using initial scale 2: 1
> Using initial angle (degrees): 0
> 
> Registration iterations:
> 0    = -0.6493 : [1.05913, 0.261505, -0.394698, 1.10742, -0.00464574, 
> -0.103787]
>  Affine angle: -16.8505
> 
> Now I wonder why it is -16.8505 degrees initially... I'd like to start 
> at 0 degrees and look
> in a range of -10 to 10. Is there a way to achieve this ?
> 
> Thanks in advance !
> 
> 
> guillaume
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list