From d715806a365ade9d9c816a46ebee46abcc763cf3 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Mon, 6 Jul 2026 17:20:56 +0200 Subject: [PATCH 1/2] STYLE: Default-member-initializers in BinaryMathematicalMorphology Moved initialization values of non-static data members from the member-initializer-lists of default-constructors to their default-member-initializers. Following C++ Core Guidelines, Jun 14, 2026, "Prefer default member initializers to member initializers in constructors for constant initializers", https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c48-prefer-default-member-initializers-to-member-initializers-in-constructors-for-constant-initializers Will make Doxygen generated documentation more informative, as default member initializers appear in the class documentation. --- .../include/itkBinaryClosingByReconstructionImageFilter.h | 2 +- .../include/itkBinaryClosingByReconstructionImageFilter.hxx | 2 -- .../include/itkBinaryMorphologicalClosingImageFilter.h | 4 ++-- .../include/itkBinaryMorphologicalClosingImageFilter.hxx | 2 -- .../include/itkBinaryMorphologicalOpeningImageFilter.h | 2 +- .../include/itkBinaryMorphologicalOpeningImageFilter.hxx | 2 -- .../include/itkBinaryMorphologyImageFilter.h | 4 ++-- .../include/itkBinaryMorphologyImageFilter.hxx | 2 -- .../include/itkBinaryOpeningByReconstructionImageFilter.h | 2 +- .../include/itkBinaryOpeningByReconstructionImageFilter.hxx | 2 -- .../include/itkBinaryPruningImageFilter.h | 2 +- .../include/itkBinaryPruningImageFilter.hxx | 1 - .../include/itkErodeObjectMorphologyImageFilter.hxx | 1 - .../include/itkObjectMorphologyImageFilter.h | 2 +- .../include/itkObjectMorphologyImageFilter.hxx | 2 -- 15 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h index 21021427f3b..d44f7f103ee 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h @@ -115,7 +115,7 @@ class ITK_TEMPLATE_EXPORT BinaryClosingByReconstructionImageFilter GenerateData() override; private: - InputPixelType m_ForegroundValue{}; + InputPixelType m_ForegroundValue{ NumericTraits::max() }; bool m_FullyConnected{}; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx index 25adbb75b58..59759594a8a 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx @@ -32,8 +32,6 @@ namespace itk template BinaryClosingByReconstructionImageFilter::BinaryClosingByReconstructionImageFilter() - : m_ForegroundValue(NumericTraits::max()) - {} template diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h index 259c4c9d5ac..bb346398473 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h @@ -112,9 +112,9 @@ class ITK_TEMPLATE_EXPORT BinaryMorphologicalClosingImageFilter GenerateData() override; private: - InputPixelType m_ForegroundValue{}; + InputPixelType m_ForegroundValue{ NumericTraits::max() }; - bool m_SafeBorder{}; + bool m_SafeBorder{ true }; }; // end of class } // end namespace itk diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx index ff83d6cd041..10887cec5f1 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx @@ -39,8 +39,6 @@ namespace itk { template BinaryMorphologicalClosingImageFilter::BinaryMorphologicalClosingImageFilter() - : m_ForegroundValue(NumericTraits::max()) - , m_SafeBorder(true) {} template diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h index 124af9e90c2..85383cea0ad 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h @@ -110,7 +110,7 @@ class ITK_TEMPLATE_EXPORT BinaryMorphologicalOpeningImageFilter GenerateData() override; private: - PixelType m_ForegroundValue{}; + PixelType m_ForegroundValue{ NumericTraits::max() }; PixelType m_BackgroundValue{}; }; // end of class diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx index 304a1474991..aed99d035cf 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx @@ -36,8 +36,6 @@ namespace itk { template BinaryMorphologicalOpeningImageFilter::BinaryMorphologicalOpeningImageFilter() - : m_ForegroundValue(NumericTraits::max()) - , m_BackgroundValue(PixelType{}) {} template diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.h index b77ea3f1da4..f3fc0c9e6c4 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.h @@ -226,10 +226,10 @@ class ITK_TEMPLATE_EXPORT BinaryMorphologyImageFilter : public KernelImageFilter private: /** Pixel value to dilate */ - InputPixelType m_ForegroundValue{}; + InputPixelType m_ForegroundValue{ NumericTraits::max() }; /** Pixel value for background */ - OutputPixelType m_BackgroundValue{}; + OutputPixelType m_BackgroundValue{ NumericTraits::NonpositiveMin() }; /** Difference sets definition */ NeighborIndexContainerContainer m_KernelDifferenceSets{}; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx index 1802c7d6aba..74c87f7e617 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx @@ -31,8 +31,6 @@ namespace itk { template BinaryMorphologyImageFilter::BinaryMorphologyImageFilter() - : m_ForegroundValue(NumericTraits::max()) - , m_BackgroundValue(NumericTraits::NonpositiveMin()) { // this->SetNumberOfWorkUnits(1); this->AnalyzeKernel(); diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h index a92bc0ddd63..54538cb15b5 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h @@ -120,7 +120,7 @@ class ITK_TEMPLATE_EXPORT BinaryOpeningByReconstructionImageFilter GenerateData() override; private: - PixelType m_ForegroundValue{}; + PixelType m_ForegroundValue{ NumericTraits::max() }; PixelType m_BackgroundValue{}; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx index 16c0cffcc1a..241599dee4d 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx @@ -28,8 +28,6 @@ namespace itk template BinaryOpeningByReconstructionImageFilter::BinaryOpeningByReconstructionImageFilter() - : m_ForegroundValue(NumericTraits::max()) - , m_BackgroundValue(PixelType{}) {} template diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryPruningImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryPruningImageFilter.h index 95e8577caa1..13045a009f2 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryPruningImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryPruningImageFilter.h @@ -133,7 +133,7 @@ class ITK_TEMPLATE_EXPORT BinaryPruningImageFilter : public ImageToImageFilter BinaryPruningImageFilter::BinaryPruningImageFilter() - : m_Iteration(3) { this->SetNumberOfRequiredOutputs(1); diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx index 07efd4c40ab..05566d981a7 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkErodeObjectMorphologyImageFilter.hxx @@ -23,7 +23,6 @@ namespace itk { template ErodeObjectMorphologyImageFilter::ErodeObjectMorphologyImageFilter() - : m_BackgroundValue(PixelType{}) { m_ErodeBoundaryCondition.SetConstant(NumericTraits::max()); this->OverrideBoundaryCondition(&m_ErodeBoundaryCondition); diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.h index e9c5f6a1441..72cf89d6384 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.h @@ -215,7 +215,7 @@ class ITK_TEMPLATE_EXPORT ObjectMorphologyImageFilter : public ImageToImageFilte KernelType m_Kernel{}; /** Pixel value that indicates the object be operated upon */ - PixelType m_ObjectValue{}; + PixelType m_ObjectValue{ NumericTraits::OneValue() }; void BeforeThreadedGenerateData() override; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx index f0e4ab40d72..e68b2a744aa 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx @@ -31,8 +31,6 @@ namespace itk { template ObjectMorphologyImageFilter::ObjectMorphologyImageFilter() - : m_Kernel() - , m_ObjectValue(NumericTraits::OneValue()) { m_DefaultBoundaryCondition.SetConstant(PixelType{}); m_BoundaryCondition = &m_DefaultBoundaryCondition; From 8a822a57da8da3c055d4fa1429fd95f04d392a58 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Mon, 6 Jul 2026 17:56:46 +0200 Subject: [PATCH 2/2] STYLE: Default empty default-constructors BinaryMathematicalMorphology Defaulted four empty default-constructor from BinaryMathematicalMorphology inside the definition of their classes. Will make Doxygen generated documentation more informative, as these constructors will be marked "default" in the class documentation. --- .../include/itkBinaryClosingByReconstructionImageFilter.h | 2 +- .../include/itkBinaryClosingByReconstructionImageFilter.hxx | 5 ----- .../include/itkBinaryMorphologicalClosingImageFilter.h | 2 +- .../include/itkBinaryMorphologicalClosingImageFilter.hxx | 4 ---- .../include/itkBinaryMorphologicalOpeningImageFilter.h | 2 +- .../include/itkBinaryMorphologicalOpeningImageFilter.hxx | 4 ---- .../include/itkBinaryOpeningByReconstructionImageFilter.h | 2 +- .../include/itkBinaryOpeningByReconstructionImageFilter.hxx | 5 ----- 8 files changed, 4 insertions(+), 22 deletions(-) diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h index d44f7f103ee..3f0f301a556 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.h @@ -96,7 +96,7 @@ class ITK_TEMPLATE_EXPORT BinaryClosingByReconstructionImageFilter itkBooleanMacro(FullyConnected); /** @ITKEndGrouping */ protected: - BinaryClosingByReconstructionImageFilter(); + BinaryClosingByReconstructionImageFilter() = default; ~BinaryClosingByReconstructionImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx index 59759594a8a..f19d9db8a27 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx @@ -29,11 +29,6 @@ namespace itk { - -template -BinaryClosingByReconstructionImageFilter::BinaryClosingByReconstructionImageFilter() -{} - template void BinaryClosingByReconstructionImageFilter::GenerateInputRequestedRegion() diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h index bb346398473..0728ded3b31 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.h @@ -101,7 +101,7 @@ class ITK_TEMPLATE_EXPORT BinaryMorphologicalClosingImageFilter itkBooleanMacro(SafeBorder); /** @ITKEndGrouping */ protected: - BinaryMorphologicalClosingImageFilter(); + BinaryMorphologicalClosingImageFilter() = default; ~BinaryMorphologicalClosingImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx index 10887cec5f1..440f0344a19 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalClosingImageFilter.hxx @@ -37,10 +37,6 @@ namespace itk { -template -BinaryMorphologicalClosingImageFilter::BinaryMorphologicalClosingImageFilter() -{} - template void BinaryMorphologicalClosingImageFilter::GenerateData() diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h index 85383cea0ad..3b557ed5be1 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h @@ -99,7 +99,7 @@ class ITK_TEMPLATE_EXPORT BinaryMorphologicalOpeningImageFilter itkGetConstMacro(BackgroundValue, PixelType); protected: - BinaryMorphologicalOpeningImageFilter(); + BinaryMorphologicalOpeningImageFilter() = default; ~BinaryMorphologicalOpeningImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx index aed99d035cf..a665926f1e9 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.hxx @@ -34,10 +34,6 @@ namespace itk { -template -BinaryMorphologicalOpeningImageFilter::BinaryMorphologicalOpeningImageFilter() -{} - template void BinaryMorphologicalOpeningImageFilter::GenerateData() diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h index 54538cb15b5..87b742ed399 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.h @@ -101,7 +101,7 @@ class ITK_TEMPLATE_EXPORT BinaryOpeningByReconstructionImageFilter itkBooleanMacro(FullyConnected); /** @ITKEndGrouping */ protected: - BinaryOpeningByReconstructionImageFilter(); + BinaryOpeningByReconstructionImageFilter() = default; ~BinaryOpeningByReconstructionImageFilter() override = default; void PrintSelf(std::ostream & os, Indent indent) const override; diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx index 241599dee4d..96e7d81691a 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryOpeningByReconstructionImageFilter.hxx @@ -25,11 +25,6 @@ namespace itk { - -template -BinaryOpeningByReconstructionImageFilter::BinaryOpeningByReconstructionImageFilter() -{} - template void BinaryOpeningByReconstructionImageFilter::GenerateInputRequestedRegion()