SimpleITK  
sitkSLICImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef sitkSLICImageFilter_h
19 #define sitkSLICImageFilter_h
20 
21 /*
22  * WARNING: DO NOT EDIT THIS FILE!
23  * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLEITK BUILD PROCESS.
24  * Please look at sitkImageFilterTemplate.h.in to make changes.
25  */
26 
27 #include <memory>
28 
29 #include "sitkBasicFilters.h"
30 #include "sitkImageFilter.h"
31 
32 namespace itk::simple {
33 
51  public:
53 
55  virtual ~SLICImageFilter();
56 
60 
62  using PixelIDTypeList = typelist2::append<BasicPixelIDTypeList, VectorPixelIDTypeList>::type;
63 \
64 
67  SITK_RETURN_SELF_TYPE_HEADER SetSuperGridSize ( std::vector<unsigned int> SuperGridSize ) { this->m_SuperGridSize = std::move(SuperGridSize); return *this; }
68 
71  std::vector<unsigned int> GetSuperGridSize() const { return this->m_SuperGridSize; }\
72 
77  SITK_RETURN_SELF_TYPE_HEADER SetSpatialProximityWeight ( double SpatialProximityWeight ) { this->m_SpatialProximityWeight = SpatialProximityWeight; return *this; }
78 
81  double GetSpatialProximityWeight() const { return this->m_SpatialProximityWeight; }\
82 
87  SITK_RETURN_SELF_TYPE_HEADER SetMaximumNumberOfIterations ( uint32_t MaximumNumberOfIterations ) { this->m_MaximumNumberOfIterations = MaximumNumberOfIterations; return *this; }
88 
91  uint32_t GetMaximumNumberOfIterations() const { return this->m_MaximumNumberOfIterations; }\
92 
97  SITK_RETURN_SELF_TYPE_HEADER SetEnforceConnectivity ( bool EnforceConnectivity ) { this->m_EnforceConnectivity = EnforceConnectivity; return *this; }
98 
100  SITK_RETURN_SELF_TYPE_HEADER EnforceConnectivityOn() { return this->SetEnforceConnectivity(true); }
101  SITK_RETURN_SELF_TYPE_HEADER EnforceConnectivityOff() { return this->SetEnforceConnectivity(false); }
102 
105  bool GetEnforceConnectivity() const { return this->m_EnforceConnectivity; }\
106 
111  SITK_RETURN_SELF_TYPE_HEADER SetInitializationPerturbation ( bool InitializationPerturbation ) { this->m_InitializationPerturbation = InitializationPerturbation; return *this; }
112 
114  SITK_RETURN_SELF_TYPE_HEADER InitializationPerturbationOn() { return this->SetInitializationPerturbation(true); }
115  SITK_RETURN_SELF_TYPE_HEADER InitializationPerturbationOff() { return this->SetInitializationPerturbation(false); }
116 
119  bool GetInitializationPerturbation() const { return this->m_InitializationPerturbation; }
127  double GetAverageResidual() const { return this->m_pfGetAverageResidual(); };
128 
129 
131  std::string GetName() const { return std::string ("SLICImageFilter"); }
132 
134  std::string ToString() const;
135 
136 
139  Image Execute ( const Image& image1 );
140 
141  private:
142 
145  using MemberFunctionType = Image (Self::*)( const Image& image1 );
146  template <class TImageType> Image ExecuteInternal ( const Image& image1 );
147 
148 
150 
151  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
152 
153 
154  /* */
155  std::vector<unsigned int> m_SuperGridSize{std::vector<unsigned int>(3, 50)};
156 
157  double m_SpatialProximityWeight{10.0};
158 
159  /* Number of iterations to run */
160  uint32_t m_MaximumNumberOfIterations{5u};
161 
162  bool m_EnforceConnectivity{true};
163 
164  bool m_InitializationPerturbation{true};
165 
166 
167  std::function<double()> m_pfGetAverageResidual;
168 
169  // Holder of process object for active measurements
170  itk::ProcessObject *m_Filter{nullptr};
171 
172  };
173 
184  SITKBasicFilters_EXPORT Image SLIC ( const Image& image1, std::vector<unsigned int> superGridSize = std::vector<unsigned int>(3, 50), double spatialProximityWeight = 10.0, uint32_t maximumNumberOfIterations = 5u, bool enforceConnectivity = true, bool initializationPerturbation = true );
185 
187 }
188 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
sitkBasicFilters.h
itk::simple::SLICImageFilter::PixelIDTypeList
typelist2::append< BasicPixelIDTypeList, VectorPixelIDTypeList >::type PixelIDTypeList
Definition: sitkSLICImageFilter.h:62
itk::simple::SLICImageFilter::GetAverageResidual
double GetAverageResidual() const
Get the current average cluster residual. After each iteration the residual is computed as the distan...
Definition: sitkSLICImageFilter.h:127
itk::simple::SLICImageFilter::SetInitializationPerturbation
Self & SetInitializationPerturbation(bool InitializationPerturbation)
Enable perturbation of initial cluster center location. After grid based initialization,...
Definition: sitkSLICImageFilter.h:111
itk::simple::SLICImageFilter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkSLICImageFilter.h:151
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:29
itk::simple::SLICImageFilter
Simple Linear Iterative Clustering (SLIC) super-pixel segmentation.
Definition: sitkSLICImageFilter.h:50
itk::simple::SLICImageFilter::GetSuperGridSize
std::vector< unsigned int > GetSuperGridSize() const
Definition: sitkSLICImageFilter.h:71
itk::simple::SLICImageFilter::SetSpatialProximityWeight
Self & SetSpatialProximityWeight(double SpatialProximityWeight)
The spatial weight for the distance function. Increasing this value makes the superpixel shape more r...
Definition: sitkSLICImageFilter.h:77
itk::simple::SLICImageFilter::SetSuperGridSize
Self & SetSuperGridSize(std::vector< unsigned int > SuperGridSize)
Definition: sitkSLICImageFilter.h:67
itk::simple::SLICImageFilter::EnforceConnectivityOff
Self & EnforceConnectivityOff()
Definition: sitkSLICImageFilter.h:101
sitkImageFilter.h
itk::simple::SLICImageFilter::m_pfGetAverageResidual
std::function< double()> m_pfGetAverageResidual
Definition: sitkSLICImageFilter.h:167
itk::simple::SLICImageFilter::GetName
std::string GetName() const
Definition: sitkSLICImageFilter.h:131
itk::simple::SLICImageFilter::InitializationPerturbationOn
Self & InitializationPerturbationOn()
Definition: sitkSLICImageFilter.h:114
itk::simple::SLICImageFilter::InitializationPerturbationOff
Self & InitializationPerturbationOff()
Definition: sitkSLICImageFilter.h:115
itk::simple::SLICImageFilter::GetSpatialProximityWeight
double GetSpatialProximityWeight() const
Definition: sitkSLICImageFilter.h:81
itk::simple::SLICImageFilter::SetEnforceConnectivity
Self & SetEnforceConnectivity(bool EnforceConnectivity)
Post processing step to enforce superpixel morphology. Enable an additional computation which ensures...
Definition: sitkSLICImageFilter.h:97
SITKBasicFilters_EXPORT
#define SITKBasicFilters_EXPORT
Definition: sitkBasicFilters.h:52
itk::simple::SLICImageFilter::GetInitializationPerturbation
bool GetInitializationPerturbation() const
Definition: sitkSLICImageFilter.h:119
itk::simple::SLICImageFilter::GetMaximumNumberOfIterations
uint32_t GetMaximumNumberOfIterations() const
Definition: sitkSLICImageFilter.h:91
itk::simple::SLICImageFilter::MemberFunctionType
Image(Self::*)(const Image &image1) MemberFunctionType
Definition: sitkSLICImageFilter.h:145
itk::simple::SLIC
Image SLIC(const Image &image1, std::vector< unsigned int > superGridSize=std::vector< unsigned int >(3, 50), double spatialProximityWeight=10.0, uint32_t maximumNumberOfIterations=5u, bool enforceConnectivity=true, bool initializationPerturbation=true)
Simple Linear Iterative Clustering (SLIC) super-pixel segmentation.
itk::ProcessObject
itk::simple::ImageFilter
The base interface for SimpleITK filters that take one input image.
Definition: sitkImageFilter.h:35
itk::Image
Definition: sitkPixelIDTypes.h:28
itk::simple::SLICImageFilter::GetEnforceConnectivity
bool GetEnforceConnectivity() const
Definition: sitkSLICImageFilter.h:105
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::simple::SLICImageFilter::SetMaximumNumberOfIterations
Self & SetMaximumNumberOfIterations(uint32_t MaximumNumberOfIterations)
Number of iterations to run. Specify the number of iterations to run when optimizing the clusters.
Definition: sitkSLICImageFilter.h:87
itk::simple::SLICImageFilter::EnforceConnectivityOn
Self & EnforceConnectivityOn()
Definition: sitkSLICImageFilter.h:100