[Insight-users] Problem with 2D Registration (local minima)
Luis Ibanez
luis.ibanez at kitware.com
Thu Oct 22 13:43:31 EDT 2009
Hi Manuel,
How big is the rotation that you would think
is needed for registering these two images ?
(typically in microscopy and satellite images
you don't need much of a rotation).
With that information we could set better
values for the scaling.
Also, please note that the CenteredRigid2DTransform
also attempts to optimize the center of rotation. We
have found that this is in general, both unnecessary
and undesirable.
You may want to replace this Transform with the
simpler:
Rigid2DTransform
(and still keep the CenteredTransformInitializer).
The Rigid2DTransform still uses a center of rotation,
but doesn't includes it in the list of parameters to
be optimized.
As a consequence, your parameters array will have
only three components, instead of the current five.
(you may have to adjust any place in the code where
you use 5 components. For example, in the translation
scaling.
Please make those changes,
and let us know what you find.
Thanks
Luis
-----------------------------------------------------------
On Thu, Oct 22, 2009 at 1:30 PM, Manuel David Tabas Calle
<manueldavid.tabas at hotmail.es> wrote:
>
> Ok, sorry. The values are:
>
> Center X: 1000
> Center Y: 1000
>
> Angle: 0.9 radians
>
> Translation X: -340
> Translation Y: 800
>
>
>
>> Date: Thu, 22 Oct 2009 12:41:41 -0400
>> Subject: Re: [Insight-users] Problem with 2D Registration (local minima)
>> From: bill.lorensen at gmail.com
>> To: manueldavid.tabas at hotmail.es
>> CC: insight-users at itk.org
>>
>> I meant the value of the parameters...
>>
>> On Thu, Oct 22, 2009 at 11:56 AM, Manuel David Tabas Calle
>> <manueldavid.tabas at hotmail.es> wrote:
>> >
>> > Hi Bill,
>> >
>> > The optimum value for the metric that I spect is about 2000, and I
>> > normally
>> > get a metric of 4000.
>> >
>> > I will try just now to set:
>> >
>> > optimizer->SetMaximumStepLength( 0.1 );
>> >
>> > and I´ll let you know the results in a while.
>> >
>> > Thanks!
>> >
>> > Manuel.
>> >
>> >> Date: Thu, 22 Oct 2009 11:52:23 -0400
>> >> Subject: Re: [Insight-users] Problem with 2D Registration (local
>> >> minima)
>> >> From: bill.lorensen at gmail.com
>> >> To: manueldavid.tabas at hotmail.es
>> >> CC: insight-users at itk.org
>> >>
>> >> The optimizer is stopping after reaching the maximum number of
>> >> iterations. This is normally not the best way to terminate an
>> >> optimization.
>> >>
>> >> What do you expect for the optimum value of the parameters?
>> >>
>> >> Perhaps you need a larger maximum step length? Or perhaps, as Luis
>> >> suggested, the starting point is too far from the optimum for this
>> >> optimizer.
>> >>
>> >> Bill
>> >>
>> >>
>> >> On Thu, Oct 22, 2009 at 10:09 AM, Manuel David Tabas Calle
>> >> <manueldavid.tabas at hotmail.es> wrote:
>> >> >
>> >> > Hi Luis,
>> >> >
>> >> > Thank you for answering me.
>> >> >
>> >> > 1) As you said, my images are from Microscopy and the spacing is
>> >> > about
>> >> > 2.85
>> >> > micrometres/pixel. The images are in a raw format and I used the
>> >> > following
>> >> > .mhd file for reading it:
>> >> >
>> >> >
>> >> > NDims = 2
>> >> > DimSize = 2000 2000
>> >> > ElementType = MET_UCHAR
>> >> > ElementSpacing = 1.0 1.0
>> >> > Offset = 0.0 0.0
>> >> > ElementByteOrderMSB = False
>> >> > ElementDataFile = fixed.raw
>> >> >
>> >> > I also tried to as ElementSpacing 2.83 and 0.00283 (just in case...)
>> >> > but
>> >> > the
>> >> > results weren´t good either.
>> >> >
>> >> > 2) I also try to put a relaxation factor of 0.9 as you said and I
>> >> > couldn´t
>> >> > see any improvement.
>> >> >
>> >> > 3) I´m attaching three .txt files with some results obtained.
>> >> > The results1.txt file shows the output of the program as you can find
>> >> > it
>> >> > on
>> >> > ITK/Examples/Registration/.
>> >> > The results2.txt file shows the output of the program with a
>> >> > predifined
>> >> > center in the position 1000x1000. The results3.txt file shows the
>> >> > output
>> >> > of
>> >> > the program with a predifined center in the position 1000x1000, a
>> >> > predefined
>> >> > angle of 0.9 radians and a predefined traslation of -340 in the X
>> >> > axis
>> >> > and
>> >> > 800 in the Y axis (that are the values for an optimal registration).
>> >> >
>> >> >
>> >> > I hope you can help me to fix my problem with that information... an
>> >> > be
>> >> > free
>> >> > to ask anything else :P.
>> >> >
>> >> > Thank you really much.
>> >> >
>> >> > Manuel.
>> >> >
>> >> >
>> >> >> Date: Wed, 21 Oct 2009 17:29:08 -0400
>> >> >> Subject: Re: [Insight-users] Problem with 2D Registration (local
>> >> >> minima)
>> >> >> From: luis.ibanez at kitware.com
>> >> >> To: manueldavid.tabas at hotmail.es
>> >> >> CC: insight-users at itk.org
>> >> >>
>> >> >> Hi Manuel,
>> >> >>
>> >> >> Thanks for the detailed description of your problem.
>> >> >>
>> >> >> A couple of questions:
>> >> >>
>> >> >>
>> >> >> 1) What is the pixel spacing of your image ?
>> >> >>
>> >> >> The typical proportion of :
>> >> >>
>> >> >> > const double translationScale = 1.0 / 1000.0;
>> >> >>
>> >> >> is set up for images whose physical extent in
>> >> >> the units used by the spacing is in the range
>> >> >> of hundreds.
>> >> >>
>> >> >> For example, a typical CT scan will have 512x512
>> >> >> pixels with a spacing close to 1mm / pixel.
>> >> >>
>> >> >> Your images are probably from Microscopy or
>> >> >> from a Satellite, so I'm wondering about the units
>> >> >> that you use (microns or kilometers) and the
>> >> >> exact numeric values of the spacing.
>> >> >>
>> >> >>
>> >> >> 2) Could you post to the list the output of the
>> >> >> command observer that tracks the values of
>> >> >> the metric and the transform at every iteration ?
>> >> >>
>> >> >>
>> >> >> Something that happens often when using the
>> >> >> RegularStepGradientDescentOptimizer is that,
>> >> >> if the registration process have a couple of
>> >> >> bounces of direction in the parametric space,
>> >> >> the step length may be reduced too fast, and
>> >> >> not give the optimizer the oportunity to walk
>> >> >> far enough to get to the solution.
>> >> >>
>> >> >>
>> >> >> You may want to try using the method:
>> >> >>
>> >> >> optimizer->SetRelaxationFactor( 0.9 );
>> >> >>
>> >> >>
>> >> >> This method defines the factor by which the
>> >> >> step length is reduced at every time that the
>> >> >> parametric space step changes direction.
>> >> >> This may prevent the premature shrinkage
>> >> >> of the step length (assuming that this is the
>> >> >> real problem).
>> >> >>
>> >> >>
>> >> >> Anothe typical issue: It may simply be that you
>> >> >> need a better initialization for your images.
>> >> >>
>> >> >>
>> >> >> Note that the Transform initializer in the example:
>> >> >>
>> >> >> ImageRegistration6.cxx
>> >> >>
>> >> >> is using the methods MomentsOn().
>> >> >>
>> >> >> This may or may not be the right method to use,
>> >> >> depending on the content of your images.
>> >> >>
>> >> >> For example: If the two images have different
>> >> >> modalities, or if the main features of one image
>> >> >> may not overlap to the one in the other image.
>> >> >>
>> >> >> If you could post a screenshot of both images
>> >> >> we could avoid all this speculation... :-)
>> >> >>
>> >> >> Or...
>> >> >> If you can share your images in a public web
>> >> >> site, that will be even better.
>> >> >>
>> >> >>
>> >> >>
>> >> >> Thanks
>> >> >>
>> >> >>
>> >> >> Luis
>> >> >>
>> >> >>
>> >> >> ----------------------------------------------------------------
>> >> >> On Wed, Oct 21, 2009 at 11:56 AM, Manuel David Tabas Calle
>> >> >> <manueldavid.tabas at hotmail.es> wrote:
>> >> >> > Hello ITK,
>> >> >> >
>> >> >> > I´m working with ITK to do registration of 2D images and I think I
>> >> >> > reach
>> >> >> > a
>> >> >> > local minima that makes a poor registration.
>> >> >> >
>> >> >> > I´m using 2D images 2000x2000 pixels in what the moving image
>> >> >> > needs a
>> >> >> > rotation and a translation. So I reproduced the
>> >> >> > ImageRegistration6.cxx
>> >> >> > to do
>> >> >> > that. But the result I got is not good enough so I think that the
>> >> >> > MeanSquares metric reaches a local minima. The value of the metric
>> >> >> > is
>> >> >> > about
>> >> >> > 4000 (aprox.), and I run a test using as input parameters the
>> >> >> > optimal
>> >> >> > ones
>> >> >> > (that is, the result I think i should obtain) and the metric
>> >> >> > returns
>> >> >> > a
>> >> >> > value
>> >> >> > of 2500 (aprox.).
>> >> >> >
>> >> >> > The framework I use is:
>> >> >> >
>> >> >> > itkImageRegistrationMethod
>> >> >> > itkMeanSquaresImageToImageMetric
>> >> >> > itkLinearInterpolateImageFunction
>> >> >> > itkRegularStepGradientDescentOptimizer
>> >> >> > itkCenteredRigid2DTransform
>> >> >> >
>> >> >> > And the parameters of my registration are:
>> >> >> >
>> >> >> > const double translationScale = 1.0 / 1000.0;
>> >> >> > optimizerScales[0] = 1.0;
>> >> >> > optimizerScales[1] = translationScale;
>> >> >> > optimizerScales[2] = translationScale;
>> >> >> > optimizerScales[3] = translationScale;
>> >> >> > optimizerScales[4] = translationScale;
>> >> >> >
>> >> >> > optimizer->SetMaximumStepLength( 0.1 );
>> >> >> > optimizer->SetMinimumStepLength( 0.001 );
>> >> >> > optimizer->SetNumberOfIterations( 200 );
>> >> >> >
>> >> >> >
>> >> >> > The scales are well defined and I tried to vary the parameters of
>> >> >> > the
>> >> >> > optimizer but the results were similar, so I don´t know what to do
>> >> >> > next.
>> >> >> > Any
>> >> >> > idea??
>> >> >> >
>> >> >> > Thank you in advance, I hope you can have more ideas to try.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > Manuel.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > _____________________________________
>> >> >> > 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
>> >> >> >
>> >> >> >
>> >> >
>> >> > ________________________________
>> >> > Vive toda la experiencia de Messenger con Orange desde tu Blackberry
>> >> > ¡Descúbrelo!
>> >> > _____________________________________
>> >> > 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
>> >> >
>> >> >
>> >
>> > ________________________________
>> > ¿Para qué descargarte juegos, si tienes los más divertidos online? Entra
>> > ya
>> > en Juegos y prepárate para muchas horas de diversión
>> > _____________________________________
>> > 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
>> >
>> >
>
> ________________________________
> Entra al Nuevo Canal Motor y descubre por qué los coches más rápidos sólo
> aparcan en MSN. Nuevo diseño, más completo y abierto a tu opinión. ¡Nuevo
> Canal Motor!
> _____________________________________
> 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
>
>
More information about the Insight-users
mailing list