[ITK] [ITK-dev] V4 Registration having trouble converging while V3 works fine
Matt McCormick
matt.mccormick at kitware.com
Tue Oct 4 11:56:31 EDT 2016
Hi Sepide,
The parameters are not quite equivalent in the ITKv3 and ITKv4
frameworks. In particular, you may need to relax the convergence
criteria for ITKv4 to get the same behavior as ITKv3.
HTH,
Matt
On Fri, Sep 30, 2016 at 3:24 PM, sepideh movaghati
<sepideh.movaghati at gmail.com> wrote:
>
> Hi,
>
>
>
> I was comparing v3 and v4 registration performance on a set of 3D images. In
> few cases, I noticed that v4 registration is diverging while v3 converges to
> a reasonable result without any problem.
> I wonder if you have ever noticed a problem with v4 optimizer that could
> cause similar issues.
>
>
> I copied my code for v3 and v4 registration below. I tried to keep the
> registration configuration very similar in both versions. In v3 I set the
> NumberOfSpatialSamples to 380000 which is about 10% of voxels. I also tried
> with full sampling but the behavior stays the same.
>
>
> In the attached csv file you can see the metric value at each iteration of
> the optimizer for both v3 and v4 version. It is clear that v3 converges
> smoothly, but v4 makes the initial metric value worse after too many
> iterations.
>
>
>
> Thanks a lot in advance.
> Regards,
> Sepide
>
>
> auto interpolator = itk::LinearInterpolateImageFunction<ImageType,
> double>::New();
>
> auto transform = itk::AffineTransform<double>::New();
>
> transform->SetIdentity();
>
> itk::Array<double> scales;
>
> scales.SetSize(12);
>
> scales.Fill(1.0);
>
> scales[9] = 0.001; //translation parameters scales
>
> scales[10] = 0.001;
>
> scales[11] = 0.001;
>
>
>
> // Registration V3 ----------------------- :
>
> auto metric = itk::MattesMutualInformationImageToImageMetric<ImageType,
> ImageType>::New();
>
> auto optimizer = itk::RegularStepGradientDescentOptimizer::New();
>
> auto registration = itk::ImageRegistrationMethod<ImageType,
> ImageType>::New();
>
>
>
> int NumberOfSpatialSamples = 380000;
>
>
>
> metric->SetNumberOfSpatialSamples(NumberOfSpatialSamples);
>
> optimizer->SetScales(scales);
>
> registration->SetMetric(metric);
>
> registration->SetOptimizer(optimizer);
>
> registration->SetInterpolator(interpolator);
>
> registration->SetTransform(transform);
>
> registration->SetFixedImage(fixedImage);
>
> registration->SetMovingImage(movingImage);
>
> registration->SetFixedImageRegion(fixedImage->GetBufferedRegion());
>
> registration->SetInitialTransformParameters(transform->GetParameters());
>
> registration->Update();
>
>
>
>
>
> // Registration V4 ----------------------- :
>
> auto metric =
> itk::MattesMutualInformationImageToImageMetricv4<ImageType,
> ImageType>::New();
>
> auto optimizer = itk::RegularStepGradientDescentOptimizerv4::New();
>
> auto registration = itk::ImageRegistrationMethodv4<ImageType,
> ImageType>::New();
>
>
>
> optimizer->SetScales(scales);
>
> optimizer->SetDoEstimateScales(false);
>
> optimizer->SetDoEstimateLearningRateAtEachIteration(false);
>
> optimizer->SetDoEstimateLearningRateOnce(false);
>
> optimizer->SetMetric(metric);
>
>
>
> registration->SetNumberOfLevels(1);
>
> registration->SetSmoothingSigmasPerLevel(0);
>
> registration->SetShrinkFactorsPerLevel(1);
>
> registration->SetMetricSamplingPercentagePerLevel(0.1);
>
>
>
> registration->SetMetric(metric);
>
> registration->SetOptimizer(optimizer);
>
> registration->SetFixedImage(fixedImage);
>
> registration->SetMovingImage(movingImage);
>
> registration->SetMetricSamplingStrategy(RegistrationType::REGULAR);
>
> registration->SetInitialTransform(transform);
>
>
>
> registration->Update();
>
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> 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://public.kitware.com/mailman/listinfo/insight-developers
>
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php
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://public.kitware.com/mailman/listinfo/insight-developers
More information about the Community
mailing list