From d5a4ea050ba7ddd020270a3a43d4afee904481bf Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 1 Aug 2024 08:56:14 -0400 Subject: [PATCH] ENH: Set Seeds as conntainer objects Best practices are to set member variables as object, and not repeat accessor methods in the interface of the owning object e.g. AddSeed, ClearSeed. --- .../include/itkIsolatedConnectedImageFilter.h | 22 ++++++++++++------- .../itkIsolatedConnectedImageFilter.hxx | 15 ------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h b/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h index 499229929d4..8347943ef12 100644 --- a/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h +++ b/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h @@ -106,7 +106,10 @@ class ITK_TEMPLATE_EXPORT IsolatedConnectedImageFilter : public ImageToImageFilt PrintSelf(std::ostream & os, Indent indent) const override; /** Add seed point 1. This seed will be isolated from Seed2 (if possible). - * All pixels connected to this seed will be replaced with ReplaceValue. */ + * All pixels connected to this seed will be replaced with ReplaceValue. + * + * \deprecated Please use SetSeeds1. + */ void AddSeed1(const IndexType & seed); @@ -115,7 +118,7 @@ class ITK_TEMPLATE_EXPORT IsolatedConnectedImageFilter : public ImageToImageFilt * This seed will be isolated from Seed2 (if possible). All pixels * connected to this seed will be replaced with ReplaceValue. * - * \deprecated Please use AddSeed1. + * \deprecated Please use SetSeeds1. */ void SetSeed1(const IndexType & seed); @@ -124,7 +127,10 @@ class ITK_TEMPLATE_EXPORT IsolatedConnectedImageFilter : public ImageToImageFilt void ClearSeeds1(); - /** Add seed point 2. This seed will be isolated from Seed1 (if possible). */ + /** Add seed point 2. This seed will be isolated from Seed1 (if possible). + * + * \deprecated Please use SetSeed2. + */ void AddSeed2(const IndexType & seed); @@ -132,7 +138,7 @@ class ITK_TEMPLATE_EXPORT IsolatedConnectedImageFilter : public ImageToImageFilt * * This seed will be isolated from Seed1 (if possible). * - * \deprecated Please use AddSeed2. + * \deprecated Please use SetSeed2. */ void SetSeed2(const IndexType & seed); @@ -142,10 +148,10 @@ class ITK_TEMPLATE_EXPORT IsolatedConnectedImageFilter : public ImageToImageFilt ClearSeeds2(); /** Method to access seed container */ - virtual const SeedsContainerType & - GetSeeds1() const; - virtual const SeedsContainerType & - GetSeeds2() const; + itkSetMacro(Seeds1, SeedsContainerType); + itkGetConstReferenceMacro(Seeds1, SeedsContainerType); + itkSetMacro(Seeds2, SeedsContainerType); + itkGetConstReferenceMacro(Seeds2, SeedsContainerType); /** Set/Get the limit on the lower threshold value. The default is * the NonpositiveMin() for the InputPixelType. */ diff --git a/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx b/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx index 3b1670e97d1..08e9b28725a 100644 --- a/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx +++ b/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx @@ -147,21 +147,6 @@ IsolatedConnectedImageFilter::ClearSeeds2() } } -template -auto -IsolatedConnectedImageFilter::GetSeeds1() const -> const SeedsContainerType & -{ - itkDebugMacro("returning Seeds1"); - return this->m_Seeds1; -} - -template -auto -IsolatedConnectedImageFilter::GetSeeds2() const -> const SeedsContainerType & -{ - itkDebugMacro("returning Seeds2"); - return this->m_Seeds2; -} template void