Error using itkNormalizedMutualInformationHistogramImageToImageMetric

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

You are mixing v3 registration framework (NormalizedMutualInformationHistogramImageToImageMetric) with v4 framework (ImageRegistrationMethodv4). Either use both from v3 (no v4 suffix in class names) or v4 framework.

Thank you, Dženan. Is there a normalized mutual information metric within v4 framework? I want to use a metric of normalized mutual information and ImageRegistrationMethodv4 class. Could you share your experience on how to do it with v4 framework? Thanks.

Examples 14 and 15 use NormalizedMutualInformationHistogramImageToImageMetric with v3 framework. You can start from either of them.

Looking at the list of files here, v4 framework does not appear to have the “normalized MI” metric. If you insist on using v4 framework, pick another metric.

1 Like