0

I am trying to use the metric of Normalized Mutual Information for rigid registration on 3D MR images. Here is a 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;

    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? Thank you.

f. c.
  • 1,095
  • 11
  • 26
  • 1
    Clearly it's a type issue. The MetricType you're passing in to SetMetric is not the same as what it wants. The registration method you're using is from the ITK V4 framework, while the MetricType you're passing in is from the ITK V5 registration framework. I don't know that you can mix V4 and V5 stuff. I'd guess not. – Dave Chen Dec 18 '19 at 18:25
  • 1
    Post the feedback I got from itk discussion forum: https://discourse.itk.org/t/error-using-itknormalizedmutualinformationhistogramimagetoimagemetric/2540 – f. c. Dec 19 '19 at 10:14
  • Cool, so I was on the right track :). I just had my framework versions wrong. – Dave Chen Dec 19 '19 at 13:35

0 Answers0