From: tbaudier Date: Wed, 29 Mar 2017 10:44:57 +0000 (+0200) Subject: Add BSpline order consideration in clitkConvertBLUTCoeffsToVFFilter X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c04a50a5ebb1e8f6e50e737725ded6fae58345fa;p=clitk.git Add BSpline order consideration in clitkConvertBLUTCoeffsToVFFilter --- diff --git a/registration/clitkConvertBLUTCoeffsToVFFilter.h b/registration/clitkConvertBLUTCoeffsToVFFilter.h index 40eb129..dc85c7a 100644 --- a/registration/clitkConvertBLUTCoeffsToVFFilter.h +++ b/registration/clitkConvertBLUTCoeffsToVFFilter.h @@ -43,7 +43,11 @@ namespace clitk typedef clitk::BSplineDeformableTransform BLUTTransformType; typedef typename BLUTTransformType::CoefficientImageType BLUTCoefficientImageType; - typedef itk::BSplineDeformableTransform ITKTransformType; + typedef itk::BSplineDeformableTransform ITKTransformType; + typedef itk::BSplineDeformableTransform ITKTransformTypeZero; + typedef itk::BSplineDeformableTransform ITKTransformTypeOne; + typedef itk::BSplineDeformableTransform ITKTransformTypeTwo; + typedef itk::BSplineDeformableTransform ITKTransformTypeFour; typedef itk::Transform< double, TDVFType::ImageDimension, TDVFType::ImageDimension> GenericTransformType; diff --git a/registration/clitkConvertBLUTCoeffsToVFFilter.txx b/registration/clitkConvertBLUTCoeffsToVFFilter.txx index 98328eb..9bda80f 100644 --- a/registration/clitkConvertBLUTCoeffsToVFFilter.txx +++ b/registration/clitkConvertBLUTCoeffsToVFFilter.txx @@ -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)