[Insight-users] Confused abour Optimizer Scales

Luis Ibanez luis.ibanez at kitware.com
Thu Nov 26 14:34:58 EST 2009


Hi Auron,


The class

         itkCenteredRigid2DTransform

has five parameters, that are:

       1) Angle
       2) Center of Rotation (X coordinate)
       3) Center of Rotation (X coordinate)
       4) Translation (X coordinate)
       5) Translation (Y coordinate)

Several things are wrong with the current optimizer scales:

>   optimizerScales[0] = -1.0; // If I don´t use a negative value, the results
> turn negative.
>   optimizerScales[1] = 1.0;  // My center of rotation is the center of the
> image and I don´t want it to vary.
>   optimizerScales[2] = 1.0;
>   optimizerScales[3] = translationScale;
>   optimizerScales[4] = translationScale;


A) the first one should NOT be negative.
     Something else is going on with the orientation of your image.
     but...  in any case, the optimizer scales should NEVER be negative.

B) The second and third values correspond to the center of rotation,
     but you don't want to change this center.  My suggestion will be
     to put in here, very small numbers. For example  1e-6.


Also, since you don't want to modify the rotation center,
 you may want to simply not use this Transform, and instead
use the class
                             itkRigid2DTransform.h

that also offers a Center of rotation, but does not include it
as part of the parameters to be optimized.


Finally,
Thanks for adding the screenshots of your images.

      Are they really the Fixed image and Moving image ?

If so,
please note that there NO WAY that the  registration process
could  compensate for their current rotation of 90 degrees    :-)

You have to give it a hand at the registration process and initialize
that angle with PI / 2.    Otherwise, The Optimizer simply will not walk
that far in the space of the Transform parameters. Usually a registration
process will be able to deal with rotations below 20 degrees. (unless,
of course, you really customize them for a large rotation setting).



       Regards,


                Luis



-----------------------------------------------------------------------------------------------
On Thu, Nov 26, 2009 at 12:46 PM, Auron Ford Huton <auron at hotmail.es> wrote:
>
> Hi Luis,
> Thank you very much for your efforts trying to explain it to me.
> I tried what you said but I still does not get good results.
>
> First of all, I computed my ratio. The rotation is about 0.9 radians, and my
> image size is 5660x5660 micrometers (2000x2000 pixels with 2.83 as pixel
> spacing).
> So, I used the ratio 1.14:5560 (1:5000) for the thumb rule you explained, so
> I used the following OptimizerScales:
>   const double translationScale = 1.0 / 5000.0;
>   optimizerScales[0] = -1.0; // If I don´t use a negative value, the results
> turn negative.
>   optimizerScales[1] = 1.0;  // My center of rotation is the center of the
> image and I don´t want it to vary.
>   optimizerScales[2] = 1.0;
>   optimizerScales[3] = translationScale;
>   optimizerScales[4] = translationScale;
> But I get strange results after the registration. I find it strange because
> if I used the following line:
> initializer->MomentsOn();
> the result of my registration is far from the optimum rotation and near to
> the optimum translation, but if I used the following instead:
> initializer->GeometryOn();
> the result of my registration is near to the optimum rotation and far from
> the optimum translation.
> So... what can I do? I don´t really understand why I got those results...
> The code I used is the one you can find in ImageRegistration6o.cxx but with
> the modifications mentioned above and applying the center of the image as
> the center of rotation.
> I attach a screenshot of my images, the one on the left is the fixed an the
> one on the right is the moving (just in case it could help...).
>
> Thank you in advance.
> Auron.
>
>> Date: Sun, 22 Nov 2009 14:03:44 -0500
>> Subject: Re: [Insight-users] Confused abour Optimizer Scales
>> From: luis.ibanez at kitware.com
>> To: auron at hotmail.es
>> CC: insight-users at itk.org
>>
>> Hi Auron,
>>
>>
>> Your interpretation of the Optimizer Scales is correct.
>>
>> In practice we mostly use them in order to normalize the
>> dynamic range of rotation units with respect to translation units.
>>
>> Rotation tends to be expressed in Radians,
>> while, Translation tends to be expressed in Millimeters.
>>
>> The ratio between the optimizer scales of Transform parameters
>> associated with rotation, and the Transform parameters associated
>> with translation should match your expected proportion between
>> rotation and translation.
>>
>> A typical rule of thumb is to assume that rotating by 0.57 radians,
>> (45 degrees) is as dramatic as translating by half the image length.
>> Therefore, you want to compute the length of your image in millimeters
>> and compute its ratio to the 0.57 radians.
>>
>> For the typical case of a CT scan, you may expect that a patient may
>> rotate by less than 10 degrees ( 0.17 radians), and the image length
>> is typically 512 pixels x 0.5mm/pixel = 256 millimeters.
>>
>> Therefore the ratio that you want to use is : 0.57 : 256
>> which is about 1:500.
>>
>> In the numeric example of your email, the ratio is 1:1000,
>> which is close enough...
>>
>> Also,
>> In your email, you mention micrometers, which led us to suspect
>> that you may be working with Microscopy images.
>>
>> In that case, the exercise is the same, except that you use
>> micrometers as the units of spacing.
>>
>> Therefore, compute the length of one side of your image in
>> microns, and compute the ratio of that amount with respect
>> to 0.57 radians.
>>
>>
>> Regards,
>>
>>
>> Luis
>>
>>
>>
>>
>> ------------------------------------------------------------------------------------------------------
>> On Mon, Nov 16, 2009 at 3:28 AM, Auron Ford Huton <auron at hotmail.es>
>> wrote:
>> > Hi ITK!!
>> >
>> > First of all, thak you all for answering me about my doubts regarding
>> > pixel
>> > spacing.
>> >
>> >
>> > Now I´m a bit confused about what exactly means the Optimizer Scales. I
>> > think, for what I coul read, that the optimizer scales are used to
>> > compensate the difference between the units of the rotation and the
>> > units of
>> > the translation, it´s that ok??
>> >
>> > I´m using a itkCenteredRigid2DTransform with a
>> > itkRegularStepGradientDescentOptimizer and my pixel spacing is about
>> > 2.83
>> > micrometres.
>> >
>> > Then, if I´m using the followin optimizer scale:
>> >
>> >   optimizerScales[0] = 1.0;
>> >   optimizerScales[1] = 1.0;
>> >   optimizerScales[2] = 1.0;
>> >   optimizerScales[3] = 1.0/1000.0;
>> >   optimizerScales[4] = 1.0/1000.0;
>> >
>> > what is the real relation between the angle and the translation??? I
>> > mean,
>> > for each rotation of 1.57 rad, how many micrometers my translation will
>> > move??
>> >
>> >
>> > Thank you in advance.
>> >
>> > Auron.
>> >
>> > _____________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Kitware offers ITK Training Courses, for more information visit:
>> > http://www.kitware.com/products/protraining.html
>> >
>> > Please keep messages on-topic and check the ITK FAQ at:
>> > http://www.itk.org/Wiki/ITK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.itk.org/mailman/listinfo/insight-users
>> >


More information about the Insight-users mailing list