[ITK-users] MutualInformationImageToImageMetric without transformation
jan
jan.bergmeier at imes.uni-hannover.de
Tue Aug 26 09:08:26 EDT 2014
Dear Carlos,
thank you for your help. i'm still experiencing some difficulties. I tried
your proposed way like this:
typedef itk::MutualInformationImageToImageMetric< UChar2DImageType,
UChar2DImageType > MetricType;
typedef itk::TranslationTransform< double, 2 > TransformType;
typedef itk::GradientDescentOptimizer OptimizerType;
MetricType::Pointer metric = MetricType::New();
TransformType::Pointer transform = TransformType::New();
MetricType::TransformParametersType displacement(
transform->ParametersDimension );
displacement[0] = 0.0;
displacement[1] = 0.0;
metric->SetFixedImage( fixedImage );
metric->SetMovingImage( movingImage);
metric->SetTransform( transform );
metric->GetValue( displacement );
When I am trying to get the MI-value with the displacement parameters, my
program crashes.
i tried another way with an optimizer that does only one iteration:
typedef itk::TranslationTransform< double, 2 > TransformType;
typedef itk::GradientDescentOptimizer OptimizerType;
typedef itk::LinearInterpolateImageFunction< UChar2DImageType, double >
InterpolatorType;
typedef itk::ImageRegistrationMethod< UChar2DImageType, UChar2DImageType
> RegistrationType;
typedef itk::MutualInformationImageToImageMetric< UChar2DImageType,
UChar2DImageType > MetricType;
typedef RegistrationType::ParametersType ParametersType;
TransformType::Pointer transform = TransformType::New();
OptimizerType::Pointer optimizer = OptimizerType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();
RegistrationType::Pointer registration = RegistrationType::New();
MetricType::Pointer metric = MetricType::New();
registration->SetOptimizer( optimizer );
registration->SetTransform( transform );
registration->SetInterpolator( interpolator );
registration->SetMetric( metric );
registration->SetFixedImage( fixedImage );
registration->SetMovingImage( movingImage );
ParametersType initialParameters( transform->GetNumberOfParameters() );
initialParameters[0] = 0.0;
initialParameters[1] = 0.0;
registration->SetInitialTransformParameters( initialParameters );
optimizer->SetNumberOfIterations( 1 );
try
{
registration->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
}
double bestValue = optimizer->GetValue();
The problem here is that I get the following Error:
"Description: itk::ERROR:
MutualInformationImageToImageMetric(0x48e0860): Standard deviation is too
small"
Any suggestions for a convenient solution?
Thanks,
Jan
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/MutualInformationImageToImageMetric-without-transformation-tp7586081p7586118.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list