diff --git a/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.h b/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.h index ee8255ff9e7..68184bb61ed 100644 --- a/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.h +++ b/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.h @@ -87,13 +87,13 @@ class ITK_TEMPLATE_EXPORT BinaryThresholdSpatialFunction Evaluate(const InputType & point) const override; protected: - BinaryThresholdSpatialFunction(); + BinaryThresholdSpatialFunction() = default; ~BinaryThresholdSpatialFunction() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; - FunctionOutputType m_LowerThreshold{}; - FunctionOutputType m_UpperThreshold{}; + FunctionOutputType m_LowerThreshold{ NumericTraits::NonpositiveMin() }; + FunctionOutputType m_UpperThreshold{ NumericTraits::max() }; typename FunctionType::Pointer m_Function{}; }; diff --git a/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx b/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx index da20eda2b16..6d57f4e3c78 100644 --- a/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx +++ b/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx @@ -21,13 +21,6 @@ namespace itk { -template -BinaryThresholdSpatialFunction::BinaryThresholdSpatialFunction() -{ - m_LowerThreshold = NumericTraits::NonpositiveMin(); - m_UpperThreshold = NumericTraits::max(); - m_Function = nullptr; -} template void diff --git a/Modules/Core/Common/include/itkCompensatedSummation.h b/Modules/Core/Common/include/itkCompensatedSummation.h index 9af83c4af5e..3cefc4ad1a3 100644 --- a/Modules/Core/Common/include/itkCompensatedSummation.h +++ b/Modules/Core/Common/include/itkCompensatedSummation.h @@ -76,7 +76,7 @@ class ITK_TEMPLATE_EXPORT CompensatedSummation using Self = CompensatedSummation; /** Constructors. */ - CompensatedSummation(); + CompensatedSummation() = default; CompensatedSummation(FloatType value); /** Copy constructor. */ @@ -120,8 +120,8 @@ class ITK_TEMPLATE_EXPORT CompensatedSummation explicit operator FloatType() const; private: - AccumulateType m_Sum; - AccumulateType m_Compensation; + AccumulateType m_Sum{}; + AccumulateType m_Compensation{}; // Maybe support more types in the future with template specialization. #ifdef ITK_USE_CONCEPT_CHECKING diff --git a/Modules/Core/Common/include/itkCompensatedSummation.hxx b/Modules/Core/Common/include/itkCompensatedSummation.hxx index 4be5d2f1ef1..1ed32deee06 100644 --- a/Modules/Core/Common/include/itkCompensatedSummation.hxx +++ b/Modules/Core/Common/include/itkCompensatedSummation.hxx @@ -58,13 +58,6 @@ CompensatedSummationAddElement(TFloat & compensation, TFloat & sum, const TFloat # endif // _MSC_VER #endif // not itkCompensatedSummation_cxx -template -CompensatedSummation::CompensatedSummation() - : m_Sum(NumericTraits::ZeroValue()) - , m_Compensation(NumericTraits::ZeroValue()) -{} - - template CompensatedSummation::CompensatedSummation(const TFloat value) : m_Sum(value) diff --git a/Modules/Core/Common/include/itkConstNeighborhoodIterator.h b/Modules/Core/Common/include/itkConstNeighborhoodIterator.h index c41a9a5964b..b7a97231f53 100644 --- a/Modules/Core/Common/include/itkConstNeighborhoodIterator.h +++ b/Modules/Core/Common/include/itkConstNeighborhoodIterator.h @@ -98,7 +98,7 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIterator using ImageBoundaryConditionConstPointerType = const ImageBoundaryCondition *; /** Default constructor */ - ConstNeighborhoodIterator(); + ConstNeighborhoodIterator() = default; /** Virtual destructor */ ~ConstNeighborhoodIterator() override = default; @@ -612,11 +612,14 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIterator * within the buffer. */ OffsetType m_WrapOffset{ { 0 } }; + /** Default boundary condition. */ + TBoundaryCondition m_InternalBoundaryCondition{}; + /** Pointer to the actual boundary condition that will be used. * By default this points to m_BoundaryCondition, but * OverrideBoundaryCondition allows a user to point this variable an external * boundary condition. */ - ImageBoundaryConditionPointerType m_BoundaryCondition{}; + ImageBoundaryConditionPointerType m_BoundaryCondition{ &m_InternalBoundaryCondition }; /** Denotes which of the iterators dimensional sides spill outside * region of interest boundaries. By default `false` for each dimension. */ @@ -636,9 +639,6 @@ class ITK_TEMPLATE_EXPORT ConstNeighborhoodIterator /** Upper threshold of in-bounds loop counter values. */ IndexType m_InnerBoundsHigh{}; - /** Default boundary condition. */ - TBoundaryCondition m_InternalBoundaryCondition{}; - /** Does the specified region need to worry about boundary conditions? */ bool m_NeedToUseBoundaryCondition{ false }; diff --git a/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx b/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx index e5ad7a74122..f8692f6410d 100644 --- a/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx +++ b/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx @@ -206,12 +206,6 @@ ConstNeighborhoodIterator::GetBoundingBoxAsImageRegi return ans; } -template -ConstNeighborhoodIterator::ConstNeighborhoodIterator() -{ - m_BoundaryCondition = &m_InternalBoundaryCondition; -} - template ConstNeighborhoodIterator::ConstNeighborhoodIterator(const Self & orig) : Neighborhood(orig) diff --git a/Modules/Core/Common/include/itkConstantBoundaryCondition.h b/Modules/Core/Common/include/itkConstantBoundaryCondition.h index 8d94ad5fdb8..43ea1553359 100644 --- a/Modules/Core/Common/include/itkConstantBoundaryCondition.h +++ b/Modules/Core/Common/include/itkConstantBoundaryCondition.h @@ -91,7 +91,7 @@ class ITK_TEMPLATE_EXPORT ConstantBoundaryCondition : public ImageBoundaryCondit static constexpr unsigned int ImageDimension = Superclass::ImageDimension; /** Default constructor. */ - ConstantBoundaryCondition(); + ConstantBoundaryCondition() = default; /** Utility for printing the boundary condition. */ void diff --git a/Modules/Core/Common/include/itkConstantBoundaryCondition.hxx b/Modules/Core/Common/include/itkConstantBoundaryCondition.hxx index e19f7bb6b8f..23a18cb280d 100644 --- a/Modules/Core/Common/include/itkConstantBoundaryCondition.hxx +++ b/Modules/Core/Common/include/itkConstantBoundaryCondition.hxx @@ -22,13 +22,6 @@ namespace itk { -template -ConstantBoundaryCondition::ConstantBoundaryCondition() -{ - OutputPixelType p{}; - m_Constant = NumericTraits::ZeroValue(p); -} - template typename ConstantBoundaryCondition::OutputPixelType ConstantBoundaryCondition::operator()(const OffsetType &, diff --git a/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.h b/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.h index 726d5e2a814..e24c5b36066 100644 --- a/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.h +++ b/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.h @@ -81,7 +81,7 @@ class ITK_TEMPLATE_EXPORT EllipsoidInteriorExteriorSpatialFunction Evaluate(const InputType & position) const override; protected: - EllipsoidInteriorExteriorSpatialFunction(); + EllipsoidInteriorExteriorSpatialFunction() = default; ~EllipsoidInteriorExteriorSpatialFunction() override = default; void @@ -92,7 +92,7 @@ class ITK_TEMPLATE_EXPORT EllipsoidInteriorExteriorSpatialFunction InputType m_Center{}; /** The axes lengths of the ellipsoid. */ - InputType m_Axes{}; + InputType m_Axes{ MakeFilled(1.0f) }; /** The orientation vectors (must be orthogonal) of the ellipsoid axes. */ OrientationType m_Orientations{}; diff --git a/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx b/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx index 03ed7d7c4b2..b017422b21a 100644 --- a/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx +++ b/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx @@ -22,13 +22,6 @@ namespace itk { -template -EllipsoidInteriorExteriorSpatialFunction::EllipsoidInteriorExteriorSpatialFunction() -{ - m_Axes.Fill(1.0f); // Lengths of ellipsoid axes. - m_Center.Fill(0.0f); // Origin of ellipsoid -} - template auto EllipsoidInteriorExteriorSpatialFunction::Evaluate(const InputType & position) const -> OutputType diff --git a/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.h b/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.h index a529343aa4c..a5dd3cdca01 100644 --- a/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.h +++ b/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.h @@ -91,7 +91,7 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeSpatialFunction : public SpatialFunc itkGetConstMacro(Direction, unsigned int); protected: - GaussianDerivativeSpatialFunction(); + GaussianDerivativeSpatialFunction() = default; ~GaussianDerivativeSpatialFunction() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -101,13 +101,13 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeSpatialFunction : public SpatialFunc mutable unsigned int m_Direction{}; /** The standard deviation in each direction. */ - ArrayType m_Sigma{}; + ArrayType m_Sigma{ ArrayType::Filled(1.0) }; /** The mean in each direction. */ ArrayType m_Mean{}; /** A scale factor multiplied by the true value of the Gaussian. */ - double m_Scale{}; + double m_Scale{ 1.0 }; /** Whether or not to normalize the Gaussian. */ bool m_Normalized{}; diff --git a/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx b/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx index 8fed75093a2..e9e38921698 100644 --- a/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx +++ b/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx @@ -23,16 +23,6 @@ namespace itk { -template -GaussianDerivativeSpatialFunction::GaussianDerivativeSpatialFunction() -{ - m_Mean = ArrayType::Filled(0.0); - m_Sigma = ArrayType::Filled(1.0); - m_Scale = 1.0; - m_Normalized = false; - m_Direction = 0; -} - template auto GaussianDerivativeSpatialFunction::Evaluate(const TInput & position) const diff --git a/Modules/Core/Common/include/itkGaussianSpatialFunction.h b/Modules/Core/Common/include/itkGaussianSpatialFunction.h index e5a5b69071c..ec66a9b91e4 100644 --- a/Modules/Core/Common/include/itkGaussianSpatialFunction.h +++ b/Modules/Core/Common/include/itkGaussianSpatialFunction.h @@ -89,15 +89,15 @@ class ITK_TEMPLATE_EXPORT GaussianSpatialFunction : public SpatialFunction -GaussianSpatialFunction::GaussianSpatialFunction() - -{ - m_Mean = ArrayType::Filled(10.0); - m_Sigma = ArrayType::Filled(5.0); -} - template auto GaussianSpatialFunction::Evaluate(const TInput & position) const -> OutputType diff --git a/Modules/Core/Common/include/itkImage.h b/Modules/Core/Common/include/itkImage.h index 3df06883b72..f81a15fee1a 100644 --- a/Modules/Core/Common/include/itkImage.h +++ b/Modules/Core/Common/include/itkImage.h @@ -374,7 +374,7 @@ class ITK_TEMPLATE_EXPORT Image : public ImageBase } protected: - Image(); + Image() = default; void PrintSelf(std::ostream & os, Indent indent) const override; void @@ -393,7 +393,7 @@ class ITK_TEMPLATE_EXPORT Image : public ImageBase private: /** Memory for the current buffer. */ - PixelContainerPointer m_Buffer{}; + PixelContainerPointer m_Buffer{ PixelContainer::New() }; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkImage.hxx b/Modules/Core/Common/include/itkImage.hxx index 40910fc6f23..4229b2d6f9d 100644 --- a/Modules/Core/Common/include/itkImage.hxx +++ b/Modules/Core/Common/include/itkImage.hxx @@ -34,13 +34,6 @@ namespace itk { -template -Image::Image() -{ - m_Buffer = PixelContainer::New(); -} - - template void Image::Allocate(bool initializePixels) diff --git a/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.h b/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.h index 43b61f10a9f..cb9b64102ec 100644 --- a/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.h +++ b/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.h @@ -136,7 +136,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithIndex : public ImageConstI using typename Superclass::SizeValueType; /** Default constructor. Needed since we provide a cast constructor. */ - ImageRandomConstIteratorWithIndex(); + ImageRandomConstIteratorWithIndex() = default; ~ImageRandomConstIteratorWithIndex() override = default; /** Constructor establishes an iterator to walk a particular image and a @@ -224,7 +224,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithIndex : public ImageConstI RandomJump(); using GeneratorPointer = typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer; - GeneratorPointer m_Generator{}; + GeneratorPointer m_Generator{ Statistics::MersenneTwisterRandomVariateGenerator::New() }; SizeValueType m_NumberOfSamplesRequested{}; SizeValueType m_NumberOfSamplesDone{}; SizeValueType m_NumberOfPixelsInRegion{}; diff --git a/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.hxx b/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.hxx index 1e772026776..152166c669a 100644 --- a/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.hxx +++ b/Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.hxx @@ -22,16 +22,6 @@ namespace itk { -template -ImageRandomConstIteratorWithIndex::ImageRandomConstIteratorWithIndex() - : ImageConstIteratorWithIndex() -{ - m_NumberOfPixelsInRegion = 0L; - m_NumberOfSamplesRequested = 0L; - m_NumberOfSamplesDone = 0L; - m_Generator = Statistics::MersenneTwisterRandomVariateGenerator::New(); -} - template ImageRandomConstIteratorWithIndex::ImageRandomConstIteratorWithIndex(const ImageType * ptr, const RegionType & region) diff --git a/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.h b/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.h index 557fd0fd1bc..82fd191c7ed 100644 --- a/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.h +++ b/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.h @@ -138,7 +138,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithOnlyIndex : public ImageCo using typename Superclass::SizeValueType; /** Default constructor. Needed since we provide a cast constructor. */ - ImageRandomConstIteratorWithOnlyIndex(); + ImageRandomConstIteratorWithOnlyIndex() = default; ~ImageRandomConstIteratorWithOnlyIndex() override = default; /** Constructor establishes an iterator to walk a particular image and a @@ -226,7 +226,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomConstIteratorWithOnlyIndex : public ImageCo RandomJump(); using GeneratorPointer = typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer; - GeneratorPointer m_Generator{}; + GeneratorPointer m_Generator{ Statistics::MersenneTwisterRandomVariateGenerator::New() }; SizeValueType m_NumberOfSamplesRequested{}; SizeValueType m_NumberOfSamplesDone{}; SizeValueType m_NumberOfPixelsInRegion{}; diff --git a/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.hxx b/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.hxx index 9d417a63b92..309b0974f2e 100644 --- a/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.hxx +++ b/Modules/Core/Common/include/itkImageRandomConstIteratorWithOnlyIndex.hxx @@ -22,16 +22,6 @@ namespace itk { -template -ImageRandomConstIteratorWithOnlyIndex::ImageRandomConstIteratorWithOnlyIndex() - : ImageConstIteratorWithOnlyIndex() -{ - m_NumberOfPixelsInRegion = 0L; - m_NumberOfSamplesRequested = 0L; - m_NumberOfSamplesDone = 0L; - m_Generator = Statistics::MersenneTwisterRandomVariateGenerator::New(); -} - template ImageRandomConstIteratorWithOnlyIndex::ImageRandomConstIteratorWithOnlyIndex(const ImageType * ptr, const RegionType & region) diff --git a/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.h b/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.h index 9b6112daeb6..fc4a8011d79 100644 --- a/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.h +++ b/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.h @@ -234,7 +234,7 @@ class ITK_TEMPLATE_EXPORT ImageRandomNonRepeatingConstIteratorWithIndex : public using typename Superclass::SizeValueType; /** Default constructor. Needed since we provide a cast constructor. */ - ImageRandomNonRepeatingConstIteratorWithIndex(); + ImageRandomNonRepeatingConstIteratorWithIndex() = default; ~ImageRandomNonRepeatingConstIteratorWithIndex() override { delete m_Permutation; } /** Constructor establishes an iterator to walk a particular image and a @@ -343,10 +343,10 @@ class ITK_TEMPLATE_EXPORT ImageRandomNonRepeatingConstIteratorWithIndex : public void UpdatePosition(); - SizeValueType m_NumberOfSamplesRequested; - SizeValueType m_NumberOfSamplesDone; - SizeValueType m_NumberOfPixelsInRegion; - RandomPermutation * m_Permutation; + SizeValueType m_NumberOfSamplesRequested{}; + SizeValueType m_NumberOfSamplesDone{}; + SizeValueType m_NumberOfPixelsInRegion{}; + RandomPermutation * m_Permutation{}; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx b/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx index 351fa91d035..c62211b3086 100644 --- a/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx +++ b/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx @@ -22,16 +22,6 @@ namespace itk { -template -ImageRandomNonRepeatingConstIteratorWithIndex::ImageRandomNonRepeatingConstIteratorWithIndex() - : ImageConstIteratorWithIndex() -{ - m_NumberOfPixelsInRegion = 0L; - m_NumberOfSamplesRequested = 0L; - m_NumberOfSamplesDone = 0L; - m_Permutation = nullptr; -} - template ImageRandomNonRepeatingConstIteratorWithIndex::ImageRandomNonRepeatingConstIteratorWithIndex( const ImageType * ptr, diff --git a/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h b/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h index 2eea7a711c8..918125187ab 100644 --- a/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h +++ b/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h @@ -50,7 +50,7 @@ class ITK_TEMPLATE_EXPORT ImageVectorOptimizerParametersHelper : public Optimize using typename Superclass::CommonContainerType; /** Default constructor. */ - ImageVectorOptimizerParametersHelper(); + ImageVectorOptimizerParametersHelper() = default; /** Set a new data pointer for *both* the Array and parameter image, * pointing both to a different memory block. diff --git a/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx b/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx index 7a3bbfb20e0..8fa6baa20e7 100644 --- a/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx +++ b/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx @@ -22,13 +22,6 @@ namespace itk { -/** Default contstructor */ -template -ImageVectorOptimizerParametersHelper::ImageVectorOptimizerParametersHelper() -{ - m_ParameterImage = nullptr; -} - /** Move the data pointer */ template void diff --git a/Modules/Core/Common/include/itkImportImageContainer.h b/Modules/Core/Common/include/itkImportImageContainer.h index e3748cbb2b4..4d51f437708 100644 --- a/Modules/Core/Common/include/itkImportImageContainer.h +++ b/Modules/Core/Common/include/itkImportImageContainer.h @@ -152,7 +152,7 @@ class ITK_TEMPLATE_EXPORT ImportImageContainer : public Object itkBooleanMacro(ContainerManageMemory); protected: - ImportImageContainer(); + ImportImageContainer() = default; ~ImportImageContainer() override; /** PrintSelf routine. Normally this is a protected internal method. It is @@ -202,7 +202,7 @@ class ITK_TEMPLATE_EXPORT ImportImageContainer : public Object TElement * m_ImportPointer{}; TElementIdentifier m_Size{}; TElementIdentifier m_Capacity{}; - bool m_ContainerManageMemory{}; + bool m_ContainerManageMemory{ true }; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkImportImageContainer.hxx b/Modules/Core/Common/include/itkImportImageContainer.hxx index 044246c6987..acc6456dd20 100644 --- a/Modules/Core/Common/include/itkImportImageContainer.hxx +++ b/Modules/Core/Common/include/itkImportImageContainer.hxx @@ -32,15 +32,6 @@ namespace itk { -template -ImportImageContainer::ImportImageContainer() -{ - m_ImportPointer = nullptr; - m_ContainerManageMemory = true; - m_Capacity = 0; - m_Size = 0; -} - template ImportImageContainer::~ImportImageContainer() { diff --git a/Modules/Core/Common/include/itkImportImageFilter.h b/Modules/Core/Common/include/itkImportImageFilter.h index 25c15db8257..930db9f5937 100644 --- a/Modules/Core/Common/include/itkImportImageFilter.h +++ b/Modules/Core/Common/include/itkImportImageFilter.h @@ -139,7 +139,7 @@ class ITK_TEMPLATE_EXPORT ImportImageFilter : public ImageSource(1.0) }; OriginType m_Origin{}; - DirectionType m_Direction{}; + DirectionType m_Direction{ DirectionType::GetIdentity() }; typename ImportImageContainerType::Pointer m_ImportImageContainer{}; SizeValueType m_Size{}; diff --git a/Modules/Core/Common/include/itkImportImageFilter.hxx b/Modules/Core/Common/include/itkImportImageFilter.hxx index 4c001288d19..7c3fdf35ced 100644 --- a/Modules/Core/Common/include/itkImportImageFilter.hxx +++ b/Modules/Core/Common/include/itkImportImageFilter.hxx @@ -23,23 +23,6 @@ namespace itk { -/** - * - */ -template -ImportImageFilter::ImportImageFilter() -{ - unsigned int idx; - - for (idx = 0; idx < VImageDimension; ++idx) - { - m_Spacing[idx] = 1.0; - m_Origin[idx] = 0.0; - } - m_Direction.SetIdentity(); - - m_Size = 0; -} /** * diff --git a/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h b/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h index b6dd2cb7fde..b8354b9dd15 100644 --- a/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h +++ b/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h @@ -18,6 +18,7 @@ #ifndef itkMinimumMaximumImageCalculator_h #define itkMinimumMaximumImageCalculator_h +#include "itkNumericTraits.h" #include "itkObject.h" #include "itkObjectFactory.h" @@ -108,15 +109,15 @@ class ITK_TEMPLATE_EXPORT MinimumMaximumImageCalculator : public Object SetRegion(const RegionType & region); protected: - MinimumMaximumImageCalculator(); + MinimumMaximumImageCalculator() = default; ~MinimumMaximumImageCalculator() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; private: - PixelType m_Minimum{}; - PixelType m_Maximum{}; - ImageConstPointer m_Image{}; + PixelType m_Minimum{ NumericTraits::max() }; + PixelType m_Maximum{ NumericTraits::NonpositiveMin() }; + ImageConstPointer m_Image{ TInputImage::New() }; IndexType m_IndexOfMinimum{}; IndexType m_IndexOfMaximum{}; diff --git a/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx b/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx index 217d32c2f83..a9eef0aa513 100644 --- a/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx +++ b/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx @@ -19,22 +19,10 @@ #define itkMinimumMaximumImageCalculator_hxx #include "itkImageRegionConstIteratorWithIndex.h" -#include "itkNumericTraits.h" namespace itk { -template -MinimumMaximumImageCalculator::MinimumMaximumImageCalculator() -{ - m_Image = TInputImage::New(); - m_Maximum = NumericTraits::NonpositiveMin(); - m_Minimum = NumericTraits::max(); - m_IndexOfMinimum.Fill(0); - m_IndexOfMaximum.Fill(0); - m_RegionSetByUser = false; -} - template void MinimumMaximumImageCalculator::Compute() diff --git a/Modules/Core/Common/include/itkObjectStore.h b/Modules/Core/Common/include/itkObjectStore.h index 2b4d67e99ba..04f2819e17e 100644 --- a/Modules/Core/Common/include/itkObjectStore.h +++ b/Modules/Core/Common/include/itkObjectStore.h @@ -163,7 +163,7 @@ class ITK_TEMPLATE_EXPORT ObjectStore : public Object } protected: - ObjectStore(); + ObjectStore() = default; ~ObjectStore() override; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -174,9 +174,7 @@ class ITK_TEMPLATE_EXPORT ObjectStore : public Object struct MemoryBlock { - MemoryBlock() - : Begin(0) - {} + MemoryBlock() = default; MemoryBlock(SizeValueType n) : Size(n) @@ -192,15 +190,15 @@ class ITK_TEMPLATE_EXPORT ObjectStore : public Object delete[] Begin; } - ObjectType * Begin; + ObjectType * Begin{}; SizeValueType Size{ 0 }; }; private: - GrowthStrategyEnum m_GrowthStrategy{}; + GrowthStrategyEnum m_GrowthStrategy{ GrowthStrategyEnum::EXPONENTIAL_GROWTH }; SizeValueType m_Size{}; - SizeValueType m_LinearGrowthSize{}; + SizeValueType m_LinearGrowthSize{ 1024 }; /** Pointers to objects available for borrowing. */ FreeListType m_FreeList{}; diff --git a/Modules/Core/Common/include/itkObjectStore.hxx b/Modules/Core/Common/include/itkObjectStore.hxx index 9d2b275c580..74e098f5a07 100644 --- a/Modules/Core/Common/include/itkObjectStore.hxx +++ b/Modules/Core/Common/include/itkObjectStore.hxx @@ -24,14 +24,6 @@ namespace itk { -template -ObjectStore::ObjectStore() -{ - m_Size = 0; - m_LinearGrowthSize = 1024; - m_GrowthStrategy = GrowthStrategyEnum::EXPONENTIAL_GROWTH; -} - template ObjectStore::~ObjectStore() { diff --git a/Modules/Core/Common/include/itkPointSet.h b/Modules/Core/Common/include/itkPointSet.h index a6e2189e82a..c722306e2a6 100644 --- a/Modules/Core/Common/include/itkPointSet.h +++ b/Modules/Core/Common/include/itkPointSet.h @@ -260,7 +260,7 @@ class ITK_TEMPLATE_EXPORT PointSet : public DataObject protected: /** Constructor for use by New() method. */ - PointSet(); + PointSet() = default; ~PointSet() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -275,11 +275,11 @@ class ITK_TEMPLATE_EXPORT PointSet : public DataObject // RequestedRegion are used to define the currently requested // region. The LargestPossibleRegion is always requested region = 0 // and number of regions = 1; - RegionType m_MaximumNumberOfRegions{}; - RegionType m_NumberOfRegions{}; + RegionType m_MaximumNumberOfRegions{ 1 }; + RegionType m_NumberOfRegions{ 1 }; RegionType m_RequestedNumberOfRegions{}; - RegionType m_BufferedRegion{}; - RegionType m_RequestedRegion{}; + RegionType m_BufferedRegion{ -1 }; + RegionType m_RequestedRegion{ -1 }; }; // End Class: PointSet } // end namespace itk diff --git a/Modules/Core/Common/include/itkPointSet.hxx b/Modules/Core/Common/include/itkPointSet.hxx index eac2c9f8325..81c9e8b6b9a 100644 --- a/Modules/Core/Common/include/itkPointSet.hxx +++ b/Modules/Core/Common/include/itkPointSet.hxx @@ -257,21 +257,6 @@ PointSet::Initialize() m_PointDataContainer = nullptr; } -template -PointSet::PointSet() - : m_PointsContainer(nullptr) - , m_PointDataContainer(nullptr) -{ - - // If we used unstructured regions instead of structured regions, then - // assume this object was created by the user and this is region 0 of - // 1 region. - m_MaximumNumberOfRegions = 1; - m_NumberOfRegions = 1; - m_BufferedRegion = -1; - m_RequestedNumberOfRegions = 0; - m_RequestedRegion = -1; -} template void diff --git a/Modules/Core/Common/include/itkPriorityQueueContainer.h b/Modules/Core/Common/include/itkPriorityQueueContainer.h index 620c678dc1b..17227c7d774 100644 --- a/Modules/Core/Common/include/itkPriorityQueueContainer.h +++ b/Modules/Core/Common/include/itkPriorityQueueContainer.h @@ -111,11 +111,11 @@ class ITK_TEMPLATE_EXPORT MinPriorityQueueElementWrapper using ElementPriorityType = TElementPriority; using ElementIdentifierType = TElementIdentifier; - ElementType m_Element; - ElementPriorityType m_Priority; - ElementIdentifierType m_Location; + ElementType m_Element{}; + ElementPriorityType m_Priority{}; + ElementIdentifierType m_Location{ Superclass::m_ElementNotFound }; - MinPriorityQueueElementWrapper(); + MinPriorityQueueElementWrapper() = default; MinPriorityQueueElementWrapper(ElementType element, ElementPriorityType priority); @@ -205,7 +205,7 @@ class ITK_TEMPLATE_EXPORT PriorityQueueContainer : public VectorContainer diff --git a/Modules/Core/Common/include/itkPriorityQueueContainer.hxx b/Modules/Core/Common/include/itkPriorityQueueContainer.hxx index b0743dda2ed..27c6b4edf7f 100644 --- a/Modules/Core/Common/include/itkPriorityQueueContainer.hxx +++ b/Modules/Core/Common/include/itkPriorityQueueContainer.hxx @@ -85,13 +85,6 @@ const TElementIdentifier ElementWrapperPointerInterface -MinPriorityQueueElementWrapper::MinPriorityQueueElementWrapper() - : m_Location(Superclass::m_ElementNotFound) -{} // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- @@ -254,17 +247,6 @@ const TElementIdentifier m_ElementNotFound = NumericTraits::max(); // ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -template -PriorityQueueContainer:: - PriorityQueueContainer() - : Superclass() -{} -// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- template ::OneValue() }; + RealType m_OneOverEpsilon{ NumericTraits::OneValue() }; }; } // namespace itk diff --git a/Modules/Core/Common/include/itkRegularizedHeavisideStepFunction.hxx b/Modules/Core/Common/include/itkRegularizedHeavisideStepFunction.hxx index 731a9a01fb5..d4f111e7a45 100644 --- a/Modules/Core/Common/include/itkRegularizedHeavisideStepFunction.hxx +++ b/Modules/Core/Common/include/itkRegularizedHeavisideStepFunction.hxx @@ -21,13 +21,6 @@ namespace itk { -template -RegularizedHeavisideStepFunction::RegularizedHeavisideStepFunction() - : Superclass() - , m_Epsilon(NumericTraits::OneValue()) - , m_OneOverEpsilon(NumericTraits::OneValue()) -{} - template void RegularizedHeavisideStepFunction::SetEpsilon(const RealType & ieps) diff --git a/Modules/Core/Common/include/itkSparseImage.h b/Modules/Core/Common/include/itkSparseImage.h index d8b928aba95..23b243b1b84 100644 --- a/Modules/Core/Common/include/itkSparseImage.h +++ b/Modules/Core/Common/include/itkSparseImage.h @@ -143,7 +143,7 @@ class ITK_TEMPLATE_EXPORT SparseImage : public Image Initialize() override; protected: - SparseImage(); + SparseImage() = default; ~SparseImage() override = default; void @@ -151,9 +151,9 @@ class ITK_TEMPLATE_EXPORT SparseImage : public Image private: /** The variables for storing the node variables. */ - typename NodeListType::Pointer m_NodeList{}; + typename NodeListType::Pointer m_NodeList{ NodeListType::New() }; - typename NodeStoreType::Pointer m_NodeStore{}; + typename NodeStoreType::Pointer m_NodeStore{ NodeStoreType::New() }; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkSparseImage.hxx b/Modules/Core/Common/include/itkSparseImage.hxx index 45b366cb25c..0fda86293fe 100644 --- a/Modules/Core/Common/include/itkSparseImage.hxx +++ b/Modules/Core/Common/include/itkSparseImage.hxx @@ -22,13 +22,6 @@ namespace itk { -template -SparseImage::SparseImage() -{ - m_NodeList = NodeListType::New(); - m_NodeStore = NodeStoreType::New(); -} - template void SparseImage::PrintSelf(std::ostream & os, Indent indent) const diff --git a/Modules/Core/Common/include/itkSpecialCoordinatesImage.h b/Modules/Core/Common/include/itkSpecialCoordinatesImage.h index 671db5e06ff..4a205695e91 100644 --- a/Modules/Core/Common/include/itkSpecialCoordinatesImage.h +++ b/Modules/Core/Common/include/itkSpecialCoordinatesImage.h @@ -325,7 +325,7 @@ class ITK_TEMPLATE_EXPORT SpecialCoordinatesImage : public ImageBase -SpecialCoordinatesImage::SpecialCoordinatesImage() -{ - m_Buffer = PixelContainer::New(); -} - template void SpecialCoordinatesImage::Allocate(bool initialize) diff --git a/Modules/Core/Common/include/itkSphereSpatialFunction.h b/Modules/Core/Common/include/itkSphereSpatialFunction.h index 1a5f7be551f..e61c3b532f6 100644 --- a/Modules/Core/Common/include/itkSphereSpatialFunction.h +++ b/Modules/Core/Common/include/itkSphereSpatialFunction.h @@ -68,7 +68,7 @@ class ITK_TEMPLATE_EXPORT SphereSpatialFunction : public InteriorExteriorSpatial itkSetMacro(Radius, double); protected: - SphereSpatialFunction(); + SphereSpatialFunction() = default; ~SphereSpatialFunction() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -78,7 +78,7 @@ class ITK_TEMPLATE_EXPORT SphereSpatialFunction : public InteriorExteriorSpatial InputType m_Center{}; /** The radius of the sphere. */ - double m_Radius{}; + double m_Radius{ 1.0 }; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkSphereSpatialFunction.hxx b/Modules/Core/Common/include/itkSphereSpatialFunction.hxx index 5ade54737ba..1d447f2463d 100644 --- a/Modules/Core/Common/include/itkSphereSpatialFunction.hxx +++ b/Modules/Core/Common/include/itkSphereSpatialFunction.hxx @@ -21,14 +21,6 @@ namespace itk { -template -SphereSpatialFunction::SphereSpatialFunction() -{ - m_Radius = 1.0; - - m_Center.Fill(0.0f); -} - template auto SphereSpatialFunction::Evaluate(const InputType & position) const -> OutputType diff --git a/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.h b/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.h index 3685da0ebc7..0e0fadc93db 100644 --- a/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.h +++ b/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.h @@ -87,13 +87,13 @@ class ITK_TEMPLATE_EXPORT ThreadedImageRegionPartitioner : public ThreadedDomain DomainType & subRegion) const override; protected: - ThreadedImageRegionPartitioner(); + ThreadedImageRegionPartitioner() = default; ~ThreadedImageRegionPartitioner() override = default; using ImageRegionSplitterType = ImageRegionSplitterSlowDimension; private: - ImageRegionSplitterType::Pointer m_ImageRegionSplitter{}; + ImageRegionSplitterType::Pointer m_ImageRegionSplitter{ ImageRegionSplitterType::New() }; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.hxx b/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.hxx index ae6947d0a8a..d41b4700e9b 100644 --- a/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.hxx +++ b/Modules/Core/Common/include/itkThreadedImageRegionPartitioner.hxx @@ -22,12 +22,6 @@ namespace itk { -template -ThreadedImageRegionPartitioner::ThreadedImageRegionPartitioner() -{ - this->m_ImageRegionSplitter = ImageRegionSplitterType::New(); -} - template ThreadIdType ThreadedImageRegionPartitioner::PartitionDomain(const ThreadIdType threadId, diff --git a/Modules/Core/Common/include/itkVariableLengthVector.h b/Modules/Core/Common/include/itkVariableLengthVector.h index 36998fcbbf9..51d4e0a58ed 100644 --- a/Modules/Core/Common/include/itkVariableLengthVector.h +++ b/Modules/Core/Common/include/itkVariableLengthVector.h @@ -322,7 +322,7 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector * \post \c m_NumElements is 0 * \post \c m_LetArrayManageMemory is true */ - VariableLengthVector(); + VariableLengthVector() = default; /** Constructor with size. * Size can only be changed by assignment, \c SetSize() or \c Reserve(). @@ -978,7 +978,7 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector private: bool m_LetArrayManageMemory{ true }; // if true, the array is responsible // for memory of data - TValue * m_Data; // Array to hold data + TValue * m_Data{}; // Array to hold data ElementIdentifier m_NumElements{ 0 }; }; diff --git a/Modules/Core/Common/include/itkVariableLengthVector.hxx b/Modules/Core/Common/include/itkVariableLengthVector.hxx index 5da5109deed..c8b6626fc44 100644 --- a/Modules/Core/Common/include/itkVariableLengthVector.hxx +++ b/Modules/Core/Common/include/itkVariableLengthVector.hxx @@ -27,12 +27,6 @@ namespace itk { -template -VariableLengthVector::VariableLengthVector() - : m_Data(nullptr) - -{} - template VariableLengthVector::VariableLengthVector(unsigned int length) : m_Data(nullptr) diff --git a/Modules/Core/Common/include/itkVectorImage.h b/Modules/Core/Common/include/itkVectorImage.h index 672e5315eca..ce93b3943a3 100644 --- a/Modules/Core/Common/include/itkVectorImage.h +++ b/Modules/Core/Common/include/itkVectorImage.h @@ -367,7 +367,7 @@ class ITK_TEMPLATE_EXPORT VectorImage : public ImageBase SetNumberOfComponentsPerPixel(unsigned int n) override; protected: - VectorImage(); + VectorImage() = default; void PrintSelf(std::ostream & os, Indent indent) const override; @@ -381,7 +381,7 @@ class ITK_TEMPLATE_EXPORT VectorImage : public ImageBase VectorLengthType m_VectorLength{ 0 }; /** Memory for the current buffer. */ - PixelContainerPointer m_Buffer{}; + PixelContainerPointer m_Buffer{ PixelContainer::New() }; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkVectorImage.hxx b/Modules/Core/Common/include/itkVectorImage.hxx index 80fa0e51db5..86778e7f8f0 100644 --- a/Modules/Core/Common/include/itkVectorImage.hxx +++ b/Modules/Core/Common/include/itkVectorImage.hxx @@ -31,15 +31,6 @@ namespace itk { -/** - * - */ -template -VectorImage::VectorImage() - -{ - m_Buffer = PixelContainer::New(); -} //---------------------------------------------------------------------------- template diff --git a/Modules/Core/Common/include/itkVersor.h b/Modules/Core/Common/include/itkVersor.h index 175e761dc1c..5763fcfdaf1 100644 --- a/Modules/Core/Common/include/itkVersor.h +++ b/Modules/Core/Common/include/itkVersor.h @@ -110,7 +110,7 @@ class ITK_TEMPLATE_EXPORT Versor /** Default constructor creates a null versor * (representing 0 degrees rotation). */ - Versor(); + Versor() = default; /** Copy constructor. */ Versor(const Self & v); @@ -326,16 +326,16 @@ class ITK_TEMPLATE_EXPORT Versor } /** Component parallel to x axis. */ - ValueType m_X; + ValueType m_X{}; /** Component parallel to y axis. */ - ValueType m_Y; + ValueType m_Y{}; /** Component parallel to z axis. */ - ValueType m_Z; + ValueType m_Z{}; /** Escalar component of the Versor. */ - ValueType m_W; + ValueType m_W{ NumericTraits::OneValue() }; }; template diff --git a/Modules/Core/Common/include/itkVersor.hxx b/Modules/Core/Common/include/itkVersor.hxx index f25d6779a25..1aab8803197 100644 --- a/Modules/Core/Common/include/itkVersor.hxx +++ b/Modules/Core/Common/include/itkVersor.hxx @@ -24,14 +24,6 @@ namespace itk { -template -Versor::Versor() - : m_X(NumericTraits::ZeroValue()) - , m_Y(NumericTraits::ZeroValue()) - , m_Z(NumericTraits::ZeroValue()) - , m_W(NumericTraits::OneValue()) -{} - template Versor::Versor(const Self & v) { diff --git a/Modules/Core/Common/test/itkCompensatedSummationTest2.cxx b/Modules/Core/Common/test/itkCompensatedSummationTest2.cxx index ed497e4dcbc..9e4a4d1d359 100644 --- a/Modules/Core/Common/test/itkCompensatedSummationTest2.cxx +++ b/Modules/Core/Common/test/itkCompensatedSummationTest2.cxx @@ -71,7 +71,6 @@ class CompensatedSummationTest2Associate void ThreadedExecution(const DomainType & subdomain, const itk::ThreadIdType threadId) override { - itk::CompensatedSummation compensatedSum; for (DomainType::IndexValueType i = subdomain[0]; i <= subdomain[1]; ++i) { double value = 1.0 / 7;