[ITK-users] MutualInformationImageToImageMetric without transformation
jan
jan.bergmeier at imes.uni-hannover.de
Thu Aug 28 09:24:40 EDT 2014
Hi, I will use this way, because it's the most convenient that's working for
me.
//Typedefs
typedef itk::IdentityTransform< double, 2 > TransformType;
typedef itk::GradientDescentOptimizer OptimizerType;
typedef itk::LinearInterpolateImageFunction< UChar2DImageType, double >
InterpolatorType;
typedef itk::MutualInformationImageToImageMetric< UChar2DImageType,
UChar2DImageType > MiMetricType;
typedef itk::ImageRegistrationMethod< UChar2DImageType, UChar2DImageType
> RegistrationType;
//Create registration components
TransformType::Pointer transform = TransformType::New();
OptimizerType::Pointer optimizer = OptimizerType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();
RegistrationType::Pointer registration = RegistrationType::New();
//Configure transform
transform->SetIdentity();
//Configure optimizer
optimizer->SetNumberOfIterations( 1 );
//Configure metric
MetricType::Pointer metric = MetricType::New();
metric->SetNumberOfSpatialSamples( 1000 );
//Set up registration
registration->SetOptimizer( optimizer );
registration->SetTransform( transform );
registration->SetInterpolator( interpolator );
registration->SetMetric( metric );
registration->SetFixedImage( fixedImageIn );
registration->SetMovingImage( movingImageIn );
registration->SetInitialTransformParameters( transform->GetParameters()
);
//Perform registration
try
{
registration->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
}
//Get output
double bestValue = optimizer->GetValue();
Thank you all for your help,
Jan
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/MutualInformationImageToImageMetric-without-transformation-tp7586081p7586134.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list