From 47ac2413c129f2e330a760b665f03e6032aa46fb Mon Sep 17 00:00:00 2001 From: Vivien Delmon Date: Mon, 29 Aug 2011 17:56:18 +0200 Subject: [PATCH] itk4 Rename DeformationField to DisplacementField when necessary --- registration/clitkBLUTDIRGenericFilter.cxx | 12 ++++++++---- registration/clitkBLUTDIRGenericFilter.h | 6 +++++- ...plineDeformableTransformToVFGenericFilter.cxx | 4 ++++ ...BSplineDeformableTransformToVFGenericFilter.h | 6 +++++- ...DemonsDeformableRegistrationGenericFilter.txx | 16 ++++++++++++++-- .../clitkMatrixTransformToVFGenericFilter.h | 6 +++++- .../clitkMatrixTransformToVFGenericFilter.txx | 4 ++++ ...kMultiResolutionPDEDeformableRegistration.txx | 8 ++++++++ ...kShapedBLUTSpatioTemporalDIRGenericFilter.txx | 4 ++++ ...itkBSplineCoefficientsToValuesGenericFilter.h | 6 +++++- ...kBSplineCoefficientsToValuesGenericFilter.txx | 4 ++++ tools/clitkInvertVFGenericFilter.h | 6 +++++- tools/clitkInvertVFGenericFilter.txx | 4 ++++ tools/clitkJacobianImageGenericFilter.h | 6 +++++- tools/clitkWarpImageGenericFilter.txx | 4 ++++ vv/vvImageWarp.cxx | 4 ++++ vv/vvMidPosition.cxx | 4 ++++ 17 files changed, 92 insertions(+), 12 deletions(-) diff --git a/registration/clitkBLUTDIRGenericFilter.cxx b/registration/clitkBLUTDIRGenericFilter.cxx index 15afacf..0822bd9 100644 --- a/registration/clitkBLUTDIRGenericFilter.cxx +++ b/registration/clitkBLUTDIRGenericFilter.cxx @@ -747,21 +747,25 @@ namespace clitk // Compute the DVF (only deformable transform) //======================================================= typedef itk::Vector< float, SpaceDimension > DisplacementType; - typedef itk::Image< DisplacementType, InputImageType::ImageDimension > DeformationFieldType; - typedef itk::TransformToDeformationFieldSource ConvertorType; + typedef itk::Image< DisplacementType, InputImageType::ImageDimension > DisplacementFieldType; +#if ITK_VERSION_MAJOR >= 4 + typedef itk::TransformToDisplacementFieldSource ConvertorType; +#else + typedef itk::TransformToDeformationFieldSource ConvertorType; +#endif typename ConvertorType::Pointer filter= ConvertorType::New(); filter->SetNumberOfThreads(1); transform->SetBulkTransform(NULL); filter->SetTransform(transform); filter->SetOutputParametersFromImage(fixedImage); filter->Update(); - typename DeformationFieldType::Pointer field = filter->GetOutput(); + typename DisplacementFieldType::Pointer field = filter->GetOutput(); //======================================================= // Write the DVF //======================================================= - typedef itk::ImageFileWriter< DeformationFieldType > FieldWriterType; + typedef itk::ImageFileWriter< DisplacementFieldType > FieldWriterType; typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New(); fieldWriter->SetFileName( m_ArgsInfo.vf_arg ); fieldWriter->SetInput( field ); diff --git a/registration/clitkBLUTDIRGenericFilter.h b/registration/clitkBLUTDIRGenericFilter.h index d867caa..eda242f 100644 --- a/registration/clitkBLUTDIRGenericFilter.h +++ b/registration/clitkBLUTDIRGenericFilter.h @@ -60,7 +60,11 @@ #include "itkLabelGeometryImageFilter.h" #include "itkImageDuplicator.h" #include "itkExtractImageFilter.h" -#include "itkTransformToDeformationFieldSource.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkTransformToDisplacementFieldSource.h" +#else + #include "itkTransformToDeformationFieldSource.h" +#endif namespace clitk { diff --git a/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.cxx b/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.cxx index 261a9d8..169de13 100644 --- a/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.cxx +++ b/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.cxx @@ -80,7 +80,11 @@ namespace clitk // ----------------------------------------------- // Filter // ----------------------------------------------- +#if ITK_VERSION_MAJOR >= 4 + typedef itk::TransformToDisplacementFieldSource ConvertorType; +#else typedef itk::TransformToDeformationFieldSource ConvertorType; +#endif ConvertorType::Pointer filter= ConvertorType::New(); //Output image info diff --git a/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.h b/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.h index e976f64..bcdf67b 100644 --- a/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.h +++ b/registration/clitkConvertBSplineDeformableTransformToVFGenericFilter.h @@ -40,7 +40,11 @@ //itk include #include "itkLightObject.h" #include "itkImageMaskSpatialObject.h" -#include "itkTransformToDeformationFieldSource.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkTransformToDisplacementFieldSource.h" +#else + #include "itkTransformToDeformationFieldSource.h" +#endif namespace clitk diff --git a/registration/clitkDemonsDeformableRegistrationGenericFilter.txx b/registration/clitkDemonsDeformableRegistrationGenericFilter.txx index 90d5319..6132dc5 100644 --- a/registration/clitkDemonsDeformableRegistrationGenericFilter.txx +++ b/registration/clitkDemonsDeformableRegistrationGenericFilter.txx @@ -151,8 +151,12 @@ namespace clitk //find the multiresolution filter // typedef typename RegistrationFilterType::FixedImageType InternalImageType; // typedef typename RegistrationFilterType::MovingImageType MovingImageType; - typedef typename RegistrationFilterType::DeformationFieldType DeformationFieldType; - typedef clitk::MultiResolutionPDEDeformableRegistration MultiResolutionRegistrationType; +#if ITK_VERSION_MAJOR >= 4 + typedef typename RegistrationFilterType::DisplacementFieldType DisplacementFieldType; +#else + typedef typename RegistrationFilterType::DeformationFieldType DisplacementFieldType; +#endif + typedef clitk::MultiResolutionPDEDeformableRegistration MultiResolutionRegistrationType; typedef CommandResolutionLevelUpdate LevelObserver; protected: @@ -533,7 +537,11 @@ namespace clitk //JV TODO // pdeFilter->SetMaximumError(m_ArgsInfo.maxError_arg); // pdeFilter->SetMaximumKernelWidth(m_ArgsInfo.maxError_arg); +#if ITK_VERSION_MAJOR >= 4 + pdeFilter->SetSmoothDisplacementField(!m_ArgsInfo.fluid_flag); +#else pdeFilter->SetSmoothDeformationField(!m_ArgsInfo.fluid_flag); +#endif pdeFilter->SetSmoothUpdateField(m_ArgsInfo.fluid_flag); pdeFilter->SetUseImageSpacing( m_ArgsInfo.spacing_flag ); @@ -599,7 +607,11 @@ namespace clitk typedef itk::WarpImageFilter< MovingImageType, FixedImageType, DeformationFieldType > WarpFilterType; typename WarpFilterType::Pointer warp = WarpFilterType::New(); +#if ITK_VERSION_MAJOR >= 4 + warp->SetDisplacementField( deformationField ); +#else warp->SetDeformationField( deformationField ); +#endif warp->SetInput( movingImageReader->GetOutput() ); warp->SetOutputOrigin( fixedImage->GetOrigin() ); warp->SetOutputSpacing( fixedImage->GetSpacing() ); diff --git a/registration/clitkMatrixTransformToVFGenericFilter.h b/registration/clitkMatrixTransformToVFGenericFilter.h index 34648cb..717e938 100644 --- a/registration/clitkMatrixTransformToVFGenericFilter.h +++ b/registration/clitkMatrixTransformToVFGenericFilter.h @@ -36,7 +36,11 @@ //itk include #include "itkLightObject.h" -#include "itkTransformToDeformationFieldSource.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkTransformToDisplacementFieldSource.h" +#else + #include "itkTransformToDeformationFieldSource.h" +#endif #include "itkAffineTransform.h" namespace clitk diff --git a/registration/clitkMatrixTransformToVFGenericFilter.txx b/registration/clitkMatrixTransformToVFGenericFilter.txx index 0540a13..ebc0e45 100644 --- a/registration/clitkMatrixTransformToVFGenericFilter.txx +++ b/registration/clitkMatrixTransformToVFGenericFilter.txx @@ -78,7 +78,11 @@ namespace clitk typedef itk::Image OutputImageType; // Filter +#if ITK_VERSION_MAJOR >= 4 + typedef itk::TransformToDisplacementFieldSource ConvertorType; +#else typedef itk::TransformToDeformationFieldSource ConvertorType; +#endif typename ConvertorType::Pointer filter= ConvertorType::New(); // Output image info diff --git a/registration/clitkMultiResolutionPDEDeformableRegistration.txx b/registration/clitkMultiResolutionPDEDeformableRegistration.txx index a10942c..5c6b0ae 100644 --- a/registration/clitkMultiResolutionPDEDeformableRegistration.txx +++ b/registration/clitkMultiResolutionPDEDeformableRegistration.txx @@ -335,7 +335,11 @@ MultiResolutionPDEDeformableRegistration= 4 + m_RegistrationFilter->SetInitialDisplacementField( NULL ); +#else m_RegistrationFilter->SetInitialDeformationField( NULL ); +#endif } else { @@ -357,7 +361,11 @@ MultiResolutionPDEDeformableRegistrationGetOutput(); tempField->DisconnectPipeline(); +#if ITK_VERSION_MAJOR >= 4 + m_RegistrationFilter->SetInitialDisplacementField( tempField ); +#else m_RegistrationFilter->SetInitialDeformationField( tempField ); +#endif } diff --git a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx b/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx index 5434b22..963fb78 100644 --- a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx +++ b/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx @@ -819,7 +819,11 @@ namespace clitk typedef itk::WarpImageFilter< MovingImageType, FixedImageType, DeformationField4DType > WarpFilterType; typename WarpFilterType::Pointer warp = WarpFilterType::New(); +#if ITK_VERSION_MAJOR >= 4 + warp->SetDisplacementField( field4D ); +#else warp->SetDeformationField( field4D ); +#endif warp->SetInput( movingImageReader->GetOutput() ); warp->SetOutputOrigin( fixedImage->GetOrigin() ); warp->SetOutputSpacing( fixedImage->GetSpacing() ); diff --git a/tools/clitkBSplineCoefficientsToValuesGenericFilter.h b/tools/clitkBSplineCoefficientsToValuesGenericFilter.h index ff10232..184cc4f 100644 --- a/tools/clitkBSplineCoefficientsToValuesGenericFilter.h +++ b/tools/clitkBSplineCoefficientsToValuesGenericFilter.h @@ -41,7 +41,11 @@ #include "itkBSplineResampleImageFunction.h" #include "clitkVectorBSplineResampleImageFunction.h" #include "itkAddImageFilter.h" -#include "itkTransformToDeformationFieldSource.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkTransformToDisplacementFieldSource.h" +#else + #include "itkTransformToDeformationFieldSource.h" +#endif namespace clitk { diff --git a/tools/clitkBSplineCoefficientsToValuesGenericFilter.txx b/tools/clitkBSplineCoefficientsToValuesGenericFilter.txx index a215649..0111db2 100644 --- a/tools/clitkBSplineCoefficientsToValuesGenericFilter.txx +++ b/tools/clitkBSplineCoefficientsToValuesGenericFilter.txx @@ -284,7 +284,11 @@ namespace clitk // Matrix Transform if(m_ArgsInfo.matrix_given) { +#if ITK_VERSION_MAJOR >= 4 + typedef itk::TransformToDisplacementFieldSource ConvertorType; +#else typedef itk::TransformToDeformationFieldSource ConvertorType; +#endif typename ConvertorType::Pointer filter= ConvertorType::New(); filter->SetOutputParametersFromImage(output); diff --git a/tools/clitkInvertVFGenericFilter.h b/tools/clitkInvertVFGenericFilter.h index a320798..012524c 100644 --- a/tools/clitkInvertVFGenericFilter.h +++ b/tools/clitkInvertVFGenericFilter.h @@ -36,7 +36,11 @@ //itk include #include "itkLightObject.h" -#include "itkInverseDeformationFieldImageFilter.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkInverseDisplacementFieldImageFilter.h" +#else + #include "itkInverseDeformationFieldImageFilter.h" +#endif namespace clitk { diff --git a/tools/clitkInvertVFGenericFilter.txx b/tools/clitkInvertVFGenericFilter.txx index b9641fa..9835c2e 100644 --- a/tools/clitkInvertVFGenericFilter.txx +++ b/tools/clitkInvertVFGenericFilter.txx @@ -148,7 +148,11 @@ InvertVFGenericFilter::UpdateWithDimAndPixelType() case 1: { // Create the InverseDeformationFieldFilter +#if ITK_VERSION_MAJOR >= 4 + typedef itk::InverseDisplacementFieldImageFilter FilterType; +#else typedef itk::InverseDeformationFieldImageFilter FilterType; +#endif typename FilterType::Pointer filter =FilterType::New(); filter->SetInput(input); filter->SetOutputOrigin(input->GetOrigin()); diff --git a/tools/clitkJacobianImageGenericFilter.h b/tools/clitkJacobianImageGenericFilter.h index f549719..73e9b64 100644 --- a/tools/clitkJacobianImageGenericFilter.h +++ b/tools/clitkJacobianImageGenericFilter.h @@ -35,7 +35,11 @@ //itk include #include "itkLightObject.h" -#include "itkInverseDeformationFieldImageFilter.h" +#if ITK_VERSION_MAJOR >= 4 + #include "itkInverseDisplacementFieldImageFilter.h" +#else + #include "itkInverseDeformationFieldImageFilter.h" +#endif namespace clitk { diff --git a/tools/clitkWarpImageGenericFilter.txx b/tools/clitkWarpImageGenericFilter.txx index 2ecc5d5..8544df2 100644 --- a/tools/clitkWarpImageGenericFilter.txx +++ b/tools/clitkWarpImageGenericFilter.txx @@ -192,7 +192,11 @@ 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() ); diff --git a/vv/vvImageWarp.cxx b/vv/vvImageWarp.cxx index 1cfde16..ff65803 100644 --- a/vv/vvImageWarp.cxx +++ b/vv/vvImageWarp.cxx @@ -101,7 +101,11 @@ void vvImageWarp::Update_WithDimAndPixelType() jacobian_filter->SetUseImageSpacingOn(); vf_connector->SetInput(mVF->GetVTKImages()[num]); warp_filter->SetInput(input[num]); +#if ITK_VERSION_MAJOR >= 4 + warp_filter->SetDisplacementField(vf_connector->GetOutput()); +#else warp_filter->SetDeformationField(vf_connector->GetOutput()); +#endif jacobian_filter->SetInput(vf_connector->GetOutput()); warp_filter->SetOutputSpacing(input[num]->GetSpacing()); warp_filter->SetOutputOrigin(input[num]->GetOrigin()); diff --git a/vv/vvMidPosition.cxx b/vv/vvMidPosition.cxx index 88b176d..b4582e2 100644 --- a/vv/vvMidPosition.cxx +++ b/vv/vvMidPosition.cxx @@ -108,7 +108,11 @@ vvImage::Pointer WarpRefImage(OutputVFType::Pointer vf,vvImage::Pointer image,in typename FilterType::Pointer warp_filter = FilterType::New(); warp_filter->SetInput(input); +#if ITK_VERSION_MAJOR >= 4 + warp_filter->SetDisplacementField(resampler->GetOutput()); +#else warp_filter->SetDeformationField(resampler->GetOutput()); +#endif warp_filter->SetOutputSpacing(input->GetSpacing()); warp_filter->SetOutputOrigin(input->GetOrigin()); warp_filter->SetOutputSize(input->GetLargestPossibleRegion().GetSize()); -- 2.47.1