[Insight-users] changing components in iteration of itkMultiResolutionImageRegistrationMethod

Luis Ibanez luis.ibanez at kitware.com
Sat Oct 28 12:52:05 EDT 2006


Hi Dan,


When you switch transform, you must also change the number
of elements in the scaling-parameter array.


     In your case, you have

        1) Translation2D -----> 2 parameters
        2) Affine2D      -----> 6 parameters



and you pass to the optimizer the scaling array that permits to
balance the irregularity in measurement unit between translations
and rotations.



Please read the Image Registration chapter of the ITK Software Guide

      http://www.itk.org/ItkSoftwareGuide.pdf

in particular the section on Multi-Resolution registration.



You should also look at the code of the file

       Insight/Examples/Registration/
            MultiResImageRegistration2.cxx

in particular to lines 325-333, and 379:


// This is for the Affine transform

   OptimizerScalesType optimizerScales(
      transform->GetNumberOfParameters() );

   optimizerScales[0] = 1.0; // scale for M11
   optimizerScales[1] = 1.0; // scale for M12
   optimizerScales[2] = 1.0; // scale for M21
   optimizerScales[3] = 1.0; // scale for M22

   optimizerScales[4] = 1.0 / 1000000.0; // scale for translation on X
   optimizerScales[5] = 1.0 / 1000000.0; // scale for translation on Y

   optimizer->SetScales( optimizerScales );



Note that the numbers for the translations X and Y depend on
the spacing and number of pixels of your image.  The Image
Registration chapter give you guidance on how to compute
reasonable values for these scales.



   Regards,


      Luis




---------------
Dan Rizzo wrote:
> Hello
> 
> I am trying to register two 2D images with some offset and rotation.
> 
> Section 8.7.1 of the Software Guide shows how to change parameters for 
> the Optimizer in between iterations of the multi resolution registration 
> framework.  It also mentions that you could even swap out components 
> between levels.  This is where I'm having trouble.
> 
> I'd like the first resolution registration to perform the Translation 
> transform, and the second to do an Affine transform.  The idea here is 
> to use a Gradient Descent optimizer for each, and the 
> MeanSquaresImageToImageMetric for both as well.   Later I should be able 
> to switch these components in between resolutions as well.  I was 
> planning on trying Mattes MI with a OnePlusOne for the first stage.
> 
> Is there some pattern I need to follow in my Command Observer class to 
> switch components?  I have gone ahead and set the registration's 
> transform to the new object using SetTransform().  I created a new 
> Optimizer and set the parameters accordingly.  I tried then calling 
> Update() on the registration.
> 
> When the program gets to the second resolution, I get the error message 
> "The size of Scales is 6, but the NumberOfParameters for the 
> CostFunction is 2." coming out of the 
> RegularStepGradientDescentOptimizer.  The first level had only 2 
> parameters as the transform was a translation, and the second had 6 for 
> affine.
> 
> Is there an example somewhere which actually does switch components in 
> between resolutions, or does anyone know what I'm doing / not doing?
> 
> Thanks in advance!
> 
> Dan
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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