// Compute the DVF (only deformable transform)
//=======================================================
typedef itk::Vector< float, SpaceDimension > DisplacementType;
- typedef itk::Image< DisplacementType, InputImageType::ImageDimension > DeformationFieldType;
- typedef itk::TransformToDeformationFieldSource<DeformationFieldType, double> ConvertorType;
+ typedef itk::Image< DisplacementType, InputImageType::ImageDimension > DisplacementFieldType;
+#if ITK_VERSION_MAJOR >= 4
+ typedef itk::TransformToDisplacementFieldSource<DisplacementFieldType, double> ConvertorType;
+#else
+ typedef itk::TransformToDeformationFieldSource<DisplacementFieldType, double> 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 );
#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
{
// -----------------------------------------------
// Filter
// -----------------------------------------------
+#if ITK_VERSION_MAJOR >= 4
+ typedef itk::TransformToDisplacementFieldSource<OutputImageType, double> ConvertorType;
+#else
typedef itk::TransformToDeformationFieldSource<OutputImageType, double> ConvertorType;
+#endif
ConvertorType::Pointer filter= ConvertorType::New();
//Output image info
//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
//find the multiresolution filter
// typedef typename RegistrationFilterType::FixedImageType InternalImageType;
// typedef typename RegistrationFilterType::MovingImageType MovingImageType;
- typedef typename RegistrationFilterType::DeformationFieldType DeformationFieldType;
- typedef clitk::MultiResolutionPDEDeformableRegistration<FixedImageType, MovingImageType, DeformationFieldType> MultiResolutionRegistrationType;
+#if ITK_VERSION_MAJOR >= 4
+ typedef typename RegistrationFilterType::DisplacementFieldType DisplacementFieldType;
+#else
+ typedef typename RegistrationFilterType::DeformationFieldType DisplacementFieldType;
+#endif
+ typedef clitk::MultiResolutionPDEDeformableRegistration<FixedImageType, MovingImageType, DisplacementFieldType> MultiResolutionRegistrationType;
typedef CommandResolutionLevelUpdate<MultiResolutionRegistrationType> LevelObserver;
protected:
//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 );
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() );
//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
typedef itk::Image<Displacement, Dimension> OutputImageType;
// Filter
+#if ITK_VERSION_MAJOR >= 4
+ typedef itk::TransformToDisplacementFieldSource<OutputImageType, double> ConvertorType;
+#else
typedef itk::TransformToDeformationFieldSource<OutputImageType, double> ConvertorType;
+#endif
typename ConvertorType::Pointer filter= ConvertorType::New();
// Output image info
if( tempField.IsNull() )
{
+#if ITK_VERSION_MAJOR >= 4
+ m_RegistrationFilter->SetInitialDisplacementField( NULL );
+#else
m_RegistrationFilter->SetInitialDeformationField( NULL );
+#endif
}
else
{
tempField = m_FieldExpander->GetOutput();
tempField->DisconnectPipeline();
+#if ITK_VERSION_MAJOR >= 4
+ m_RegistrationFilter->SetInitialDisplacementField( tempField );
+#else
m_RegistrationFilter->SetInitialDeformationField( tempField );
+#endif
}
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() );
#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
{
// Matrix Transform
if(m_ArgsInfo.matrix_given)
{
+#if ITK_VERSION_MAJOR >= 4
+ typedef itk::TransformToDisplacementFieldSource<OutputImageType, double> ConvertorType;
+#else
typedef itk::TransformToDeformationFieldSource<OutputImageType, double> ConvertorType;
+#endif
typename ConvertorType::Pointer filter= ConvertorType::New();
filter->SetOutputParametersFromImage(output);
//itk include
#include "itkLightObject.h"
-#include "itkInverseDeformationFieldImageFilter.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkInverseDisplacementFieldImageFilter.h"
+#else
+ #include "itkInverseDeformationFieldImageFilter.h"
+#endif
namespace clitk
{
case 1: {
// Create the InverseDeformationFieldFilter
+#if ITK_VERSION_MAJOR >= 4
+ typedef itk::InverseDisplacementFieldImageFilter<InputImageType,OutputImageType> FilterType;
+#else
typedef itk::InverseDeformationFieldImageFilter<InputImageType,OutputImageType> FilterType;
+#endif
typename FilterType::Pointer filter =FilterType::New();
filter->SetInput(input);
filter->SetOutputOrigin(input->GetOrigin());
//itk include
#include "itkLightObject.h"
-#include "itkInverseDeformationFieldImageFilter.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkInverseDisplacementFieldImageFilter.h"
+#else
+ #include "itkInverseDeformationFieldImageFilter.h"
+#endif
namespace clitk
{
//Backward mapping
typedef itk::WarpImageFilter<InputImageType, InputImageType, DeformationFieldType> BackwardWarpFilterType;
typename BackwardWarpFilterType::Pointer backwardWarpFilter= BackwardWarpFilterType::New();
+#if ITK_VERSION_MAJOR >= 4
+ backwardWarpFilter->SetDisplacementField( deformationField );
+#else
backwardWarpFilter->SetDeformationField( deformationField );
+#endif
backwardWarpFilter->SetEdgePaddingValue( static_cast<PixelType>(m_ArgsInfo.pad_arg) );
backwardWarpFilter->SetOutputSpacing( deformationField->GetSpacing() );
backwardWarpFilter->SetOutputOrigin( input->GetOrigin() );
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());
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());