[Insight-users] Re: limiting the maximum angle of rotation

Luis Ibanez luis.ibanez at kitware.com
Tue Mar 14 10:01:22 EST 2006


Hi Shankar,


     An angle of 1 radian is HUGE !


          It is 57 degrees.


When you are doing registration you should
be dealing with much smaller rotations, or
you should have a better initialization of
your transform.

Are you sure that your two images need such
a large correction in rotation ?

If no, then what is probably happening is that
the transform maps the moving image very far
from the fixed image, and you are receiving
and exception telling you that the images
do not overlap anymore.

Can you please print out the Transform that is
computed by the CenteredTransformInitializer ?

This is the transform that you are providing
as initial value to the Optimizer.

e.g. add the statement:


       transform->Print( std::cout );


Just before line 354 where we have the method:


       registration->StartRegistration();




Please post to the list the values that you
find for this Transform, before starting the
registration process.



    Thanks


       Luis


---------------------------
shankar venkatesan wrote:
> Hi, 
> I added the LBFGSB  optimizer with the following code to
> ImageRegistraton7.cxx (not much else was changed)
> I am getting zero iterations as in the stdout output from this code, the
> angle is 1 radian, so the image is always rotated by 1 radian.
> I am not sure where I am going wrong.
> 
> Thanks very much for taking the time to answer the query
> SV
> 
> 
> 
> Result =
>  Scale         = 1
>  Angle (radians) 1
>  Angle (degrees) 57.2958
>  Center X      = 19.2766
>  Center Y      = 29.1352
>  Translation X = 0.417629
>  Translation Y = 0.195822
>  Iterations    = 0
>  Metric value  = 0
> 803451888_out_803451888.jpg
> 
> Result =
>  Scale         = 1
>  Angle (radians) 1
>  Angle (degrees) 57.2958
>  Center X      = 19.2766
>  Center Y      = 29.1352
>  Translation X = -0.466514
>  Translation Y = 0.288984
>  Iterations    = 0
>  Metric value  = 0
> 
>  
>   OptimizerType::BoundValueType lower(transform->GetNumberOfParameters());
>   OptimizerType::BoundValueType upper(transform->GetNumberOfParameters());
>   OptimizerType::BoundSelectionType
> select(transform->GetNumberOfParameters());
> 
>   lower.Fill( -5 );
>   upper.Fill( 5 );
>   select.Fill( SpaceDimension );
>   optimizer->SetLowerBound( lower );
>   optimizer->SetUpperBound( upper );
>   optimizer->SetBoundSelection( select );
> 
>   /*
>   typedef OptimizerType::ScalesType       OptimizerScalesType;
>   OptimizerScalesType optimizerScales( transform->GetNumberOfParameters() );
>   const double translationScale = 1.0 / 100.0;
> 
>   optimizerScales[0] = 10.0;
>   optimizerScales[1] =  1.0;
>   optimizerScales[2] =  translationScale;
>   optimizerScales[3] =  translationScale;
>   optimizerScales[4] =  translationScale;
>   optimizerScales[5] =  translationScale;
> 
>   optimizer->SetScales( optimizerScales );
>   */
> 
> //optimizer->SetMaximumStepLength( steplength ); 
>   //optimizer->SetMinimumStepLength( 0.0001 );
>   //optimizer->SetNumberOfIterations( 500 );
>   const double convfactor = 1e+7; 
>   const double tolerance  = 1e-5;
>   optimizer->SetCostFunctionConvergenceFactor(convfactor);
>   optimizer->SetProjectedGradientTolerance(tolerance);
>   optimizer->SetMaximumNumberOfIterations(100);
>   optimizer->SetMaximumNumberOfEvaluations(100);
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
> Sent: Monday, March 13, 2006 7:01 PM
> To: shankar venkatesan
> Cc: Insight Users
> Subject: Re: limiting the maximum angle of rotation
> 
> 
> Hi Shankar,
> 
> You may want to look at the LBFGSB Optimizer:
> 
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1LBFGSBOptimizer.html
> 
> This optimizers supports "bound constrained optimization".
> 
> Another option is to implement this at the level of the Observer
> that you connect to your current optimizer.
> 
> Notice, however, that in practice, if the angle of rotation is
> growing too large, it is probably an indication that the scaling
> that you are using for the transform parameters are not balanced
> correctly.
> 
> 
> You will find details on the settings for scaling the parameters
> passed to the optimizer in the Image Registration chapter of the
> ITK Software Guide:
> 
>        http://www.itk.org/ItkSoftwareGuide.pdf
> 
> 
> Please let us know if you have further questions,
> 
> 
>      Thanks
> 
> 
>         Luis
> 
> 
> -------------------------
> shankar venkatesan wrote:
> 
>>Hi,
>>
>> 
>>
>> I would like to limit the maximum angle of rotation used by, say, 
>>ImageRegistration7. Is there a way to specify this? Thanks
>>
>> 
>>
>>SV
>>
> 
> 
> 
> 
> 



More information about the Insight-users mailing list