X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=registration%2FclitkDemonsDeformableRegistrationGenericFilter.txx;h=0c49dd790d771d481282ebf73c49d8f7de95d8d2;hb=HEAD;hp=887676e3ddb0a874313a9243e69cb3bc5846d987;hpb=413cf925a4e665aacd68d0a3eb9328818ac3abde;p=clitk.git diff --git a/registration/clitkDemonsDeformableRegistrationGenericFilter.txx b/registration/clitkDemonsDeformableRegistrationGenericFilter.txx old mode 100755 new mode 100644 index 887676e..0c49dd7 --- a/registration/clitkDemonsDeformableRegistrationGenericFilter.txx +++ b/registration/clitkDemonsDeformableRegistrationGenericFilter.txx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #ifndef __clitkDemonsDeformableRegistrationGenericFilter_txx #define __clitkDemonsDeformableRegistrationGenericFilter_txx #include "clitkDemonsDeformableRegistrationGenericFilter.h" @@ -151,8 +151,8 @@ 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; + typedef typename RegistrationFilterType::DisplacementFieldType DisplacementFieldType; + typedef clitk::MultiResolutionPDEDeformableRegistration MultiResolutionRegistrationType; typedef CommandResolutionLevelUpdate LevelObserver; protected: @@ -335,7 +335,13 @@ namespace clitk // ======================================================= // The multiresolution scheme // ======================================================= - if (threadsGiven) multiResolutionFilter->SetNumberOfThreads(threads); + if (threadsGiven) { +#if ITK_VERSION_MAJOR <= 4 + multiResolutionFilter->SetNumberOfThreads(threads); +#else + multiResolutionFilter->SetNumberOfWorkUnits(threads); +#endif + } unsigned int nLevels=m_ArgsInfo.levels_arg; if (m_Verbose) std::cout<<"Setting the number of resolution levels to "<SetFixedImage( fixedImage ); @@ -343,8 +349,14 @@ namespace clitk multiResolutionFilter->SetNumberOfLevels( nLevels ); multiResolutionFilter->SetFixedImagePyramid( fixedImagePyramid ); multiResolutionFilter->SetMovingImagePyramid( movingImagePyramid ); - if (threadsGiven) multiResolutionFilter->SetNumberOfThreads( threads ); - + if (threadsGiven) { +#if ITK_VERSION_MAJOR <= 4 + multiResolutionFilter->SetNumberOfThreads( threads ); +#else + multiResolutionFilter->SetNumberOfWorkUnits( threads ); +#endif + } + //------------------------------------ //Set the number of iterations //------------------------------------ @@ -369,7 +381,7 @@ namespace clitk //------------------------------------ //Set the max RMS error for the field update //------------------------------------ - itk::Array maxRMSError(nLevels); + std::vector maxRMSError(nLevels); for (unsigned int i=0 ; i stop(nLevels); + std::vector stop(nLevels); for (unsigned int i=0; i::Pointer levelObserver = CommandResolutionLevelUpdate::New(); multiResolutionFilter->AddObserver( itk::IterationEvent(), levelObserver ); - levelObserver->SetMaxRMSError(maxRMSError); + levelObserver->SetMaxRMSError(&(maxRMSError[0])); levelObserver->SetMaxStep(m_ArgsInfo.maxStep_arg); levelObserver->SetSD(sd); levelObserver->SetScaleStep(m_ArgsInfo.scaleStep_flag); @@ -464,7 +476,7 @@ namespace clitk m->SetIntensityDifferenceThreshold( m_ArgsInfo.intThreshold_arg); m->SetUseMovingImageGradient( m_ArgsInfo.movGrad_flag); typename CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New(); - observer->SetStop(stop); + observer->SetStop(&(stop[0])); observer->SetLevelObserver(levelObserver); m->AddObserver( itk::IterationEvent(), observer ); if (m_Verbose) std::cout<<"Using the demons registration filter..."<SetIntensityDifferenceThreshold( m_ArgsInfo.intThreshold_arg); typename CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New(); - observer->SetStop(stop); + observer->SetStop(&(stop[0])); observer->SetLevelObserver(levelObserver); m->AddObserver( itk::IterationEvent(), observer ); if (m_Verbose) std::cout<<"Using the symmetric forces demons registration filter..."<SetMaximumUpdateStepLength( m_ArgsInfo.maxStep_arg); m->SetUseGradientType(grad); typename CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New(); - observer->SetStop(stop); + observer->SetStop(&(stop[0])); observer->SetLevelObserver(levelObserver); m->AddObserver( itk::IterationEvent(), observer ); if (m_Verbose) std::cout<<"Using the fast symmetric forces demons registration filter..."<SetUseFirstOrderExp(m_ArgsInfo.firstOrder_flag); m->SetUseGradientType(grad); typename CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New(); - observer->SetStop(stop); + observer->SetStop(&(stop[0])); observer->SetLevelObserver(levelObserver); m->AddObserver( itk::IterationEvent(), observer ); if (m_Verbose) std::cout<<"Using the diffeomorphic demons registration filter..."<SetMaximumError(m_ArgsInfo.maxError_arg); // pdeFilter->SetMaximumKernelWidth(m_ArgsInfo.maxError_arg); - pdeFilter->SetSmoothDeformationField(!m_ArgsInfo.fluid_flag); + pdeFilter->SetSmoothDisplacementField(!m_ArgsInfo.fluid_flag); pdeFilter->SetSmoothUpdateField(m_ArgsInfo.fluid_flag); pdeFilter->SetUseImageSpacing( m_ArgsInfo.spacing_flag ); @@ -599,7 +611,7 @@ namespace clitk typedef itk::WarpImageFilter< MovingImageType, FixedImageType, DeformationFieldType > WarpFilterType; typename WarpFilterType::Pointer warp = WarpFilterType::New(); - warp->SetDeformationField( deformationField ); + warp->SetDisplacementField( deformationField ); warp->SetInput( movingImageReader->GetOutput() ); warp->SetOutputOrigin( fixedImage->GetOrigin() ); warp->SetOutputSpacing( fixedImage->GetSpacing() );