From 4e46cb6ef56658353c14bd58e6b28b63c410f1c8 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Thu, 16 Feb 2023 17:43:27 +0100 Subject: [PATCH] STYLE: Default default-constructor of ImageRandom ConstIterator classes --- .../include/itkImageRandomConstIteratorWithIndex.h | 4 ++-- .../include/itkImageRandomConstIteratorWithIndex.hxx | 10 ---------- .../include/itkImageRandomConstIteratorWithOnlyIndex.h | 4 ++-- .../itkImageRandomConstIteratorWithOnlyIndex.hxx | 10 ---------- .../itkImageRandomNonRepeatingConstIteratorWithIndex.h | 10 +++++----- ...tkImageRandomNonRepeatingConstIteratorWithIndex.hxx | 10 ---------- 6 files changed, 9 insertions(+), 39 deletions(-) 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,