[Insight-users] Basic question concerning metric
Luis Ibanez
luis.ibanez at kitware.com
Wed Jul 1 18:26:13 EDT 2009
Hi Motes,
The code in
Insight/Examples/Registration/
MeanSquaresImageMetric1.cxx
is not intended to be a "Registration" example.
Instead,
the purpose is to show you what the Optimizer sees.
That is,
to show you the look of the CostFunction.
In general it is a good exercise to become familiar with the
aspect of the Cost Function surface, since that helps you
make a judicious choice of a proper Optimizer.
When you plot the Metric values as a surface in the
domain of 50x50 that gives you an idea of the type
of space that Optimizer will be walking (or wondering)
around.
A real Optimizer will not compute the value of the Metric
in all this 50x 50 nodes, that will be too expensive.
Instead, an Optimizer will try to chose a clever path that
drive it towards an optimum value of the metric (for that
domain).
A gradient descent optimizer will follow the direction
of the gradient at every point of the Cost Function
(the ImageMetric). You will see many of these plots
in the ITK Software Guide, in the "Image Registration"
chapter.
The choice of 50x50 was purely arbitrary, based on
the fact that the ITK Software Guide illustrate this
example with images that are 186 x 217 pixels,
and spacing of 1.0, 1.0, so the extent that we are
exploring is about one quarter of the image.
So....
This is a "teaching" example.
Something that you still may want to do with
two real images that you may be registering,
since it will show you, for example, how noisy
the Cost Function (the ImageMetric) is, and
how many local minima may be...
Note that in practice this is very hard to do for
anything different than a TranslationTransform,
given that we can only plot 2D surfaces,...
If you were working with an Affine transform,
you would haveto figure out how to plot a
CostFunction in a parametric space of
12 dimensions. :-/
Regards,
Luis
-----------------------------------------------------------
On Wed, Jul 1, 2009 at 5:46 PM, motes motes <mort.motes at gmail.com> wrote:
> Ok so instead of using eg. gradient descent to estimate the transform
> parameters for the displacement vector, "hardcoded" parameters are used
> corresponding to the dx, dy values, right?
>
> Another thing, why 50*50? Does these values correspond to milimiters or
> some other unit? Could not find any documentation for this.
>
>
>
>
> On Wed, Jul 1, 2009 at 10:32 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:
>
>>
>> Hi Motes,
>>
>>
>> Yes, you got it all right !
>>
>>
>> This example is evaluating the Metric between
>> one image and different translations of itself.
>>
>> You should find that the lowest metric value
>> correspond to the displacement (0,0).
>>
>> The purpose of the exercise is to visualize
>> the cost function (the Image Metric) for
>> values in a grid of 50 x 50 positions in the
>> parametric space.
>>
>> That's the kind of space that the Optimizers
>> will have to navigate.
>>
>>
>> Regards,
>>
>>
>> Luis
>>
>>
>> --------------------------------------------------------
>> On Wed, Jul 1, 2009 at 4:27 PM, motes motes <mort.motes at gmail.com> wrote:
>>
>>> I am trying the metric example in the itkSoftwareGuide page 416. This is
>>> what I understand so far:
>>>
>>> The following components are connected to the SSD metric:
>>>
>>> - Transform (translation)
>>> - Interpolator (nearest neighbor)
>>> - The fixed and moving images, in the example they are identical.
>>>
>>> Next the moving image is translated and for each translation the metric
>>> is computed:
>>>
>>> const int rangex = 50;
>>> const int rangey = 50;
>>> for(int dx = -rangex; dx <= rangex; dx++){
>>> for(int dy = -rangey; dy <= rangey; dy++){
>>> displacement[0] = dx;
>>> displacement[1] = dy;
>>> const double value = metric->GetValue(displacement);
>>> out << dx << " " << dy << " " << value << std::endl;
>>> }
>>> }
>>>
>>> As I understand the call:
>>>
>>> metric->GetValue(displacement);
>>>
>>> evaluates the metric for transform parameters contained in the
>>> displacement vector using the underlying connected transform.
>>>
>>> Eg when dx=dy=50 we are actually testing how good the transform that
>>> translates all pixels 50 units along the x and y axis aligns with the fixed
>>> image - which is not very good. The optimal solution is a transform that
>>> translates all pixels 0 units along the x and y axis which makes sense since
>>> the two images are identical.
>>>
>>> To put it another way: The fixed image is compared to 50*50 translated
>>> versions of it self.
>>>
>>> Am I on the right track?
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.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
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090701/accc3e33/attachment.htm>
More information about the Insight-users
mailing list