]> Creatis software - clitk.git/commitdiff
Add BSpline order consideration in clitkConvertBLUTCoeffsToVFFilter
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 29 Mar 2017 10:44:57 +0000 (12:44 +0200)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 29 Mar 2017 10:44:57 +0000 (12:44 +0200)
registration/clitkConvertBLUTCoeffsToVFFilter.h
registration/clitkConvertBLUTCoeffsToVFFilter.txx

index 40eb129d084e3c8bec1f0dabfcd8e9681c5f9477..dc85c7a445db478bf15294d68870d80b9d26decf 100644 (file)
@@ -43,7 +43,11 @@ namespace clitk
 
     typedef clitk::BSplineDeformableTransform<double, TDVFType::ImageDimension, TDVFType::ImageDimension> BLUTTransformType;
     typedef typename BLUTTransformType::CoefficientImageType BLUTCoefficientImageType;
-    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, TDVFType::ImageDimension> ITKTransformType;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 3> ITKTransformType;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 0> ITKTransformTypeZero;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 1> ITKTransformTypeOne;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 2> ITKTransformTypeTwo;
+    typedef itk::BSplineDeformableTransform<double, TDVFType::ImageDimension, 4> ITKTransformTypeFour;
 
     typedef itk::Transform< double, TDVFType::ImageDimension, TDVFType::ImageDimension> GenericTransformType;
     
index 98328eb08b04190bb202546b99e384c4f876f627..9bda80f8ec0aa03d38b9031875955bc6fc5b584d 100644 (file)
@@ -162,14 +162,55 @@ namespace clitk
         for (unsigned int j=0; j < coefficient_images[i]->GetPixelContainer()->Size(); j++)
           params[input->GetPixelContainer()->Size() * i + j] = coefficient_images[i]->GetPixelContainer()->GetBufferPointer()[j]; 
       }
+      typename ITKTransformTypeZero::Pointer zero;
+      typename ITKTransformTypeOne::Pointer one;
+      typename ITKTransformTypeTwo::Pointer two;
+      typename ITKTransformTypeFour::Pointer four;
 
-      m_ITKTransform->SetGridOrigin(input->GetOrigin());
-      m_ITKTransform->SetGridDirection(input->GetDirection());
-      m_ITKTransform->SetGridRegion(input->GetLargestPossibleRegion());
-      m_ITKTransform->SetGridSpacing(input->GetSpacing());
-      m_ITKTransform->SetParametersByValue(params);
-
-      m_GenericTransform = m_ITKTransform;
+      switch(m_BLUTSplineOrders[0])
+      {
+        case 0:
+          zero = ITKTransformTypeZero::New();
+          zero->SetGridOrigin(input->GetOrigin());
+          zero->SetGridDirection(input->GetDirection());
+          zero->SetGridRegion(input->GetLargestPossibleRegion());
+          zero->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = zero;
+          break;
+        case 1:
+          one = ITKTransformTypeOne::New();
+          one->SetGridOrigin(input->GetOrigin());
+          one->SetGridDirection(input->GetDirection());
+          one->SetGridRegion(input->GetLargestPossibleRegion());
+          one->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = one;
+          break;
+        case 2:
+          two = ITKTransformTypeTwo::New();
+          two->SetGridOrigin(input->GetOrigin());
+          two->SetGridDirection(input->GetDirection());
+          two->SetGridRegion(input->GetLargestPossibleRegion());
+          two->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = two;
+          break;
+        case 3:
+          m_ITKTransform = ITKTransformType::New();
+          m_ITKTransform->SetGridOrigin(input->GetOrigin());
+          m_ITKTransform->SetGridDirection(input->GetDirection());
+          m_ITKTransform->SetGridRegion(input->GetLargestPossibleRegion());
+          m_ITKTransform->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = m_ITKTransform;
+          break;
+        case 4:
+          four = ITKTransformTypeFour::New();
+          four->SetGridOrigin(input->GetOrigin());
+          four->SetGridDirection(input->GetDirection());
+          four->SetGridRegion(input->GetLargestPossibleRegion());
+          four->SetGridSpacing(input->GetSpacing());
+          m_GenericTransform = four;
+          break;
+      }
+      m_GenericTransform->SetParametersByValue(params);
     }
 
 #if ITK_VERSION_MAJOR > 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 6)