X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkWarpImageGenericFilter.txx;h=84bfbaaec7148cc5f133180c3b5290ca608eb491;hb=5578995d9a82792833333eeb3dd5c8ecac967293;hp=4c30c4c6b44e0632a5cf804be43d9a8e7fa778a9;hpb=9a4dda175415c133b547eec505cd0497d3181f8d;p=clitk.git diff --git a/tools/clitkWarpImageGenericFilter.txx b/tools/clitkWarpImageGenericFilter.txx index 4c30c4c..84bfbaa 100644 --- a/tools/clitkWarpImageGenericFilter.txx +++ b/tools/clitkWarpImageGenericFilter.txx @@ -28,7 +28,7 @@ ===================================================*/ #include "itkVectorResampleImageFilter.h" -#include "clitkCoeffsToDVF.h" +#include "clitkConvertBLUTCoeffsToVFFilter.h" namespace clitk { @@ -90,7 +90,13 @@ WarpImageGenericFilter::UpdateWithDimAndPixelType() typename DeformationFieldType::Pointer deformationField; if (m_ArgsInfo.coeff_given) { - deformationField = BLUTCoeffsToDVF(m_ArgsInfo.coeff_arg, m_InputFileName, m_Verbose); + typedef ConvertBLUTCoeffsToVFFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); + filter->SetInputFileName(m_ArgsInfo.coeff_arg); + filter->SetLikeFileName(m_InputFileName); + filter->SetVerbose(m_Verbose); + filter->Update(); + deformationField = filter->GetOutput(); } else { //Read the deformation field @@ -126,6 +132,7 @@ WarpImageGenericFilter::UpdateWithDimAndPixelType() resampler =itk::VectorResampleImageFilter::New(); resampler->SetInput(deformationField); resampler->SetOutputSpacing(deformationField->GetSpacing()); + resampler->SetOutputDirection(deformationField->GetDirection()); resampler->SetSize(newSize); resampler->SetOutputOrigin(input->GetOrigin()); resampler->SetInterpolator(genericInterpolator->GetInterpolatorPointer()); @@ -157,6 +164,7 @@ WarpImageGenericFilter::UpdateWithDimAndPixelType() resampler =itk::VectorResampleImageFilter::New(); resampler->SetInput(deformationField); resampler->SetOutputSpacing(input->GetSpacing()); + resampler->SetOutputDirection(deformationField->GetDirection()); resampler->SetSize(newSize); resampler->SetOutputOrigin(input->GetOrigin()); resampler->SetInterpolator(genericInterpolator->GetInterpolatorPointer()); @@ -199,15 +207,12 @@ WarpImageGenericFilter::UpdateWithDimAndPixelType() //Backward mapping typedef itk::WarpImageFilter BackwardWarpFilterType; typename BackwardWarpFilterType::Pointer backwardWarpFilter= BackwardWarpFilterType::New(); -#if ITK_VERSION_MAJOR >= 4 backwardWarpFilter->SetDisplacementField( deformationField ); -#else - backwardWarpFilter->SetDeformationField( deformationField ); -#endif backwardWarpFilter->SetEdgePaddingValue( static_cast(m_ArgsInfo.pad_arg) ); backwardWarpFilter->SetOutputSpacing( deformationField->GetSpacing() ); backwardWarpFilter->SetOutputOrigin( input->GetOrigin() ); backwardWarpFilter->SetOutputSize( deformationField->GetLargestPossibleRegion().GetSize() ); + backwardWarpFilter->SetOutputDirection( input->GetDirection() ); typename itk::VectorResampleImageFilter::Pointer resampler =itk::VectorResampleImageFilter::New(); backwardWarpFilter->SetInterpolator(genericInterpolator->GetInterpolatorPointer());