Hi Motes,<br><br><br>The code in <br><br><br> Insight/Examples/Registration/<br> MeanSquaresImageMetric1.cxx<br><br>is not intended to be a "Registration" example.<br><br><br>Instead, <br>the purpose is to show you what the Optimizer sees.<br>
<br>That is, <br>to show you the look of the CostFunction.<br><br><br>In general it is a good exercise to become familiar with the <br>aspect of the Cost Function surface, since that helps you<br>make a judicious choice of a proper Optimizer.<br>
<br>When you plot the Metric values as a surface in the<br>domain of 50x50 that gives you an idea of the type<br>of space that Optimizer will be walking (or wondering)<br>around.<br><br><br>A real Optimizer will not compute the value of the Metric<br>
in all this 50x 50 nodes, that will be too expensive.<br>Instead, an Optimizer will try to chose a clever path that<br>drive it towards an optimum value of the metric (for that<br>domain).<br><br><br>A gradient descent optimizer will follow the direction<br>
of the gradient at every point of the Cost Function<br>(the ImageMetric). You will see many of these plots<br>in the ITK Software Guide, in the "Image Registration"<br>chapter.<br><br><br>The choice of 50x50 was purely arbitrary, based on<br>
the fact that the ITK Software Guide illustrate this<br>example with images that are 186 x 217 pixels, <br>and spacing of 1.0, 1.0, so the extent that we are<br>exploring is about one quarter of the image.<br><br><br>So....<br>
This is a "teaching" example.<br><br><br>Something that you still may want to do with <br>two real images that you may be registering,<br>since it will show you, for example, how noisy<br>the Cost Function (the ImageMetric) is, and<br>
how many local minima may be... <br><br>Note that in practice this is very hard to do for<br>anything different than a TranslationTransform,<br>given that we can only plot 2D surfaces,... <br><br>If you were working with an Affine transform, <br>
you would haveto figure out how to plot a <br>CostFunction in a parametric space of <br>12 dimensions. :-/<br><br><br> Regards,<br><br><br> Luis<br><br><br><br>-----------------------------------------------------------<br>
<div class="gmail_quote">On Wed, Jul 1, 2009 at 5:46 PM, motes motes <span dir="ltr"><<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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?<br><br>Another thing, why 50*50? Does these values correspond to milimiters or some other unit? Could not find any documentation for this.<div>
<div></div><div class="h5"><br>
<br><br><br><div class="gmail_quote">On Wed, Jul 1, 2009 at 10:32 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi Motes,<br><br><br> Yes, you got it all right !<br><br><br>This example is evaluating the Metric between<br>one image and different translations of itself.<br><br>You should find that the lowest metric value <br>
correspond to the displacement (0,0).<br><br>The purpose of the exercise is to visualize<br>the cost function (the Image Metric) for <br>values in a grid of 50 x 50 positions in the<br>parametric space.<br><br>That's the kind of space that the Optimizers<br>
will have to navigate.<br><br><br> Regards,<br><br><br> Luis<br><br><br>--------------------------------------------------------<br><div class="gmail_quote"><div><div></div><div>On Wed, Jul 1, 2009 at 4:27 PM, motes motes <span dir="ltr"><<a href="mailto:mort.motes@gmail.com" target="_blank">mort.motes@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>I am trying the metric example in the itkSoftwareGuide page 416. This is what I understand so far:<br>
<br>The following components are connected to the SSD metric:<br><br>- Transform (translation)<br>- Interpolator (nearest neighbor)<br>
- The fixed and moving images, in the example they are identical.<br><br>Next the moving image is translated and for each translation the metric is computed:<br><br> const int rangex = 50;<br> const int rangey = 50;<br>
for(int dx = -rangex; dx <= rangex; dx++){<br> for(int dy = -rangey; dy <= rangey; dy++){<br> displacement[0] = dx;<br> displacement[1] = dy;<br> const double value = metric->GetValue(displacement);<br>
out << dx << " " << dy << " " << value << std::endl;<br> }<br> }<br><br>As I understand the call:<br><br> metric->GetValue(displacement);<br>
<br>evaluates the metric for transform parameters contained in the displacement vector using the underlying connected transform.<br><br>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.<br>
<br>To put it another way: The fixed image is compared to 50*50 translated versions of it self. <br><br>Am I on the right track?<br>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>