From 5fc835c9cc62410316da48f1955ac3e81adfdae8 Mon Sep 17 00:00:00 2001 From: Nick Tustison Date: Fri, 1 Nov 2019 09:40:10 -0700 Subject: [PATCH] COMP: Round 8. --- Examples/DeNrrd.cxx | 6 +++--- Examples/ImageSetStatistics.cxx | 3 +-- Examples/antsSliceRegularizedRegistration.cxx | 8 ++++---- .../itkANTSImageRegistrationOptimizer.h | 2 +- .../itkPICSLAdvancedNormalizationToolKit.h | 2 +- .../itkProbabilisticRegistrationFunction.h | 2 +- ...patialMutualInformationRegistrationFunction.h | 2 +- .../itkSyNDemonsRegistrationFunction.h | 2 +- .../antsAtroposSegmentationImageFilter.h | 16 +++++++++------- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Examples/DeNrrd.cxx b/Examples/DeNrrd.cxx index cece1dc83..174b1c8c2 100644 --- a/Examples/DeNrrd.cxx +++ b/Examples/DeNrrd.cxx @@ -155,10 +155,10 @@ int DeNrrd( std::vector args, std::ostream* /*out_stream = nullptr gradientfile.open(output_gradients_filename); gradientfile << "VERSION: 2" << std::endl; - for ( int i=0; i< static_cast( reader->GetOutput()->GetNumberOfComponentsPerPixel() ); i++ ) + for ( unsigned short i=0; i < static_cast( reader->GetOutput()->GetNumberOfComponentsPerPixel() ); i++ ) { - char gradKey[20]; - sprintf( gradKey, "DWMRI_gradient_%04d", i ); + char gradKey[40]; + sprintf( gradKey, "DWMRI_gradient_%04hu", i ); itk::ExposeMetaData(mdd, gradKey, v_string); //std::cout << "Gradient = " << v_string << std::endl; diff --git a/Examples/ImageSetStatistics.cxx b/Examples/ImageSetStatistics.cxx index 805a43bbd..b1bd18df5 100644 --- a/Examples/ImageSetStatistics.cxx +++ b/Examples/ImageSetStatistics.cxx @@ -168,7 +168,6 @@ LocalMean(typename TImage::Pointer image, unsigned int nhood, typename TImage:: typedef itk::ImageRegionIteratorWithIndex Iterator; Iterator outIter(image, image->GetLargestPossibleRegion() ); typename TImage::SizeType imagesize = image->GetLargestPossibleRegion().GetSize(); - constexpr unsigned int ImageDimension = 3; typedef itk::NeighborhoodIterator iteratorType; typename iteratorType::RadiusType rad; @@ -202,7 +201,7 @@ LocalMean(typename TImage::Pointer image, unsigned int nhood, typename TImage:: { typename TImage::IndexType index = hoodIt.GetIndex(indct); bool inimage = true; - for( itk::SizeValueType dd = 0; dd < ImageDimension; dd++ ) + for( itk::SizeValueType dd = 0; dd < TImage::ImageDimension; dd++ ) { if( index[dd] < itk::NumericTraits::ZeroValue() || index[dd] > static_cast( imagesize[dd] - 1) ) { diff --git a/Examples/antsSliceRegularizedRegistration.cxx b/Examples/antsSliceRegularizedRegistration.cxx index 2e29778b6..4b71bc1f0 100644 --- a/Examples/antsSliceRegularizedRegistration.cxx +++ b/Examples/antsSliceRegularizedRegistration.cxx @@ -961,7 +961,7 @@ for ( unsigned int i = 0; i < transformList.size(); i++) VectorIOType vecout; vecout.Fill( 0 ); typename MovingIOImageType::IndexType ind; - for( itk::SizeValueType xx = 0; xx < ImageDimension; xx++ ) + for( itk::SizeValueType xx = 0; xx < MovingIOImageType::ImageDimension; xx++ ) { ind[xx] = vfIter2.GetIndex()[xx]; vecout[xx] = vec[xx]; @@ -971,7 +971,7 @@ for ( unsigned int i = 0; i < transformList.size(); i++) { tdim = timedims - 1; } - ind[ImageDimension-1] = tdim; + ind[MovingIOImageType::ImageDimension-1] = tdim; outputImage->SetPixel(ind, fval); displacementout->SetPixel( ind, vecout ); } @@ -1023,7 +1023,7 @@ for ( unsigned int i = 0; i < transformList.size(); i++) VectorIOType vecout; vecout.Fill( 0 ); typename MovingIOImageType::IndexType ind; - for( itk::SizeValueType xx = 0; xx < ImageDimension; xx++ ) + for( itk::SizeValueType xx = 0; xx < MovingIOImageType::ImageDimension; xx++ ) { ind[xx] = vfIter2.GetIndex()[xx]; vecout[xx] = vec[xx]; @@ -1033,7 +1033,7 @@ for ( unsigned int i = 0; i < transformList.size(); i++) { tdim = timedims - 1; } - ind[ImageDimension-1] = tdim; + ind[MovingIOImageType::ImageDimension-1] = tdim; displacementinv->SetPixel( ind, vecout ); } } diff --git a/ImageRegistration/itkANTSImageRegistrationOptimizer.h b/ImageRegistration/itkANTSImageRegistrationOptimizer.h index e09f73378..87852c2d8 100644 --- a/ImageRegistration/itkANTSImageRegistrationOptimizer.h +++ b/ImageRegistration/itkANTSImageRegistrationOptimizer.h @@ -53,7 +53,7 @@ namespace itk { template -class ANTSImageRegistrationOptimizer +class ANTSImageRegistrationOptimizer final : public Object { public: diff --git a/ImageRegistration/itkPICSLAdvancedNormalizationToolKit.h b/ImageRegistration/itkPICSLAdvancedNormalizationToolKit.h index 6619dab8c..bb32f3ed0 100644 --- a/ImageRegistration/itkPICSLAdvancedNormalizationToolKit.h +++ b/ImageRegistration/itkPICSLAdvancedNormalizationToolKit.h @@ -28,7 +28,7 @@ namespace itk { template -class PICSLAdvancedNormalizationToolKit +class PICSLAdvancedNormalizationToolKit final : public Object { public: diff --git a/ImageRegistration/itkProbabilisticRegistrationFunction.h b/ImageRegistration/itkProbabilisticRegistrationFunction.h index 5be8fd15b..a1256f315 100644 --- a/ImageRegistration/itkProbabilisticRegistrationFunction.h +++ b/ImageRegistration/itkProbabilisticRegistrationFunction.h @@ -51,7 +51,7 @@ namespace itk * \ingroup FiniteDifferenceFunctions */ template -class ProbabilisticRegistrationFunction : +class ProbabilisticRegistrationFunction final : public AvantsPDEDeformableRegistrationFunction { diff --git a/ImageRegistration/itkSpatialMutualInformationRegistrationFunction.h b/ImageRegistration/itkSpatialMutualInformationRegistrationFunction.h index 7a5625731..251e38483 100644 --- a/ImageRegistration/itkSpatialMutualInformationRegistrationFunction.h +++ b/ImageRegistration/itkSpatialMutualInformationRegistrationFunction.h @@ -115,7 +115,7 @@ namespace itk * \ingroup ThreadUnSafe */ template -class SpatialMutualInformationRegistrationFunction : +class SpatialMutualInformationRegistrationFunction final : public AvantsPDEDeformableRegistrationFunction { public: diff --git a/ImageRegistration/itkSyNDemonsRegistrationFunction.h b/ImageRegistration/itkSyNDemonsRegistrationFunction.h index 99d5475cb..2ee802679 100644 --- a/ImageRegistration/itkSyNDemonsRegistrationFunction.h +++ b/ImageRegistration/itkSyNDemonsRegistrationFunction.h @@ -47,7 +47,7 @@ namespace itk * \ingroup FiniteDifferenceFunctions */ template -class SyNDemonsRegistrationFunction : +class SyNDemonsRegistrationFunction final : public AvantsPDEDeformableRegistrationFunction diff --git a/ImageSegmentation/antsAtroposSegmentationImageFilter.h b/ImageSegmentation/antsAtroposSegmentationImageFilter.h index 363b5c76e..d63eac943 100644 --- a/ImageSegmentation/antsAtroposSegmentationImageFilter.h +++ b/ImageSegmentation/antsAtroposSegmentationImageFilter.h @@ -252,7 +252,7 @@ class AtroposSegmentationImageFilter final : * cause a greater spatial homogeneity in the final labeling. Default value * = 0.3. */ - itkSetClampMacro( MRFSmoothingFactor, RealType, 0.0, NumericTraits::max() ); + itkSetClampMacro( MRFSmoothingFactor, RealType, NumericTraits::ZeroValue(), NumericTraits::max() ); /** * Get the MRF smoothing parameter. @@ -289,7 +289,7 @@ class AtroposSegmentationImageFilter final : * (likelihoods * priors)^(1/T) where T is specified annealing temperature * raised to the number of elapsed iterations. Default value = 1.0. */ - itkSetClampMacro( InitialAnnealingTemperature, RealType, 0.0, NumericTraits::max() ); + itkSetClampMacro( InitialAnnealingTemperature, RealType, NumericTraits::ZeroValue(), NumericTraits::max() ); /** * Get the initial annealing temperature. For values @@ -305,8 +305,8 @@ class AtroposSegmentationImageFilter final : * Typically, the algorithm becomes unstable for values < 0.1. Default value * = 0.1. */ - itkSetClampMacro( MinimumAnnealingTemperature, RealType, 0.0, - NumericTraits::max() ); + itkSetClampMacro( MinimumAnnealingTemperature, RealType, + NumericTraits::ZeroValue(), NumericTraits::max() ); /** * Get the minimum annealing temperature for ICM asynchronous updating. @@ -322,7 +322,8 @@ class AtroposSegmentationImageFilter final : * (likelihoods * priors)^(1/T) where T is specified annealing temperature * raised to the number of elapsed iterations. Default value = 1.0. */ - itkSetClampMacro( AnnealingRate, RealType, 0.0, 1.0 ); + itkSetClampMacro( AnnealingRate, RealType, + NumericTraits::ZeroValue(), NumericTraits::OneValue() ); /** * Set the annealing rate for ICM asynchronous updating. For values @@ -421,7 +422,8 @@ class AtroposSegmentationImageFilter final : * values are included in the sparse representation of the prior probability * images. Default value = */ - itkSetClampMacro( ProbabilityThreshold, RealType, 0.0, 1.0 ); + itkSetClampMacro( ProbabilityThreshold, RealType, + NumericTraits::ZeroValue(), NumericTraits::OneValue() ); /** * Get the prior probability threshold value. @@ -528,7 +530,7 @@ class AtroposSegmentationImageFilter final : * prior probability information should be included in the posterior * probability information. */ - itkSetClampMacro( PriorProbabilityWeight, RealType, 0.0, 1.e9 ); + itkSetClampMacro( PriorProbabilityWeight, RealType, NumericTraits::ZeroValue(), static_cast( 1.e9 ) ); /** * Get the prior probability weight.