From: Simon Rit Date: Tue, 10 Apr 2018 12:29:04 +0000 (+0200) Subject: COMP: fix compilation errors for ITKv5 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=266d6bcb4df9306d4c93cd0229cb59d7811d9825;p=clitk.git COMP: fix compilation errors for ITKv5 --- diff --git a/common/clitkImageCommon.cxx b/common/clitkImageCommon.cxx index 83b9435..9193160 100644 --- a/common/clitkImageCommon.cxx +++ b/common/clitkImageCommon.cxx @@ -66,7 +66,7 @@ itk::ImageIOBase::Pointer clitk::readImageHeader(const std::string & filename, b if (!reader) { if (exit_on_error) { //default behavior for tools who don't handle the problem clitkExceptionMacro("Error reading file " << filename << ", exiting immediately"); - } else return NULL; + } else return (itk::ImageIOBase *) ITK_NULLPTR; } reader->SetFileName(filename); reader->ReadImageInformation(); diff --git a/common/clitkImageToImageGenericFilterBase.cxx b/common/clitkImageToImageGenericFilterBase.cxx index 9db15b0..c538ac0 100644 --- a/common/clitkImageToImageGenericFilterBase.cxx +++ b/common/clitkImageToImageGenericFilterBase.cxx @@ -412,7 +412,7 @@ typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsig return typename ImageType::Pointer(const_cast(vvImageToITK(m_InputVVImages[n]).GetPointer())); else { assert(false); //No input, this shouldn't happen - return typename ImageType::Pointer(NULL); + return typename ImageType::Pointer((ImageType*)ITK_NULLPTR); } } } diff --git a/registration/clitkAffineRegistrationGenericFilter.cxx b/registration/clitkAffineRegistrationGenericFilter.cxx index f369e05..17ebca9 100644 --- a/registration/clitkAffineRegistrationGenericFilter.cxx +++ b/registration/clitkAffineRegistrationGenericFilter.cxx @@ -321,7 +321,7 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType() // If given, we connect a mask to reference or target //============================================================================ typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType; - typename MaskType::Pointer fixedMask=NULL; + typename MaskType::Pointer fixedMask=ITK_NULLPTR; if (m_ArgsInfo.referenceMask_given) { fixedMask= MaskType::New(); typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageMaskType; @@ -342,7 +342,7 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType() } typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType; - typename MaskType::Pointer movingMask=NULL; + typename MaskType::Pointer movingMask=ITK_NULLPTR; if (m_ArgsInfo.targetMask_given) { movingMask= MaskType::New(); typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageMaskType; diff --git a/registration/clitkBLUTDIRGenericFilter.cxx b/registration/clitkBLUTDIRGenericFilter.cxx index 60cd30d..35ac6eb 100644 --- a/registration/clitkBLUTDIRGenericFilter.cxx +++ b/registration/clitkBLUTDIRGenericFilter.cxx @@ -246,7 +246,7 @@ namespace clitk m_CommandIterationUpdate->SetOptimizer(m_GenericOptimizer); // Set the previous transform parameters to the registration - // if(m_Initializer->m_Parameters!=NULL )delete m_Initializer->m_Parameters; + // if(m_Initializer->m_Parameters!=ITK_NULLPTR )delete m_Initializer->m_Parameters; m_Initializer->SetInitialParameters(currentCoefficientImages, *newParameters); registration->SetInitialTransformParametersOfNextLevel(*newParameters); } @@ -338,8 +338,8 @@ namespace clitk //============================================================================ typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType; typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageLabelType; - typename MaskType::Pointer fixedMask = NULL; - typename ImageLabelType::Pointer labels = NULL; + typename MaskType::Pointer fixedMask = ITK_NULLPTR; + typename ImageLabelType::Pointer labels = ITK_NULLPTR; if (m_ArgsInfo.referenceMask_given) { fixedMask = MaskType::New(); @@ -413,7 +413,7 @@ namespace clitk } typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType; - typename MaskType::Pointer movingMask=NULL; + typename MaskType::Pointer movingMask=ITK_NULLPTR; if (m_ArgsInfo.targetMask_given) { movingMask= MaskType::New(); @@ -486,7 +486,7 @@ namespace clitk // Rigid or Affine Transform //======================================================= typedef itk::AffineTransform RigidTransformType; - RigidTransformType::Pointer rigidTransform=NULL; + RigidTransformType::Pointer rigidTransform=ITK_NULLPTR; if (m_ArgsInfo.initMatrix_given) { if(m_Verbose) std::cout<<"Reading the prior transform matrix "<< m_ArgsInfo.initMatrix_arg<<"..."<SetGridRegion( transform->GetTransforms()[0]->GetGridRegion() ); sTransform->SetParameters( transform->GetTransforms()[0]->GetParameters() ); regTransform = sTransform; - transform = NULL; // free memory + transform = ITK_NULLPTR; // free memory } //======================================================= @@ -795,9 +795,9 @@ namespace clitk typename ConvertorType::Pointer filter= ConvertorType::New(); filter->SetNumberOfThreads(1); if(m_ArgsInfo.itkbspline_flag) - sTransform->SetBulkTransform(NULL); + sTransform->SetBulkTransform(ITK_NULLPTR); else - transform->SetBulkTransform(NULL); + transform->SetBulkTransform(ITK_NULLPTR); filter->SetTransform(regTransform); #if ITK_VERSION_MAJOR > 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 6) filter->SetReferenceImage(fixedImage); diff --git a/registration/clitkConvertBLUTCoeffsToVFFilter.txx b/registration/clitkConvertBLUTCoeffsToVFFilter.txx index 9bda80f..da20e6b 100644 --- a/registration/clitkConvertBLUTCoeffsToVFFilter.txx +++ b/registration/clitkConvertBLUTCoeffsToVFFilter.txx @@ -107,7 +107,7 @@ namespace clitk // Mask typedef itk::ImageMaskSpatialObject MaskType; - typename MaskType::Pointer spatialObjectMask=NULL; + typename MaskType::Pointer spatialObjectMask=ITK_NULLPTR; if (!m_MaskFileName.empty()) { typedef itk::Image< unsigned char, BLUTCoefficientImageType::ImageDimension > ImageMaskType; diff --git a/registration/clitkGenericMetric.txx b/registration/clitkGenericMetric.txx index 852c19f..d4a19c2 100644 --- a/registration/clitkGenericMetric.txx +++ b/registration/clitkGenericMetric.txx @@ -31,13 +31,13 @@ namespace clitk template GenericMetric::GenericMetric() { - m_Metric=NULL; + m_Metric=ITK_NULLPTR; m_Maximize=false; m_Verbose=false; m_FixedImageRegionGiven=false; m_FixedImageSamplesIntensityThreshold=0; m_UseFixedImageSamplesIntensityThreshold=false; - m_FixedImageMask=NULL; + m_FixedImageMask=ITK_NULLPTR; } @@ -255,7 +255,7 @@ GenericMetric::GetMetricPointer( typedef itk::ImageMaskSpatialObject ImageMaskSpatialObjectType; - typename ImageMaskSpatialObjectType::ConstPointer mask = NULL; + typename ImageMaskSpatialObjectType::ConstPointer mask = ITK_NULLPTR; if (m_FixedImageMask.IsNotNull()) mask = dynamic_cast(m_FixedImageMask.GetPointer()); diff --git a/registration/clitkMultiResolutionPDEDeformableRegistration.txx b/registration/clitkMultiResolutionPDEDeformableRegistration.txx index 43fd978..c8312e6 100644 --- a/registration/clitkMultiResolutionPDEDeformableRegistration.txx +++ b/registration/clitkMultiResolutionPDEDeformableRegistration.txx @@ -43,7 +43,7 @@ MultiResolutionPDEDeformableRegistration ::GenerateData() { - // Check for NULL images and pointers + // Check for ITK_NULLPTR images and pointers MovingImageConstPointer movingImage = this->GetMovingImage(); FixedImageConstPointer fixedImage = this->GetFixedImage(); @@ -266,7 +266,7 @@ MultiResolutionPDEDeformableRegistrationGetNumberOfLevels() ); - DeformationFieldPointer tempField = NULL; + DeformationFieldPointer tempField = ITK_NULLPTR; DeformationFieldPointer inputPtr = const_cast< DeformationFieldType * >( this->GetInput(0) ); @@ -323,7 +323,7 @@ MultiResolutionPDEDeformableRegistrationSetOutputDirection( fi->GetDirection()); m_FieldExpander->UpdateLargestPossibleRegion(); - m_FieldExpander->SetInput( NULL ); + m_FieldExpander->SetInput( ITK_NULLPTR ); tempField = m_FieldExpander->GetOutput(); tempField->DisconnectPipeline(); } @@ -335,7 +335,7 @@ MultiResolutionPDEDeformableRegistrationSetInitialDisplacementField( NULL ); + m_RegistrationFilter->SetInitialDisplacementField( ITK_NULLPTR ); } else { @@ -353,7 +353,7 @@ MultiResolutionPDEDeformableRegistrationSetOutputSpacing( fi->GetSpacing()); m_FieldExpander->UpdateLargestPossibleRegion(); - m_FieldExpander->SetInput( NULL ); + m_FieldExpander->SetInput( ITK_NULLPTR ); tempField = m_FieldExpander->GetOutput(); tempField->DisconnectPipeline(); @@ -430,9 +430,9 @@ MultiResolutionPDEDeformableRegistrationSetInput( NULL ); + m_FieldExpander->SetInput( ITK_NULLPTR ); m_FieldExpander->GetOutput()->ReleaseData(); - m_RegistrationFilter->SetInput( NULL ); + m_RegistrationFilter->SetInput( ITK_NULLPTR ); m_RegistrationFilter->GetOutput()->ReleaseData(); } diff --git a/segmentation/clitkExtractBonesGenericFilter.txx b/segmentation/clitkExtractBonesGenericFilter.txx index c2efe52..4773430 100644 --- a/segmentation/clitkExtractBonesGenericFilter.txx +++ b/segmentation/clitkExtractBonesGenericFilter.txx @@ -38,7 +38,7 @@ template template void clitk::ExtractBonesGenericFilter::InitializeImageType() { - ADD_IMAGE_TYPE(Dim, short); + //ADD_IMAGE_TYPE(Dim, short); // ADD_IMAGE_TYPE(Dim, int); ADD_IMAGE_TYPE(Dim, float); } diff --git a/tools/clitkAnisotropicDiffusionGenericFilter.cxx b/tools/clitkAnisotropicDiffusionGenericFilter.cxx index 408fe7f..0960891 100644 --- a/tools/clitkAnisotropicDiffusionGenericFilter.cxx +++ b/tools/clitkAnisotropicDiffusionGenericFilter.cxx @@ -44,7 +44,8 @@ AnisotropicDiffusionGenericFilter::AnisotropicDiffusionGenericFilter(): template void AnisotropicDiffusionGenericFilter::InitializeImageType() { - ADD_DEFAULT_IMAGE_TYPES(Dim); + ADD_IMAGE_TYPE(Dim, float); + ADD_IMAGE_TYPE(Dim, double); } //-------------------------------------------------------------------- diff --git a/tools/clitkCropImageGenericFilter.cxx b/tools/clitkCropImageGenericFilter.cxx index c3343f6..4adcb9b 100644 --- a/tools/clitkCropImageGenericFilter.cxx +++ b/tools/clitkCropImageGenericFilter.cxx @@ -69,7 +69,7 @@ typename clitk::CropImageGenericFilter::AutoCrop::ImagePointer clitk::CropImageGenericFilter::AutoCrop::Do(args_info_type &, ImagePointer, PixelDimType *) { clitkExceptionMacro("Autocrop is not implemented for vector fields"); - return NULL; + return ITK_NULLPTR; } //-------------------------------------------------------------------- diff --git a/tools/clitkImageArithmGenericFilter.txx b/tools/clitkImageArithmGenericFilter.txx index eecbbcc..ba1fc6f 100644 --- a/tools/clitkImageArithmGenericFilter.txx +++ b/tools/clitkImageArithmGenericFilter.txx @@ -109,7 +109,7 @@ void ImageArithmGenericFilter::UpdateWithInputImageType() IteratorType it(input1, input1->GetLargestPossibleRegion()); // typedef input2 - typename ImageType::Pointer input2 = NULL; + typename ImageType::Pointer input2 = ITK_NULLPTR; IteratorType it2; // Special case for normalisation diff --git a/tools/clitkImageGradientMagnitudeGenericFilter.txx b/tools/clitkImageGradientMagnitudeGenericFilter.txx index 1df5601..7aecf99 100644 --- a/tools/clitkImageGradientMagnitudeGenericFilter.txx +++ b/tools/clitkImageGradientMagnitudeGenericFilter.txx @@ -102,7 +102,7 @@ namespace clitk // Reading input typename InputImageType::Pointer input = this->template GetInput(0); - typename MaskImageType::Pointer mask = NULL; + typename MaskImageType::Pointer mask = ITK_NULLPTR; if(mArgsInfo.mask_given) { mask = this->template GetInput(1); } diff --git a/tools/clitkImageIntensityWindowingGenericFilter.txx b/tools/clitkImageIntensityWindowingGenericFilter.txx index 02f4acd..96f7c7e 100644 --- a/tools/clitkImageIntensityWindowingGenericFilter.txx +++ b/tools/clitkImageIntensityWindowingGenericFilter.txx @@ -95,7 +95,7 @@ ImageIntensityWindowingGenericFilter::UpdateWithInputImageType() // Reading input typename OutputImageType::Pointer input = this->template GetInput(0); - typename MaskImageType::Pointer mask = NULL; + typename MaskImageType::Pointer mask = ITK_NULLPTR; if(mArgsInfo.mask_given) { mask = this->template GetInput(1); } diff --git a/tools/clitkImageLaplacianGenericFilter.txx b/tools/clitkImageLaplacianGenericFilter.txx index ba36d18..4ff1ef3 100644 --- a/tools/clitkImageLaplacianGenericFilter.txx +++ b/tools/clitkImageLaplacianGenericFilter.txx @@ -102,7 +102,7 @@ ImageLaplacianGenericFilter::UpdateWithInputImageType() castFilter->SetInput(input); castFilter->Update(); - typename MaskImageType::Pointer mask = NULL; + typename MaskImageType::Pointer mask = ITK_NULLPTR; if(mArgsInfo.mask_given) { mask = this->template GetInput(1); } diff --git a/tools/clitkNormalizeImageFilterGenericFilter.txx b/tools/clitkNormalizeImageFilterGenericFilter.txx index 99a43a4..e6911af 100644 --- a/tools/clitkNormalizeImageFilterGenericFilter.txx +++ b/tools/clitkNormalizeImageFilterGenericFilter.txx @@ -94,7 +94,7 @@ namespace clitk // Reading input typename InputImageType::Pointer input = this->template GetInput(0); - typename MaskImageType::Pointer mask = NULL; + typename MaskImageType::Pointer mask = ITK_NULLPTR; if(mArgsInfo.mask_given) { mask = this->template GetInput(1); } diff --git a/tools/clitkSplitImageGenericFilter.cxx b/tools/clitkSplitImageGenericFilter.cxx index a73d308..58732ab 100644 --- a/tools/clitkSplitImageGenericFilter.cxx +++ b/tools/clitkSplitImageGenericFilter.cxx @@ -54,7 +54,7 @@ clitk::SplitImageGenericFilter::PngConversion::Do(double window, ImagePointer input) { static const unsigned int PixelDimension = itk::PixelTraits::Dimension; - return this->Do(window, level, input, static_cast< PixelDimType *>(NULL) ); + return this->Do(window, level, input, static_cast< PixelDimType *>(ITK_NULLPTR) ); } //-------------------------------------------------------------------- @@ -68,7 +68,7 @@ clitk::SplitImageGenericFilter::PngConversion::Do(double window, PixelDimType *) { clitkExceptionMacro("Png conversion is not implemented for vector fields"); - return NULL; + return ITK_NULLPTR; } //-------------------------------------------------------------------- diff --git a/tools/clitkVFResampleGenericFilter.cxx b/tools/clitkVFResampleGenericFilter.cxx index 4175215..d287fec 100644 --- a/tools/clitkVFResampleGenericFilter.cxx +++ b/tools/clitkVFResampleGenericFilter.cxx @@ -92,17 +92,17 @@ clitk::VFResampleGenericFilter::ComputeImage(typename ImageType::Pointer inputIm static unsigned int dim = ImageType::ImageDimension; if (mOutputSize.size() != dim) { std::cerr << "Please set size with " << dim << " dimensions." << std::endl; - return NULL; + return ITK_NULLPTR; } if (mOutputSpacing.size() != dim) { std::cerr << "Please set spacing with " << dim << " dimensions." << std::endl; - return NULL; + return ITK_NULLPTR; } mOutputOrigin.resize(dim); if (mApplyGaussianFilterBefore && mSigma.size() != dim) { std::cerr << "Please set sigma with " << dim << " dimensions." << std::endl; - return NULL; + return ITK_NULLPTR; } // Some typedefs diff --git a/tools/clitkVectorArithmGenericFilter.txx b/tools/clitkVectorArithmGenericFilter.txx index 50e36dd..b4d6127 100644 --- a/tools/clitkVectorArithmGenericFilter.txx +++ b/tools/clitkVectorArithmGenericFilter.txx @@ -118,7 +118,7 @@ void VectorArithmGenericFilter::UpdateWithInputImageType() IteratorType it(input1, input1->GetLargestPossibleRegion()); // typedef input2 - typename ImageType::Pointer input2 = NULL; + typename ImageType::Pointer input2 = ITK_NULLPTR; IteratorType it2; // Special case for normalisation diff --git a/vv/vvMeshActor.cxx b/vv/vvMeshActor.cxx index 1d6f19b..b3d3c7f 100644 --- a/vv/vvMeshActor.cxx +++ b/vv/vvMeshActor.cxx @@ -27,9 +27,9 @@ #include vvMeshActor::vvMeshActor() : - mCutDimension(0), mMesh(NULL), - mMarching(NULL), mMapper(NULL), - mActor(NULL), + mCutDimension(0), mMesh(ITK_NULLPTR), + mMarching(ITK_NULLPTR), mMapper(ITK_NULLPTR), + mActor(ITK_NULLPTR), mSuperpostionMode(false), mTimeSlice(0) {} diff --git a/vv/vvMeshActor.h b/vv/vvMeshActor.h index 61cee8f..37bb0dc 100644 --- a/vv/vvMeshActor.h +++ b/vv/vvMeshActor.h @@ -37,7 +37,7 @@ public: void SetCutSlice(double slice); /**Initialize the actor and set the inputs. If vf is not null, will use **it to propagate the contour on all time frames */ - void Init(vvMesh::Pointer mesh,int time_slice, vvImage::Pointer vf=NULL); + void Init(vvMesh::Pointer mesh,int time_slice, vvImage::Pointer vf=ITK_NULLPTR); ///Set the time slice (only useful when using a 4D contour) void SetTimeSlice(int time); ///Toggles between normal 4D mode and superposition mode