From 19b392c26004c2ad4b8c8ac002d1f4b2322afa48 Mon Sep 17 00:00:00 2001 From: Christina Rossmanith Date: Fri, 21 Apr 2017 15:43:58 +0200 Subject: [PATCH] COMP: enable compiling with ITK >= 4.6 --- Applications/DemonsRegistration.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Applications/DemonsRegistration.cxx b/Applications/DemonsRegistration.cxx index 34d64a8..5fd1856 100644 --- a/Applications/DemonsRegistration.cxx +++ b/Applications/DemonsRegistration.cxx @@ -19,8 +19,10 @@ #include #if (ITK_VERSION_MAJOR < 4) #include -#else +#elif (ITK_VERSION_MAJOR == 4) && (ITK_VERSION_MINOR < 6) #include +#else +#include #endif #include #include @@ -746,8 +748,10 @@ void DemonsRegistrationFunction( arguments args ) // Set up the TransformToDeformationFieldFilter #if (ITK_VERSION_MAJOR < 4) typedef itk::TransformToDeformationFieldSource FieldGeneratorType; -#else +#elif (ITK_VERSION_MAJOR == 4) && (ITK_VERSION_MINOR < 6) typedef itk::TransformToDisplacementFieldSource FieldGeneratorType; +#else + typedef itk::TransformToDisplacementFieldFilter FieldGeneratorType; #endif typedef typename FieldGeneratorType::TransformType TransformType; @@ -764,10 +768,17 @@ void DemonsRegistrationFunction( arguments args ) fieldGenerator->SetTransform( trsf ); // fieldGenerator->SetOutputRegion( // fixedImageReader->GetOutput()->GetRequestedRegion()); +#if ( (ITK_VERSION_MAJOR > 4) || ((ITK_VERSION_MAJOR == 4) && (ITK_VERSION_MINOR >= 6)) ) + fieldGenerator->SetSize( + fixedImageReader->GetOutput()->GetRequestedRegion().GetSize() ); + fieldGenerator->SetOutputStartIndex( + fixedImageReader->GetOutput()->GetRequestedRegion().GetIndex() ); +#else fieldGenerator->SetOutputSize( - fixedImageReader->GetOutput()->GetRequestedRegion().GetSize() ); + fixedImageReader->GetOutput()->GetRequestedRegion().GetSize() ); fieldGenerator->SetOutputIndex( fixedImageReader->GetOutput()->GetRequestedRegion().GetIndex() ); +#endif fieldGenerator->SetOutputSpacing( fixedImageReader->GetOutput()->GetSpacing() ); fieldGenerator->SetOutputOrigin(