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
32namespace itk::simple {
33
51 public:
53
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
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
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
138
139 Image Execute ( const Image& image1 );
140
141 private:
142
144
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
158
159 /* Number of iterations to run */
161
163
165
166
167 std::function<double()> m_pfGetAverageResidual;
168
169 // Holder of process object for active measurements
171
172 };
173
183
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
The Image class for SimpleITK.
Definition sitkImage.h:77
std::function< double()> m_pfGetAverageResidual
Self & SetSuperGridSize(std::vector< unsigned int > SuperGridSize)
Image ExecuteInternal(const Image &image1)
Image Execute(const Image &image1)
typelist2::append< BasicPixelIDTypeList, VectorPixelIDTypeList >::type PixelIDTypeList
Self & SetMaximumNumberOfIterations(uint32_t MaximumNumberOfIterations)
Number of iterations to run. Specify the number of iterations to run when optimizing the clusters.
std::vector< unsigned int > m_SuperGridSize
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
uint32_t GetMaximumNumberOfIterations() const
Image(Self::*)(const Image &image1) MemberFunctionType
Self & SetInitializationPerturbation(bool InitializationPerturbation)
Enable perturbation of initial cluster center location. After grid based initialization,...
std::string ToString() const
double GetAverageResidual() const
Get the current average cluster residual. After each iteration the residual is computed as the distan...
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
Self & SetEnforceConnectivity(bool EnforceConnectivity)
Post processing step to enforce superpixel morphology. Enable an additional computation which ensures...
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.
#define SITKBasicFilters_EXPORT