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