[ITK] [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.
_____________________________________
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 Community
mailing list