SimpleITK  1.2.4
sitkSLICImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
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  typedef typelist::Append<BasicPixelIDTypeList, VectorPixelIDTypeList>::Type PixelIDTypeList;
64 
65 
66 
69  SITK_RETURN_SELF_TYPE_HEADER SetSuperGridSize ( const std::vector<unsigned int> & SuperGridSize ) { this->m_SuperGridSize = SuperGridSize; return *this; }
70 
73  std::vector<unsigned int> GetSuperGridSize() const { return this->m_SuperGridSize; }
74 
79  SITK_RETURN_SELF_TYPE_HEADER SetSpatialProximityWeight ( double SpatialProximityWeight ) { this->m_SpatialProximityWeight = SpatialProximityWeight; return *this; }
80 
83  double GetSpatialProximityWeight() const { return this->m_SpatialProximityWeight; }
84 
89  SITK_RETURN_SELF_TYPE_HEADER SetMaximumNumberOfIterations ( uint32_t MaximumNumberOfIterations ) { this->m_MaximumNumberOfIterations = MaximumNumberOfIterations; return *this; }
90 
93  uint32_t GetMaximumNumberOfIterations() const { return this->m_MaximumNumberOfIterations; }
94 
99  SITK_RETURN_SELF_TYPE_HEADER SetEnforceConnectivity ( bool EnforceConnectivity ) { this->m_EnforceConnectivity = EnforceConnectivity; return *this; }
100 
102  SITK_RETURN_SELF_TYPE_HEADER EnforceConnectivityOn() { return this->SetEnforceConnectivity(true); }
103  SITK_RETURN_SELF_TYPE_HEADER EnforceConnectivityOff() { return this->SetEnforceConnectivity(false); }
104 
107  bool GetEnforceConnectivity() const { return this->m_EnforceConnectivity; }
108 
113  SITK_RETURN_SELF_TYPE_HEADER SetInitializationPerturbation ( bool InitializationPerturbation ) { this->m_InitializationPerturbation = InitializationPerturbation; return *this; }
114 
116  SITK_RETURN_SELF_TYPE_HEADER InitializationPerturbationOn() { return this->SetInitializationPerturbation(true); }
117  SITK_RETURN_SELF_TYPE_HEADER InitializationPerturbationOff() { return this->SetInitializationPerturbation(false); }
118 
121  bool GetInitializationPerturbation() const { return this->m_InitializationPerturbation; }
129  double GetAverageResidual() const { return this->m_pfGetAverageResidual(); };
130 
132  std::string GetName() const { return std::string ("SLICImageFilter"); }
133 
135  std::string ToString() const;
136 
137 
139  Image Execute ( const Image& image1 );
140 
141 
143  Image Execute ( const Image& image1, const std::vector<unsigned int> & superGridSize, double spatialProximityWeight, uint32_t maximumNumberOfIterations, bool enforceConnectivity, bool initializationPerturbation );
144 
145  private:
146 
149  typedef Image (Self::*MemberFunctionType)( const Image& image1 );
150  template <class TImageType> Image ExecuteInternal ( const Image& image1 );
151 
152 
153  friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
154 
155  nsstd::auto_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
156 
157 
158  /* */
159  std::vector<unsigned int> m_SuperGridSize;
161  /* Number of iterations to run */
165 
166  nsstd::function<double()> m_pfGetAverageResidual;
167 
168  // Holder of process object for active measurements
170  };
171 
172 
181  SITKBasicFilters_EXPORT Image SLIC ( const Image& image1, const 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 );
182 
183  }
184 }
185 #endif
uint32_t GetMaximumNumberOfIterations() const
Self & SetEnforceConnectivity(bool EnforceConnectivity)
Post processing step to enforce superpixel morphology. Enable an additional computation which ensures...
#define SITKBasicFilters_EXPORT
Self & SetMaximumNumberOfIterations(uint32_t MaximumNumberOfIterations)
Number of iterations to run. Specify the number of iterations to run when optimizing the clusters...
Self & SetSuperGridSize(const std::vector< unsigned int > &SuperGridSize)
Self & SetSpatialProximityWeight(double SpatialProximityWeight)
The spatial weight for the distance function. Increasing this value makes the superpixel shape more r...
std::vector< unsigned int > GetSuperGridSize() const
Simple Linear Iterative Clustering (SLIC) super-pixel segmentation.
double GetSpatialProximityWeight() const
nsstd::function< double()> m_pfGetAverageResidual
typelist::Append< BasicPixelIDTypeList, VectorPixelIDTypeList >::Type PixelIDTypeList
double GetAverageResidual() const
Get the current average cluster residual. After each iteration the residual is computed as the distan...
::uint32_t uint32_t
The Image class for SimpleITK.
Definition: sitkImage.h:78
Image SLIC(const Image &image1, const 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.
std::vector< unsigned int > m_SuperGridSize
nsstd::auto_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Self & SetInitializationPerturbation(bool InitializationPerturbation)
Enable perturbation of initial cluster center location. After grid based initialization, this option enables moving the initial cluster center location to the minimum gradient in a small neighborhood. If the grid size is less than three this is automatically disabled.
The base interface for SimpleITK filters that take one input image.