<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<BR>Hi Bill,<BR>
&nbsp;<BR>
The optimum value for the metric that I spect is about 2000, and I normally get a metric of&nbsp;4000.<BR>
&nbsp;<BR>
I will try just now to set:<BR>
&nbsp;<BR>
optimizer-&gt;SetMaximumStepLength( 0.1 );<BR>
&nbsp;<BR>
and I´ll let you know the results in a while.<BR>
&nbsp;<BR>
Thanks!<BR>
&nbsp;<BR>
Manuel.<BR>
&nbsp;<BR>&gt; Date: Thu, 22 Oct 2009 11:52:23 -0400<BR>&gt; Subject: Re: [Insight-users] Problem with 2D Registration (local minima)<BR>&gt; From: bill.lorensen@gmail.com<BR>&gt; To: manueldavid.tabas@hotmail.es<BR>&gt; CC: insight-users@itk.org<BR>&gt; <BR>&gt; The optimizer is stopping after reaching the maximum number of<BR>&gt; iterations. This is normally not the best way to terminate an<BR>&gt; optimization.<BR>&gt; <BR>&gt; What do you expect for the optimum value of the parameters?<BR>&gt; <BR>&gt; Perhaps you need a larger maximum step length? Or perhaps, as Luis<BR>&gt; suggested, the starting point is too far from the optimum for this<BR>&gt; optimizer.<BR>&gt; <BR>&gt; Bill<BR>&gt; <BR>&gt; <BR>&gt; On Thu, Oct 22, 2009 at 10:09 AM, Manuel David Tabas Calle<BR>&gt; &lt;manueldavid.tabas@hotmail.es&gt; wrote:<BR>&gt; &gt;<BR>&gt; &gt; Hi Luis,<BR>&gt; &gt;<BR>&gt; &gt; Thank you for answering me.<BR>&gt; &gt;<BR>&gt; &gt; 1) As you said, my images are from Microscopy and the spacing is about 2.85<BR>&gt; &gt; micrometres/pixel. The images are in a raw format and I used the following<BR>&gt; &gt; .mhd file&nbsp;for reading it:<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; &nbsp;&nbsp;&nbsp; NDims = 2<BR>&gt; &gt; &nbsp;&nbsp;&nbsp; DimSize = 2000 2000<BR>&gt; &gt; &nbsp;&nbsp;&nbsp; ElementType = MET_UCHAR<BR>&gt; &gt; &nbsp;&nbsp;&nbsp; ElementSpacing = 1.0 1.0<BR>&gt; &gt; &nbsp;&nbsp;&nbsp; Offset = 0.0 0.0<BR>&gt; &gt; &nbsp;&nbsp;&nbsp; ElementByteOrderMSB = False<BR>&gt; &gt; &nbsp;&nbsp;&nbsp; ElementDataFile = fixed.raw<BR>&gt; &gt;<BR>&gt; &gt; I also tried to as ElementSpacing 2.83 and 0.00283 (just in case...) but the<BR>&gt; &gt; results weren´t good either.<BR>&gt; &gt;<BR>&gt; &gt; 2) I also try to put a relaxation factor of 0.9&nbsp;as you said and I couldn´t<BR>&gt; &gt; see any improvement.<BR>&gt; &gt;<BR>&gt; &gt; 3)&nbsp; I´m attaching three .txt files with some results obtained.<BR>&gt; &gt; The results1.txt file shows the output of the program as you can find it on<BR>&gt; &gt; ITK/Examples/Registration/.<BR>&gt; &gt; The results2.txt file&nbsp;shows the output of the program with a predifined<BR>&gt; &gt; center in the position 1000x1000. The results3.txt file&nbsp;shows the output of<BR>&gt; &gt; the program with a predifined center in the position 1000x1000, a predefined<BR>&gt; &gt; angle of 0.9 radians and a predefined traslation of -340 in the X axis and<BR>&gt; &gt; 800 in the Y axis (that are the values for an optimal registration).<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; I hope you can help me to fix my problem with that information... an be free<BR>&gt; &gt; to ask anything else :P.<BR>&gt; &gt;<BR>&gt; &gt; Thank you really much.<BR>&gt; &gt;<BR>&gt; &gt; Manuel.<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;&gt; Date: Wed, 21 Oct 2009 17:29:08 -0400<BR>&gt; &gt;&gt; Subject: Re: [Insight-users] Problem with 2D Registration (local minima)<BR>&gt; &gt;&gt; From: luis.ibanez@kitware.com<BR>&gt; &gt;&gt; To: manueldavid.tabas@hotmail.es<BR>&gt; &gt;&gt; CC: insight-users@itk.org<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Hi Manuel,<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Thanks for the detailed description of your problem.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; A couple of questions:<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; 1) What is the pixel spacing of your image ?<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; The typical proportion of :<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; &gt; const double translationScale = 1.0 / 1000.0;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; is set up for images whose physical extent in<BR>&gt; &gt;&gt; the units used by the spacing is in the range<BR>&gt; &gt;&gt; of hundreds.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; For example, a typical CT scan will have 512x512<BR>&gt; &gt;&gt; pixels with a spacing close to 1mm / pixel.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Your images are probably from Microscopy or<BR>&gt; &gt;&gt; from a Satellite, so I'm wondering about the units<BR>&gt; &gt;&gt; that you use (microns or kilometers) and the<BR>&gt; &gt;&gt; exact numeric values of the spacing.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; 2) Could you post to the list the output of the<BR>&gt; &gt;&gt; command observer that tracks the values of<BR>&gt; &gt;&gt; the metric and the transform at every iteration ?<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Something that happens often when using the<BR>&gt; &gt;&gt; RegularStepGradientDescentOptimizer is that,<BR>&gt; &gt;&gt; if the registration process have a couple of<BR>&gt; &gt;&gt; bounces of direction in the parametric space,<BR>&gt; &gt;&gt; the step length may be reduced too fast, and<BR>&gt; &gt;&gt; not give the optimizer the oportunity to walk<BR>&gt; &gt;&gt; far enough to get to the solution.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; You may want to try using the method:<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; optimizer-&gt;SetRelaxationFactor( 0.9 );<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; This method defines the factor by which the<BR>&gt; &gt;&gt; step length is reduced at every time that the<BR>&gt; &gt;&gt; parametric space step changes direction.<BR>&gt; &gt;&gt; This may prevent the premature shrinkage<BR>&gt; &gt;&gt; of the step length (assuming that this is the<BR>&gt; &gt;&gt; real problem).<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Anothe typical issue: It may simply be that you<BR>&gt; &gt;&gt; need a better initialization for your images.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Note that the Transform initializer in the example:<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; ImageRegistration6.cxx<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; is using the methods MomentsOn().<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; This may or may not be the right method to use,<BR>&gt; &gt;&gt; depending on the content of your images.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; For example: If the two images have different<BR>&gt; &gt;&gt; modalities, or if the main features of one image<BR>&gt; &gt;&gt; may not overlap to the one in the other image.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; If you could post a screenshot of both images<BR>&gt; &gt;&gt; we could avoid all this speculation... :-)<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Or...<BR>&gt; &gt;&gt; If you can share your images in a public web<BR>&gt; &gt;&gt; site, that will be even better.<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Thanks<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; Luis<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt;<BR>&gt; &gt;&gt; ----------------------------------------------------------------<BR>&gt; &gt;&gt; On Wed, Oct 21, 2009 at 11:56 AM, Manuel David Tabas Calle<BR>&gt; &gt;&gt; &lt;manueldavid.tabas@hotmail.es&gt; wrote:<BR>&gt; &gt;&gt; &gt; Hello ITK,<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; I´m working with ITK to do registration of 2D images and I think I reach<BR>&gt; &gt;&gt; &gt; a<BR>&gt; &gt;&gt; &gt; local minima that makes a poor registration.<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; I´m using 2D images 2000x2000 pixels in what the moving image needs a<BR>&gt; &gt;&gt; &gt; rotation and a translation. So I reproduced the ImageRegistration6.cxx<BR>&gt; &gt;&gt; &gt; to do<BR>&gt; &gt;&gt; &gt; that. But the result I got is not good enough so I think that the<BR>&gt; &gt;&gt; &gt; MeanSquares metric reaches a local minima. The value of the metric is<BR>&gt; &gt;&gt; &gt; about<BR>&gt; &gt;&gt; &gt; 4000 (aprox.), and I run a test using as input parameters the optimal<BR>&gt; &gt;&gt; &gt; ones<BR>&gt; &gt;&gt; &gt; (that is, the result I think i should obtain)&nbsp;and the metric returns a<BR>&gt; &gt;&gt; &gt; value<BR>&gt; &gt;&gt; &gt; of 2500 (aprox.).<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; The framework I use is:<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; &nbsp;&nbsp; itkImageRegistrationMethod<BR>&gt; &gt;&gt; &gt; &nbsp;&nbsp; itkMeanSquaresImageToImageMetric<BR>&gt; &gt;&gt; &gt; &nbsp;&nbsp; itkLinearInterpolateImageFunction<BR>&gt; &gt;&gt; &gt; &nbsp;&nbsp; itkRegularStepGradientDescentOptimizer<BR>&gt; &gt;&gt; &gt; &nbsp;&nbsp; itkCenteredRigid2DTransform<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; And the parameters of my registration are:<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; const double translationScale = 1.0 / 1000.0;<BR>&gt; &gt;&gt; &gt; optimizerScales[0] = 1.0;<BR>&gt; &gt;&gt; &gt; optimizerScales[1] = translationScale;<BR>&gt; &gt;&gt; &gt; optimizerScales[2] = translationScale;<BR>&gt; &gt;&gt; &gt; optimizerScales[3] = translationScale;<BR>&gt; &gt;&gt; &gt; optimizerScales[4] = translationScale;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; optimizer-&gt;SetMaximumStepLength( 0.1 );<BR>&gt; &gt;&gt; &gt; optimizer-&gt;SetMinimumStepLength( 0.001 );<BR>&gt; &gt;&gt; &gt; optimizer-&gt;SetNumberOfIterations( 200 );<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; The scales are well defined and I tried to vary the parameters of the<BR>&gt; &gt;&gt; &gt; optimizer but the results were similar, so I don´t know what to do next.<BR>&gt; &gt;&gt; &gt; Any<BR>&gt; &gt;&gt; &gt; idea??<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; Thank you in advance, I hope you can have more ideas to try.<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; Manuel.<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; _____________________________________<BR>&gt; &gt;&gt; &gt; Powered by www.kitware.com<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; Visit other Kitware open-source projects at<BR>&gt; &gt;&gt; &gt; http://www.kitware.com/opensource/opensource.html<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; Please keep messages on-topic and check the ITK FAQ at:<BR>&gt; &gt;&gt; &gt; http://www.itk.org/Wiki/ITK_FAQ<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<BR>&gt; &gt;&gt; &gt; http://www.itk.org/mailman/listinfo/insight-users<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; ________________________________<BR>&gt; &gt; Vive toda la experiencia de Messenger con Orange desde tu Blackberry<BR>&gt; &gt; ¡Descúbrelo!<BR>&gt; &gt; _____________________________________<BR>&gt; &gt; Powered by www.kitware.com<BR>&gt; &gt;<BR>&gt; &gt; Visit other Kitware open-source projects at<BR>&gt; &gt; http://www.kitware.com/opensource/opensource.html<BR>&gt; &gt;<BR>&gt; &gt; Please keep messages on-topic and check the ITK FAQ at:<BR>&gt; &gt; http://www.itk.org/Wiki/ITK_FAQ<BR>&gt; &gt;<BR>&gt; &gt; Follow this link to subscribe/unsubscribe:<BR>&gt; &gt; http://www.itk.org/mailman/listinfo/insight-users<BR>&gt; &gt;<BR>&gt; &gt;<BR>                                               <br /><hr />¿Para qué descargarte juegos, si tienes los más divertidos online?  <a href='http://juegosonline.es.msn.com/' target='_new'>Entra ya en Juegos y prepárate para muchas horas de diversión</a></body>
</html>