18 #ifndef sitkSLICImageFilter_h
19 #define sitkSLICImageFilter_h
63 typedef typelist::Append<BasicPixelIDTypeList, VectorPixelIDTypeList>::Type
PixelIDTypeList;
69 SITK_RETURN_SELF_TYPE_HEADER
SetSuperGridSize (
const std::vector<unsigned int> & SuperGridSize ) { this->m_SuperGridSize = SuperGridSize;
return *
this; }
79 SITK_RETURN_SELF_TYPE_HEADER
SetSpatialProximityWeight (
double SpatialProximityWeight ) { this->m_SpatialProximityWeight = SpatialProximityWeight;
return *
this; }
99 SITK_RETURN_SELF_TYPE_HEADER
SetEnforceConnectivity (
bool EnforceConnectivity ) { this->m_EnforceConnectivity = EnforceConnectivity;
return *
this; }
113 SITK_RETURN_SELF_TYPE_HEADER
SetInitializationPerturbation (
bool InitializationPerturbation ) { this->m_InitializationPerturbation = InitializationPerturbation;
return *
this; }
132 std::string
GetName()
const {
return std::string (
"SLICImageFilter"); }
135 std::string ToString()
const;
143 Image Execute (
const Image& image1,
const std::vector<unsigned int> & superGridSize,
double spatialProximityWeight,
uint32_t maximumNumberOfIterations,
bool enforceConnectivity,
bool initializationPerturbation );
149 typedef Image (Self::*MemberFunctionType)(
const Image& image1 );
150 template <
class TImageType>
Image ExecuteInternal (
const Image& image1 );
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 );
uint32_t GetMaximumNumberOfIterations() const
Self & SetEnforceConnectivity(bool EnforceConnectivity)
Post processing step to enforce superpixel morphology. Enable an additional computation which ensures...
itk::ProcessObject * m_Filter
Self & EnforceConnectivityOff()
#define SITKBasicFilters_EXPORT
Self & InitializationPerturbationOff()
bool GetInitializationPerturbation() const
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
bool GetEnforceConnectivity() const
uint32_t m_MaximumNumberOfIterations
Simple Linear Iterative Clustering (SLIC) super-pixel segmentation.
double GetSpatialProximityWeight() const
nsstd::function< double()> m_pfGetAverageResidual
typelist::Append< BasicPixelIDTypeList, VectorPixelIDTypeList >::Type PixelIDTypeList
std::string GetName() const
double GetAverageResidual() const
Get the current average cluster residual. After each iteration the residual is computed as the distan...
The Image class for SimpleITK.
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 & EnforceConnectivityOn()
double m_SpatialProximityWeight
bool m_EnforceConnectivity
Self & InitializationPerturbationOn()
bool m_InitializationPerturbation
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.