[ITK-users] image registration in MATALAB vs ITK.
shrikant
shrikantvc at gmail.com
Wed Jun 22 11:50:48 EDT 2016
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.
More information about the Insight-users
mailing list