Affine Registration 3D for beginner

Hello All,
I have 21 3D MR brain images… as a format
…/MPRAGE_copy/KKI-2009-01-MPRAGE.nii for one image in MPRAGE_copy folder…

Out of the 21 images I would like to use the first image as fixed image and register the rest of the 20 images on that reference fixed image.

I want to write the code in self-dependent where I do not have to provide any input.

I am using GCC/6.0.0 compiler…

have four folders:

  1. ITKAffReg3: where the code will be named ITKAffReg3.cxx and CMakeLists.txt which will contain all dependency and executable information.
  2. ITKAffReg3-build: here I will run ccmake and make and contain all the binaries.
  3. MPRAGE_copy: where all the 21 .nii images are present.
  4. AffineFiles: where all affine registered 20 files will be saved.

I have written a code but the error I am getting is too big to print:

I will share the code instead:

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkAffineTransform.h"
#include "itkImageRegistrationMethod.h"
#include "itkResampleImageFilter.h"
#include "itkMeanSquaresImageToImageMetric.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkRegularStepGradientDescentOptimizer.h"
#include <string>

/*
class OptimizationObserver : public itk::Command
{
public:
  typedef OptimizationObserver Self ;
  typedef itk::Command Superclass ;
  typedef itk::SmartPointer < Self > Pointer ;
  itkNewMacro ( Self ) ;

  typedef itk::RegularStepGradientDescentOptimizer OptimizerType ;
  typedef const OptimizerType * OptimizerPointerType ;

  void Execute (itk::Object *caller, const itk::EventObject &event)
  {
    Execute ( (const itk::Object *) caller, event ) ;
  }

  void Execute (const itk::Object *caller, const itk::EventObject &event)
  {
    OptimizerPointerType optimizer = dynamic_cast < OptimizerPointerType > ( caller ) ;
    std::cout << "OptimizerObserver" << optimizer->GetCurrentIteration() << " " << optimizer->GetValue() << std::end\
l ;
  }

protected:
  OptimizationObserver() {} ;

};

class RegistrationObserver : public itk::Command
{
public:
  typedef RegistrationObserver Self ;
  typedef itk::Command Superclass ;
  typedef itk::SmartPointer < Self > Pointer ;
  itkNewMacro ( Self ) ;

  typedef itk::RegularStepGradientDescentOptimizer OptimizerType ;
  typedef OptimizerType * OptimizerPointerType ;
  typedef itk::MultiResolutionImageRegistrationMethod < ImageType, ImageType > RegistrationWrapperType ;  // fixed, \
moving
  typedef RegistrationWrapperType * RegistrationPointerType ;

  void Execute (itk::Object *caller, const itk::EventObject &event)
  {
    RegistrationPointerType registrationWrapper = dynamic_cast < RegistrationPointerType > (caller ) ;
    OptimizerPointerType optimizer = dynamic_cast < OptimizerPointerType > ( registrationWrapper->GetModifiableOptim\
izer() ) ;

    std::cout << "RegObserver" << optimizer->GetCurrentIteration() << std::endl ;
 int level = registrationWrapper->GetCurrentLevel() ;
    if ( level == 0 )
      optimizer->SetMaximumStepLength ( 0.0625 ) ;
    else if ( level == 1 )
      optimizer->SetMaximumStepLength ( 0.125 / 2 ) ;
    else
      optimizer->SetMaximumStepLength ( 0.25 / 2 ) ;

  }

  void Execute (const itk::Object *caller, const itk::EventObject &event)
  {
  }

protected:
  RegistrationObserver() {} ;

};
*/

int
main(int argc, char *argvp[])
{
  //Setup types
  const unsigned int nDims = 3;
  typedef itk::Image<double,nDims>ImageType;

  //Create and setup a reader for the fixed image:
  typedef itk::ImageFileReader<ImageType>readerType;
  readerType::Pointer reader = readerType::New();
reader->SetFileName("../MPRAGE21_copy/KKI2009-21-MPRAGE.nii");
  reader->Update();
  ImageType::Pointer fixedImage = reader->GetOutput();

  //Create and setup readers for the moving images:
  typedef itk::ImageFileReader<ImageType>readerType;
  // readerType::Pointer readers[21]; //**************

  for (int i=1;i<=20;i++)
    {
      std::string digit="";
      if(i<10)
        {
          digit="0";
        }
      //typedef itk::ImageFileReader<ImageType>readerType;
       readerType::Pointer readers[i-1]
       readers[i-1]=readerType::New();
       readers[i-1]->SetFileName("../MPRAGE21_copy/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii");
       readers[i-1]->Update();
       std::cerr<<"../MPRAGE21_copy/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii"<<std::endl;
       // }//*********************

  //Register images:



  //Setup typedefs:
  typedef itk::AffineTransform<double,3>TransformType;
  typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
  typedef itk::MeanSquareImageToImageMetric<ImageType, ImageType>MetricType; //the two image types are fixed
//and moving images
  typedef itk::ImageRegistrationMethod <ImageType, ImageType>RegistrationWrapperType;//simply RegistrationType
  typedef itk::LinearInterpolateImageFunction<ImageType, ImageType>InterpolatorType; //moving image and coordinate r\
ep?? are we not using ITKv4 registration framework which has two interpolatortypes for fixed and moving images.



  //Declare the variables:
  TransformType::Pointer transform = TransformType::New();
  OptimizerTyper::Pointer optimizer = OptimizerType::New();
  MetricType::Pointer metric = MetricType::New();
  RegistrationWrapperType::Pointer registrationWrapper = RegistrationWrapperType::New();
  InterpolatorType::Pointer interpolator = InterpolatorType::New();
  optimizer->AddObserver(itk::IterationEvent(),observer);


  //Connect the pipeline: Simply connect to the instances
  std::cout<<optimizer->GetMinimumStepLength()<<""<<optimizer->GetMaximumStepLength()<<""<<optimizer->GetNumberOfIte\
rations()<<""<<optimizer->GetGradientMagnitudeTolerance()<<std::endl; //what does this line doing?

  transform->SetIdentity();

  registrationWrapper->SetFixedImage(fixedImage);
  registrationWrapper->SetMovingImage(readers[i]);
  registrationWrapper->SetTransform(transform);
  registrationWrapper->SetMetric(metric);
  registrationWrapper->SetInterpolator(interpolator);
  registrationWrapper->SetOptimizer(optimizer)

  registrationWrapper->SetInitialTransformParameters(transform->GetParameters());
  registraionWrapper->SetFixedImageRegion(fizedImage->GetLargestPossibleRegion());
 registrationWrapper->SetNumberOfLevels(3);


  //Run the registration:
  try
    {
      registrationWrapper->Update();
    }
  catch (itk::ExceptionObject & excp)
    {
      std::cerr<<"Error in registration"<< std::endl;
      std::cerr<<excp<<std::endl;
    }

  //Update the transform:
  transform->SetParameters(registrationWrapper->GetLastTransforParameters());

  //Apply the transform:
  typedef itk::ResampleImageFilter<ImageType, ImageType>ResampleFilterType;
  ResampleFilterType::Pointer filter = ResampleFilterType::New()
  filter->SetInput(movingImage);

  //*** a commented out line in Oct4
  filter->SetTransform(transform);
  filter->SetSize(movingImage->GetLargestPossibleRegion().GetSize());
  filter->SetReferenceImage(fixedImage);
  filter->UseReferenceImageOn();
  filter->Update();

  //write out the result:
  typedef itk::ImageFileWriter<ImageType>writerType;
  writerType::Pointer writer=writerType::New();
  writer->SetInput(filter->GetOutput());
  writer->SetFilename("../AffineFiles/AR-"+digit+std::to_string(i)+"MPRAGE.nii");
  writer->Update();

    }

  //Done
 return 0

}

I would be happy if anyone good at ITK, C++ could help me debug.

Thanks

You don’t have to provide all the error messages, just the first and a few typical ones. It doesn’t matter if the error message is long.

so make works:

[banikr@gw344 ITKAffReg3-build]$ make
Scanning dependencies of target ITKAffReg3
[ 50%] Building CXX object CMakeFiles/ITKAffReg3.dir/ITKAffReg3.cxx.o
[100%] Linking CXX executable ITKAffReg3
[100%] Built target ITKAffReg3
[banikr@gw344 ITKAffReg3-build]$

But when I am running the file getting segmentation fault now:

[banikr@gw344 ITKAffReg3-build]$ ./ITKAffReg3
../MPRAGE21_copy/KKI2009-01-MPRAGE.nii

Segmentation fault
[banikr@gw344 ITKAffReg3-build]$

Using the following codes:

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkAffineTransform.h"
#include "itkImageRegistrationMethod.h"
#include "itkResampleImageFilter.h"
#include "itkMeanSquaresImageToImageMetric.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkRegularStepGradientDescentOptimizer.h"
#include <string>
#include <fstream>
#include <vector>
#include <iostream>
#include <cstdlib>
#include <sstream>
#include "itkCommand.h"
#include "itkMultiResolutionImageRegistrationMethod.h"
//#include "Itkutil.h"

class OptimizationObserver : public itk::Command
{
public:
  typedef OptimizationObserver Self ;
  typedef itk::Command Superclass ;
  typedef itk::SmartPointer < Self > Pointer ;
  itkNewMacro ( Self ) ;

  typedef itk::RegularStepGradientDescentOptimizer OptimizerType ;
  typedef const OptimizerType * OptimizerPointerType ;

  void Execute (itk::Object *caller, const itk::EventObject &event)
  {
    Execute ( (const itk::Object *) caller, event ) ;
  }

  void Execute (const itk::Object *caller, const itk::EventObject &event)
  {
    OptimizerPointerType optimizer = dynamic_cast < OptimizerPointerType > ( caller ) ;
    std::cout << "OptimizerObserver" << optimizer->GetCurrentIteration() << " " << optimizer->GetValue() << std::endl ;
  }

protected:
  OptimizationObserver() {} ;

};

int
main()
{
  //Setup types
  const unsigned int nDims = 3;
  typedef itk::Image<double,nDims>ImageType;

  //Create and setup a reader for the fixed image:
  typedef itk::ImageFileReader<ImageType>readerType;
  readerType::Pointer reader = readerType::New();
  reader->SetFileName("../MPRAGE21_copy/KKI2009-21-MPRAGE.nii");
  reader->Update();
  ImageType::Pointer fixedImage = reader->GetOutput();



  //Create and setup readers for the moving images:
  typedef itk::ImageFileReader<ImageType>readerType;
  typedef itk::ImageFileWriter < ImageType > writerType ;
  typedef itk::AffineTransform<double,3>TransformType;
  typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
  typedef itk::MeanSquaresImageToImageMetric<ImageType, ImageType>MetricType;
  typedef itk::ImageRegistrationMethod <ImageType, ImageType>RegistrationWrapperType;
  typedef itk::LinearInterpolateImageFunction<ImageType, ImageType>InterpolatorType;
  typedef itk::ResampleImageFilter < ImageType, ImageType > ResampleFilterType ;


  readerType::Pointer readers[20];
  writerType::Pointer writer[20];
  TransformType::Pointer transform[20];
  OptimizerType::Pointer optimizer[20];
  MetricType::Pointer metric[20];
  RegistrationWrapperType::Pointer registrationWrapper[20];
  InterpolatorType::Pointer interpolator[20];
  OptimizationObserver::Pointer observer[20];
  ResampleFilterType::Pointer filter[20];

  for (int i=1;i<=20;i++)
    {
      std::string digit="";
      if(i<10)
        {
          digit="0";
        }
       readers[i-1]=readerType::New();
       readers[i-1]->SetFileName("../MPRAGE21_copy/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii");
       readers[i-1]->Update();
       ImageType::Pointer movingImage =readers[i-1]->GetOutput();
std::cout<<"../MPRAGE21_copy/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii"<<"\n"<<std::endl;
  //Declare the variables:
  transform[i] = TransformType::New();
  optimizer[i] = OptimizerType::New();
  metric[i] = MetricType::New();
  registrationWrapper[i] = RegistrationWrapperType::New();
  interpolator[i] = InterpolatorType::New();

  // Optimization observer
  observer[i] = OptimizationObserver::New();
  optimizer[i]->AddObserver(itk::IterationEvent(),observer);

  // Registration observer
  //  RegistrationObserver::Pointer regObserver = RegistrationObserver::New() ;
  //registrationWrapper->AddObserver ( itk::IterationEvent(), regObserver ) ;

  optimizer[i]->SetMinimumStepLength(0.0001);//tune the values
  optimizer[i]->SetMaximumStepLength(0.05);
  optimizer[i]->SetNumberOfIterations(50); //page 632 of ITK book

  //Connect the pipeline: Simply connect to the instances
  /*
std::cout<<optimizer->GetMinimumStepLength()<<""<<optimizer->GetMaximumStepLength()<<""<<optimizer->GetNumberOfIterations()<<""<<optimizer->GetGradientMagnitudeTolerance()<<std::endl; //wh\
at does this line doing?
  */
//visualizing in the output

  transform[i]->SetIdentity();
registrationWrapper[i]->SetMovingImage ( movingImage ) ;
  registrationWrapper[i]->SetFixedImage ( fixedImage ) ;
  registrationWrapper[i]->SetTransform ( transform[i] ) ;
  registrationWrapper[i]->SetMetric ( metric[i] ) ;
  registrationWrapper[i]->SetInterpolator ( interpolator[i] ) ;
  registrationWrapper[i]->SetOptimizer ( optimizer[i] ) ;

  registrationWrapper[i]->SetInitialTransformParameters ( transform[i]->GetParameters() ) ;
  registrationWrapper[i]->SetFixedImageRegion ( fixedImage->GetLargestPossibleRegion() ) ;

  // registrationWrapper->SetNumberOfLevels ( 3 ) ;
  //Run the registration:
 try
   {
     registrationWrapper[i]->Update() ;
   }
 catch ( itk::ExceptionObject & excp )
   {
     std::cerr << "Error in registration" << std::endl;
     std::cerr << excp << std::endl;
   }

  //Apply the transform:
 //typedef itk::ResampleImageFilter < ImageType, ImageType > ResampleFilterType ;
 filter[i] = ResampleFilterType::New() ;
 filter[i]->SetInput (movingImage);
 filter[i]->SetTransform (transform[i]);

 filter[i]->SetSize ( movingImage->GetLargestPossibleRegion().GetSize() ) ;
 filter[i]->SetReferenceImage ( fixedImage ) ;
 filter[i]->UseReferenceImageOn() ;
 filter[i]->Update() ;

  //write out the result:
 //typedef itk::ImageFileWriter < ImageType > writerType ;
       std::cout<<"here";

 writer[i-1] = writerType::New() ;
 //writer->SetInput(readers[i]->GetOutput()) ;
 writer[i-1]->SetInput(filter[i]->GetOutput()) ;
 writer[i-1]->SetFileName("../AffineFiles/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii") ;
 writer[i-1]->Update() ;
 //writer.close();

 }
  //Done
  return 0;

}

I want to create a class may be rather than iterating the loop for all 20 images. Is there a way you can think of?
Not good at C++ so would appreciate if you can come up with something easier.

Thanks

By setting the CMAKE_BUILD_TYPE configuration to Debug to add debugging symbols, rebuilding, and running in a debugger like gdb, the issue can be determined.

Your class can contain the pipeline, then can contain a method that takes the input and output filenames on which to execute the pipeline.

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkAffineTransform.h"
#include "itkImageRegistrationMethod.h"
#include "itkResampleImageFilter.h"
#include "itkMeanSquaresImageToImageMetric.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkRegularStepGradientDescentOptimizer.h"
#include <string>
#include <fstream>
#include <vector>
#include <iostream>
#include <cstdlib>
#include <sstream>
#include "itkCommand.h"
#include "itkMultiResolutionImageRegistrationMethod.h"
//#include "Itkutil.h"

/*
class OptimizationObserver : public itk::Command
{
public:
  typedef OptimizationObserver Self ;
  typedef itk::Command Superclass ;
  typedef itk::SmartPointer < Self > Pointer ;
  itkNewMacro ( Self ) ;

  typedef itk::RegularStepGradientDescentOptimizer OptimizerType ;
  typedef const OptimizerType * OptimizerPointerType ;

  void Execute (itk::Object *caller, const itk::EventObject &event)
  {
    Execute ( (const itk::Object *) caller, event ) ;
  }

  void Execute (const itk::Object *caller, const itk::EventObject &event)
  {
    OptimizerPointerType optimizer = dynamic_cast < OptimizerPointerType > ( caller ) ;
    std::cout << "OptimizerObserver" << optimizer->GetCurrentIteration() << " " << optimizer->GetValue() << std::endl ;
  }

protected:
  OptimizationObserver() {} ;

};
*/



int 
main(int argc, char *argv[])
{
  //Setup types
  const unsigned int nDims = 3;
  typedef itk::Image<double,nDims>ImageType;

  //Create and setup a reader for the fixed image:
  typedef itk::ImageFileReader<ImageType>readerType;
  readerType::Pointer reader = readerType::New();
  reader->SetFileName("../MPRAGE21_copy/KKI2009-21-MPRAGE.nii");
  reader->Update();
  ImageType::Pointer fixedImage = reader->GetOutput();
  
  //Create and setup readers for the moving images:
  typedef itk::ImageFileReader<ImageType>readerType;
  readerType::Pointer readers[20];

  for (int i=1;i<=20;i++)
    {
      std::string digit="";
      if(i<10)
	{
	  digit="0";
	}
       readers[i]=readerType::New();
       readers[i]->SetFileName("../MPRAGE21_copy/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii");
       readers[i]->Update();
       ImageType::Pointer movingImage = readers[i]->GetOutput();
       std::cout<<"../MPRAGE21_copy/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii"<<"\n"<<std::endl;
       //}
    
  //Register images:
  //Setup typedefs:
  typedef itk::AffineTransform<double,3>TransformType;
  typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
  typedef itk::MeanSquaresImageToImageMetric<ImageType, ImageType>MetricType; //the two image types are fixed 
  //and moving images
  typedef itk::ImageRegistrationMethod <ImageType, ImageType>RegistrationWrapperType;//simply RegistrationType 
  typedef itk::LinearInterpolateImageFunction<ImageType, ImageType>InterpolatorType; //moving image and coordinate rep?? are we not using ITKv4 registration framework which has two interpolatortypes for fixed and moving images. 



  //Declare the variables:
  TransformType::Pointer transform = TransformType::New();
  OptimizerType::Pointer optimizer = OptimizerType::New();
  MetricType::Pointer metric = MetricType::New();
  RegistrationWrapperType::Pointer registrationWrapper = RegistrationWrapperType::New();
  InterpolatorType::Pointer interpolator = InterpolatorType::New();

  // Optimization observer
  //OptimizationObserver::Pointer observer = OptimizationObserver::New();
  //optimizer->AddObserver(itk::IterationEvent(),observer);

  // Registration observer
  //  RegistrationObserver::Pointer regObserver = RegistrationObserver::New() ;
  //registrationWrapper->AddObserver ( itk::IterationEvent(), regObserver ) ;

  optimizer->SetMinimumStepLength(0.0001);//tune the values
  optimizer->SetMaximumStepLength(0.05);
  optimizer->SetNumberOfIterations(50); //page 632 of ITK book

  //Connect the pipeline: Simply connect to the instances
  /*  
std::cout<<optimizer->GetMinimumStepLength()<<""<<optimizer->GetMaximumStepLength()<<""<<optimizer->GetNumberOfIterations()<<""<<optimizer->GetGradientMagnitudeTolerance()<<std::endl; //what does this line doing?
  */  
//visualizing in the output

  transform->SetIdentity();

  registrationWrapper->SetMovingImage ( movingImage ) ;
  registrationWrapper->SetFixedImage ( fixedImage ) ;
  registrationWrapper->SetTransform ( transform ) ;
  registrationWrapper->SetMetric ( metric ) ;
  registrationWrapper->SetInterpolator ( interpolator ) ;
  registrationWrapper->SetOptimizer ( optimizer ) ;

  registrationWrapper->SetInitialTransformParameters ( transform->GetParameters() ) ;
  registrationWrapper->SetFixedImageRegion ( fixedImage->GetLargestPossibleRegion() ) ;

  // registrationWrapper->SetNumberOfLevels ( 3 ) ;
  //Run the registration:
 try
   {
     registrationWrapper->Update() ;
   }
 catch ( itk::ExceptionObject & excp )
   {
     std::cerr << "Error in registration" << std::endl;
     std::cerr << excp << std::endl;
   }


  //Apply the transform:
 typedef itk::ResampleImageFilter < ImageType, ImageType > ResampleFilterType ;
 ResampleFilterType::Pointer filter = ResampleFilterType::New() ;
 filter->SetInput (movingImage);
 filter->SetTransform (transform);

 filter->SetSize ( movingImage->GetLargestPossibleRegion().GetSize() ) ;
 filter->SetReferenceImage ( fixedImage ) ;
 filter->UseReferenceImageOn() ;
 filter->Update() ;

  //write out the result:
 typedef itk::ImageFileWriter < ImageType > writerType ;
 writerType::Pointer writer = writerType::New() ;
 //writer->SetInput(readers[i]->GetOutput()) ;
 writer->SetInput(filter->GetOutput()) ;
 writer->SetFileName("../AffineFiles/KKI2009-"+digit+std::to_string(i)+"-MPRAGE.nii") ;
 writer->Update() ;
 //writer.close();

 }
  //Done
  return 0;

}

with these codes I am getting the error starting with:

Scanning dependencies of target ITKAffReg3
[ 50%] Building CXX object CMakeFiles/ITKAffReg3.dir/ITKAffReg3.cxx.o
/home/banikr/ITKAffReg3/ITKAffReg3.cxx: In function ‘int main(int, char**)’:
/home/banikr/ITKAffReg3/ITKAffReg3.cxx:126:55: error: no matching function for call to ‘itk::ImageRegistrationMethod<itk::Image<double, 3u>, itk::Image<double, 3u> >::SetInterpolator(itk::LinearInterpolateImageFunction<itk::Image<double, 3u>, itk::Image<double, 3u> >::Pointer&)’
   registrationWrapper->SetInterpolator ( interpolator ) ;
                                                       ^
In file included from /accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkLightObject.h:21:0,
                 from /accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkObject.h:31,
                 from /accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkRegion.h:31,
                 from /accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkImageRegion.h:31,
                 from /accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkImage.h:21,
                 from /home/banikr/ITKAffReg3/ITKAffReg3.cxx:2:
/accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkImageRegistrationMethod.h:143:3: note: candidate: void itk::ImageRegistrationMethod<TFixedImage, TMovingImage>::SetInterpolator(itk::ImageRegistrationMethod<TFixedImage, TMovingImage>::InterpolatorType*) [with TFixedImage = itk::Image<double, 3u>; TMovingImage = itk::Image<double, 3u>; itk::ImageRegistrationMethod<TFixedImage, TMovingImage>::InterpolatorType = itk::InterpolateImageFunction<itk::Image<double, 3u>, double>]
   itkSetObjectMacro(Interpolator, InterpolatorType);
   ^
/accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkImageRegistrationMethod.h:143:3: note:   no known conversion for argument 1 from ‘itk::LinearInterpolateImageFunction<itk::Image<double, 3u>, itk::Image<double, 3u> >::Pointer {aka itk::SmartPointer<itk::LinearInterpolateImageFunction<itk::Image<double, 3u>, itk::Image<double, 3u> > >}’ to ‘itk::ImageRegistrationMethod<itk::Image<double, 3u>, itk::Image<double, 3u> >::InterpolatorType* {aka itk::InterpolateImageFunction<itk::Image<double, 3u>, double>*}’
In file included from /accre/arch/easybuild/software/Compiler/GCC/5.4.0-2.26/ITK/4.12.2-Python-2.7.12/include/ITK-4.12/itkImageFunction.h:234:0,

typedef itk::LinearInterpolateImageFunction<ImageType, ImageType>InterpolatorType;

should be

typedef itk::LinearInterpolateImageFunction<ImageType> InterpolatorType;

or typedef itk::LinearInterpolateImageFunction<ImageType, double> InterpolatorType;

Hi,

That worked great!
Thanks a lot!