SimpleITK  2.0.0
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 {
33  namespace simple {
34 
52  public:
54 
56  virtual ~SLICImageFilter();
57 
61 
63  using PixelIDTypeList = typelist::Append<BasicPixelIDTypeList, VectorPixelIDTypeList>::Type;
64 \
65 
68  SITK_RETURN_SELF_TYPE_HEADER SetSuperGridSize ( std::vector<unsigned int> SuperGridSize ) { this->m_SuperGridSize = std::move(SuperGridSize); return *this; }
69 
72  std::vector<unsigned int> GetSuperGridSize() const { return this->m_SuperGridSize; }\
73 
78  SITK_RETURN_SELF_TYPE_HEADER SetSpatialProximityWeight ( double SpatialProximityWeight ) { this->m_SpatialProximityWeight = SpatialProximityWeight; return *this; }
79 
82  double GetSpatialProximityWeight() const { return this->m_SpatialProximityWeight; }\
83 
88  SITK_RETURN_SELF_TYPE_HEADER SetMaximumNumberOfIterations ( uint32_t MaximumNumberOfIterations ) { this->m_MaximumNumberOfIterations = MaximumNumberOfIterations; return *this; }
89 
92  uint32_t GetMaximumNumberOfIterations() const { return this->m_MaximumNumberOfIterations; }\
93 
98  SITK_RETURN_SELF_TYPE_HEADER SetEnforceConnectivity ( bool EnforceConnectivity ) { this->m_EnforceConnectivity = EnforceConnectivity; return *this; }
99 
101  SITK_RETURN_SELF_TYPE_HEADER EnforceConnectivityOn() { return this->SetEnforceConnectivity(true); }
102  SITK_RETURN_SELF_TYPE_HEADER EnforceConnectivityOff() { return this->SetEnforceConnectivity(false); }
103 
106  bool GetEnforceConnectivity() const { return this->m_EnforceConnectivity; }\
107 
112  SITK_RETURN_SELF_TYPE_HEADER SetInitializationPerturbation ( bool InitializationPerturbation ) { this->m_InitializationPerturbation = InitializationPerturbation; return *this; }
113 
115  SITK_RETURN_SELF_TYPE_HEADER InitializationPerturbationOn() { return this->SetInitializationPerturbation(true); }
116  SITK_RETURN_SELF_TYPE_HEADER InitializationPerturbationOff() { return this->SetInitializationPerturbation(false); }
117 
120  bool GetInitializationPerturbation() const { return this->m_InitializationPerturbation; }
128  double GetAverageResidual() const { return this->m_pfGetAverageResidual(); };
129 
130 
132  std::string GetName() const { return std::string ("SLICImageFilter"); }
133 
135  std::string ToString() const;
136 
137 
140  Image Execute ( const Image& image1 );
141 
142  private:
143 
146  using MemberFunctionType = Image (Self::*)( const Image& image1 );
147  template <class TImageType> Image ExecuteInternal ( const Image& image1 );
148 
149 
151 
152  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
153 
154 
155  /* */
156  std::vector<unsigned int> m_SuperGridSize{std::vector<unsigned int>(3, 50)};
157 
158  double m_SpatialProximityWeight{10.0};
159 
160  /* Number of iterations to run */
161  uint32_t m_MaximumNumberOfIterations{5u};
162 
163  bool m_EnforceConnectivity{true};
164 
165  bool m_InitializationPerturbation{true};
166 
167 
168  std::function<double()> m_pfGetAverageResidual;
169 
170  // Holder of process object for active measurements
171  itk::ProcessObject *m_Filter{nullptr};
172 
173  };
174 
185  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 );
186 
188  }
189 }
190 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:75
sitkBasicFilters.h
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:128
itk::simple::SLICImageFilter::SetInitializationPerturbation
Self & SetInitializationPerturbation(bool InitializationPerturbation)
Enable perturbation of initial cluster center location. After grid based initialization,...
Definition: sitkSLICImageFilter.h:112
itk::simple::SLICImageFilter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkSLICImageFilter.h:152
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:32
itk::simple::SLICImageFilter
Simple Linear Iterative Clustering (SLIC) super-pixel segmentation.
Definition: sitkSLICImageFilter.h:51
itk::simple::SLICImageFilter::GetSuperGridSize
std::vector< unsigned int > GetSuperGridSize() const
Definition: sitkSLICImageFilter.h:72
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:78
itk::simple::SLICImageFilter::SetSuperGridSize
Self & SetSuperGridSize(std::vector< unsigned int > SuperGridSize)
Definition: sitkSLICImageFilter.h:68
itk::simple::SLICImageFilter::EnforceConnectivityOff
Self & EnforceConnectivityOff()
Definition: sitkSLICImageFilter.h:102
sitkImageFilter.h
itk::simple::SLICImageFilter::m_pfGetAverageResidual
std::function< double()> m_pfGetAverageResidual
Definition: sitkSLICImageFilter.h:168
itk::simple::SLICImageFilter::GetName
std::string GetName() const
Definition: sitkSLICImageFilter.h:132
itk::simple::SLICImageFilter::InitializationPerturbationOn
Self & InitializationPerturbationOn()
Definition: sitkSLICImageFilter.h:115
itk::simple::SLICImageFilter::InitializationPerturbationOff
Self & InitializationPerturbationOff()
Definition: sitkSLICImageFilter.h:116
itk::simple::SLICImageFilter::GetSpatialProximityWeight
double GetSpatialProximityWeight() const
Definition: sitkSLICImageFilter.h:82
itk::simple::SLICImageFilter::SetEnforceConnectivity
Self & SetEnforceConnectivity(bool EnforceConnectivity)
Post processing step to enforce superpixel morphology. Enable an additional computation which ensures...
Definition: sitkSLICImageFilter.h:98
SITKBasicFilters_EXPORT
#define SITKBasicFilters_EXPORT
Definition: sitkBasicFilters.h:52
itk::simple::SLICImageFilter::GetInitializationPerturbation
bool GetInitializationPerturbation() const
Definition: sitkSLICImageFilter.h:120
itk::simple::SLICImageFilter::GetMaximumNumberOfIterations
uint32_t GetMaximumNumberOfIterations() const
Definition: sitkSLICImageFilter.h:92
itk::simple::SLICImageFilter::MemberFunctionType
Image(Self::*)(const Image &image1) MemberFunctionType
Definition: sitkSLICImageFilter.h:146
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
itk::ProcessObject
itk::simple::ImageFilter
The base interface for SimpleITK filters that take one input image.
Definition: sitkImageFilter.h:36
itk::simple::SLICImageFilter::PixelIDTypeList
typelist::Append< BasicPixelIDTypeList, VectorPixelIDTypeList >::Type PixelIDTypeList
Definition: sitkSLICImageFilter.h:63
itk::Image
Definition: sitkPixelIDTypes.h:26
itk::uint32_t
::uint32_t uint32_t
itk::simple::SLICImageFilter::GetEnforceConnectivity
bool GetEnforceConnectivity() const
Definition: sitkSLICImageFilter.h:106
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:88
itk::simple::SLICImageFilter::EnforceConnectivityOn
Self & EnforceConnectivityOn()
Definition: sitkSLICImageFilter.h:101