[Insight-users] Re: limiting the maximum angle of rotation
Luis Ibanez
luis.ibanez at kitware.com
Tue Mar 21 11:15:44 EST 2006
Hi Shankar,
It is quite difficult to provide examples for all the
possible combinations of the image registration framework
in ITK.
As you probably have noticed, there is a combinatorial
explosion when you look at combining all the possible
Optimizers, Metrics, Interpolators and Transforms.
We apologize for not providing an example for the exact
case you are interested on, but we hope that you will
understand that generating all such combinations is not
a good use of resources for the team that maintains the
toolkit. We have focused on providing examples of key
issues that you confront when using the registration
components in an application.
---
The typical reasons for having a fixed image to map
outside of the fixed image are:;
1) Poor initialization of the Transform
2) Unbalanced values on the parameter scaling
passed to the Optimizer
3) Incorrect setting on the optimizer parameters
In order to help you with your particular problem
we would need you to post the the mailing list the
following information:
1) The output of the Command/Observere that you
connected to the optimizer. This output text
will indicate how fast the transform parameters
are changing at every iteration.
2) The source code of the test that you are running.
This will allow us to see the parameters that you
are passing to the optimizer, as well as the scaling
parameters that you are doing between the transform
and the optimizer.
Please post this information to the list so we can
help you fine tune the parameters of the code for
you particular problem.
Thanks
Luis
--------------------------
Shankar Venkatesan wrote:
> Hi Dr. Ibanez,
>
> Thanks.
>
> BTW, I do not see in the Examples/Registration,
> any example of combining of MutualInformationImageToImageMetric
> and CenteredSimilarity2DTransform (any transform with a
> rotation will do). When I modified an example (IR7) to do that,
> after a couple of iterations, I get the image points mapped to outside
> of moving image ERROR.
>
> Are there good examples anywhere of this combination of metric
> and transform so I can use it off the shelf?
>
> Thanks in advance
> Shankar
>
> On Tuesday 14 March 2006 20:31, you wrote:
>
>>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