[ITK-users] image registration in MATALAB vs ITK.

Lowekamp, Bradley (NIH/NLM/LHC) [C] blowekamp at mail.nih.gov
Thu Jun 23 10:21:44 EDT 2016


Hello,

One key feature of ITK is that is does just about everything with respect to physical space, as opposed to considering things just a matrix of numbers.

This can make setting up the parameters data dependent and tricker. There is the scales estimator which can be used to help certain aspects of this [1], but this then interacts with your learning rate.

Also make sure to use the callbacks to print the parameters and metric value during the optimization [2].

You need to study the optimization process and algorithm to determine why its not covering correctly.

HTH,
Brad



[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/RegistrationITKv4/ImageRegistration1.cxx#L442-L450
[2] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/RegistrationITKv4/ImageRegistration1.cxx#L469-L471

> On Jun 22, 2016, at 11:50 AM, shrikant <shrikantvc at gmail.com> wrote:
> 
> Hi,
> 
> I am new to ITK, i have working MATLAB registration as a below code. Please
> note that here I am registering fixed image with high features and moving
> image with very low signal.
> 
> [optimizer,metric]=imregconfig('multimodal');
> tr1 = imregtform(movingImage, fixedImageResized, 'translation', optimizer,
> metric);
> 
> I need to convert into ITK 4 code. I am using below ITK code 
> 
>  typedef itk::ImageRegistrationMethodv4<ITKImageType, ITKImageType,
> TransformType> RegistrationType;
>  RegistrationType::Pointer registration = RegistrationType::New();
>  RegistrationType::ShrinkFactorsArrayType shrinkFactorsPerLevel;
>  RegistrationType::SmoothingSigmasArrayType smoothingSigmasPerLevel;
>  MetricType::Pointer metric = MetricType::New();
> 
>  metric->SetNumberOfHistogramBins(50);
>  metric->SetUseMovingImageGradientFilter(true);
>  metric->SetUseFixedImageGradientFilter(true);
>  registration->SetMetric(metric);
> 
> 
>  RSGDOptimizerType::Pointer smartOptimizer = RSGDOptimizerType::New();
>  smartOptimizer->SetLearningRate(0.5);
>  smartOptimizer->SetMaximumStepSizeInPhysicalUnits(0.001);
>  smartOptimizer->SetMinimumStepLength(0.0001);
>  smartOptimizer->SetNumberOfIterations(100);
>  smartOptimizer->ReturnBestParametersAndValueOn();
>  smartOptimizer->SetRelaxationFactor(0.5);
>  registration->SetOptimizer(smartOptimizer);
> 
> 
>  registration->SetNumberOfLevels(1);
> 
>  shrinkFactorsPerLevel.SetSize(1);
>  shrinkFactorsPerLevel[0] = 1;
>  registration->SetShrinkFactorsPerLevel(shrinkFactorsPerLevel);
>  smoothingSigmasPerLevel.SetSize(1);
>  smoothingSigmasPerLevel[0] = 0;
>  registration->SetSmoothingSigmasPerLevel(smoothingSigmasPerLevel);
> 
> 
>  registration->SetMetricSamplingStrategy(RegistrationType::REGULAR);
>  registration->SetMetricSamplingPercentage(100);
> 
>  registration->Update();
> 
>  TransformType::ParametersType finalParameters =  
> registration->GetOutput()->Get()->GetParameters();
>  yTranslation = finalParameters[1];
> 
> Here I am getting huge differences like, -0.33 (ITK) vs -1.20(MATLAB) mm. If
> I see visually then matlab results look more correct.
> 
> Any idea what is going wrong here?
> 
> Any help would be highly appreciated.
> 
> 
> 
> 
> --
> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/image-registration-in-MATALAB-vs-ITK-tp7588990.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> 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://www.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-users



More information about the Insight-users mailing list