Hello,
I am trying to use the metric of Normalized Mutual Information for rigid registration. Here is part of my code:
#include "itkImageRegistrationMethodv4.h"
#include "itkVersorRigid3DTransform.h"
#include "itkCenteredTransformInitializer.h"
#include "itkNormalizedMutualInformationHistogramImageToImageMetric.h"
#include "itkRegularStepGradientDescentOptimizerv4.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkResampleImageFilter.h"
#include "itkCastImageFilter.h"
int main(int argc, const char *argv[])
{
// parsing parameters ...
using TransformType = itk::VersorRigid3DTransform<double>;
using RegistrationType =
itk::ImageRegistrationMethodv4<FixedImageType, MovingImageType, TransformType>;
RegistrationType::Pointer registration = RegistrationType::New();
using MetricType = itk::NormalizedMutualInformationHistogramImageToImageMetric<FixedImageType, MovingImageType>;
MetricType::Pointer metric = MetricType::New();
registration->SetMetric(metric);
//...
}
I got the following error:
error: no viable conversion from ‘MetricType::Pointer’ (aka
‘SmartPointer<itk::NormalizedMutualInformationHistogramImageToImageMetric<itk::Image<double, 3>, itk::Image<double, 3> > >’) to
‘itk::ImageRegistrationMethodv4<itk::Image<double, 3>, itk::Image<double, 3>, itk::VersorRigid3DTransform, itk::Image<double, 3>, itk::PointSet<unsigned
int, 3, itk::DefaultStaticMeshTraits<unsigned int, 3, 3, float, float, unsigned int> > >::MetricType *’ (aka ‘ObjectToObjectMetricBaseTemplate *’)
registration->SetMetric(metric);
^~~~~~
I am using ITK5.0.1. Does anyone know what is happening here? Any comments? Thanks.
Best regards,
Fang