]> Creatis software - clitk.git/blobdiff - registration/clitkConvertBLUTCoeffsToVFFilter.txx
Merge branch 'master' into extentSimon
[clitk.git] / registration / clitkConvertBLUTCoeffsToVFFilter.txx
index ae1f9d539bd70d9425efbab1a760e324ba93771a..ef63900717289f73c0fc3b71969c8a7a0c44ec6c 100644 (file)
@@ -7,11 +7,6 @@
 
 //#include "clitkConvertBSplineDeformableTransformToVFGenericFilter.h"
 #include "clitkVectorImageToImageFilter.h"
-#if ITK_VERSION_MAJOR >= 4
-#include "itkTransformToDisplacementFieldSource.h"
-#else
-#include "itkTransformToDeformationFieldSource.h"
-#endif
 #include "itkBSplineDeformableTransform.h"
 
 namespace clitk 
@@ -148,12 +143,7 @@ namespace clitk
         
       typedef clitk::VectorImageToImageFilter<BLUTCoefficientImageType, typename ITKTransformType::ImageType> FilterType;
       typename FilterType::Pointer component_filter[BLUTCoefficientImageType::ImageDimension];
-
-#if ITK_VERSION_MAJOR >= 4
       typename ITKTransformType::CoefficientImageArray coefficient_images;
-#else
-      typename ITKTransformType::ImagePointer coefficient_images[BLUTCoefficientImageType::ImageDimension];
-#endif
 
       for (unsigned int i=0; i < BLUTCoefficientImageType::ImageDimension; i++) {
           component_filter[i] = FilterType::New();
@@ -163,7 +153,6 @@ namespace clitk
           coefficient_images[i] = component_filter[i]->GetOutput();
       }
 
-#if ITK_VERSION_MAJOR >= 4
       // RP: 16/01/2013
       // ATTENTION: Apparently, there's a bug in the SetCoefficientImages function of ITK 4.x
       // I needed to use SetParametersByValue instead.
@@ -179,16 +168,17 @@ namespace clitk
       m_ITKTransform->SetGridRegion(input->GetLargestPossibleRegion());
       m_ITKTransform->SetGridSpacing(input->GetSpacing());
       m_ITKTransform->SetParametersByValue(params);
-#else
-      m_ITKTransform->SetCoefficientImage(coefficient_images);
-#endif
 
       m_GenericTransform = m_ITKTransform;
     }
 
+#if ITK_VERSION_MAJOR > 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 6)
+    m_Filter->SetReferenceImage(output);
+#else
     m_Filter->SetOutputOrigin(output->GetOrigin());
     m_Filter->SetOutputSpacing(output->GetSpacing());
     m_Filter->SetOutputSize(output->GetLargestPossibleRegion().GetSize());
+#endif
     m_Filter->SetTransform(m_GenericTransform);
 
     m_Filter->Update();