SimpleITK
1.2.4
|
Simple Linear Iterative Clustering (SLIC) super-pixel segmentation. More...
#include <sitkSLICImageFilter.h>
Public Types | |
typedef typelist::Append< BasicPixelIDTypeList, VectorPixelIDTypeList >::Type | PixelIDTypeList |
typedef SLICImageFilter | Self |
Public Types inherited from itk::simple::ImageFilter< 1 > | |
typedef ImageFilter | Self |
Public Types inherited from itk::simple::ProcessObject | |
typedef ProcessObject | Self |
Public Member Functions | |
Self & | EnforceConnectivityOff () |
Self & | EnforceConnectivityOn () |
Image | Execute (const Image &image1) |
Image | Execute (const Image &image1, const std::vector< unsigned int > &superGridSize, double spatialProximityWeight, uint32_t maximumNumberOfIterations, bool enforceConnectivity, bool initializationPerturbation) |
double | GetAverageResidual () const |
Get the current average cluster residual. After each iteration the residual is computed as the distance between the current clusters and the previous. This is averaged so that the value is independent of the number of clusters. More... | |
bool | GetEnforceConnectivity () const |
bool | GetInitializationPerturbation () const |
uint32_t | GetMaximumNumberOfIterations () const |
std::string | GetName () const |
double | GetSpatialProximityWeight () const |
std::vector< unsigned int > | GetSuperGridSize () const |
Self & | InitializationPerturbationOff () |
Self & | InitializationPerturbationOn () |
Self & | SetEnforceConnectivity (bool EnforceConnectivity) |
Post processing step to enforce superpixel morphology. Enable an additional computation which ensures all label pixels of the same value are spatially connected. Disconnected labeled components are assigned a new value if of sufficient size, or are relabeled to the previously encountered value if small. More... | |
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. More... | |
Self & | SetMaximumNumberOfIterations (uint32_t MaximumNumberOfIterations) |
Number of iterations to run. Specify the number of iterations to run when optimizing the clusters. More... | |
Self & | SetSpatialProximityWeight (double SpatialProximityWeight) |
The spatial weight for the distance function. Increasing this value makes the superpixel shape more regular, but more varied in image values. The range of the pixel values and image dimension can effect the appropriate value. More... | |
Self & | SetSuperGridSize (const std::vector< unsigned int > &SuperGridSize) |
SLICImageFilter () | |
std::string | ToString () const |
virtual | ~SLICImageFilter () |
Public Member Functions inherited from itk::simple::ImageFilter< 1 > | |
ImageFilter () | |
virtual | ~ImageFilter ()=0 |
Public Member Functions inherited from itk::simple::ProcessObject | |
virtual void | Abort () |
virtual int | AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd) |
Add a Command Object to observer the event. More... | |
virtual float | GetProgress () const |
An Active Measurement of the progress of execution. More... | |
virtual bool | HasCommand (itk::simple::EventEnum event) const |
Query of this object has any registered commands for event. More... | |
ProcessObject () | |
virtual void | RemoveAllCommands () |
Remove all registered commands. More... | |
virtual | ~ProcessObject () |
virtual void | DebugOn () |
virtual void | DebugOff () |
virtual bool | GetDebug () const |
virtual void | SetDebug (bool debugFlag) |
virtual void | SetNumberOfThreads (unsigned int n) |
virtual unsigned int | GetNumberOfThreads () const |
Private Types | |
typedef Image(Self::* | MemberFunctionType) (const Image &image1) |
Private Member Functions | |
template<class TImageType > | |
Image | ExecuteInternal (const Image &image1) |
Private Attributes | |
bool | m_EnforceConnectivity |
itk::ProcessObject * | m_Filter |
bool | m_InitializationPerturbation |
uint32_t | m_MaximumNumberOfIterations |
nsstd::auto_ptr< detail::MemberFunctionFactory< MemberFunctionType > > | m_MemberFactory |
nsstd::function< double()> | m_pfGetAverageResidual |
double | m_SpatialProximityWeight |
std::vector< unsigned int > | m_SuperGridSize |
Friends | |
struct | detail::MemberFunctionAddressor< MemberFunctionType > |
Additional Inherited Members | |
Static Public Member Functions inherited from itk::simple::ProcessObject | |
static bool | GetGlobalDefaultDebug () |
static void | GlobalDefaultDebugOff () |
static void | GlobalDefaultDebugOn () |
static void | SetGlobalDefaultDebug (bool debugFlag) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static void | SetGlobalWarningDisplay (bool flag) |
static bool | GetGlobalWarningDisplay () |
static void | SetGlobalDefaultNumberOfThreads (unsigned int n) |
static unsigned int | GetGlobalDefaultNumberOfThreads () |
static double | GetGlobalDefaultCoordinateTolerance () |
Access the global tolerance to determine congruent spaces. More... | |
static void | SetGlobalDefaultCoordinateTolerance (double) |
Access the global tolerance to determine congruent spaces. More... | |
static double | GetGlobalDefaultDirectionTolerance () |
Access the global tolerance to determine congruent spaces. More... | |
static void | SetGlobalDefaultDirectionTolerance (double) |
Access the global tolerance to determine congruent spaces. More... | |
Protected Member Functions inherited from itk::simple::ProcessObject | |
virtual unsigned long | AddITKObserver (const itk::EventObject &, itk::Command *) |
virtual itk::ProcessObject * | GetActiveProcess () |
virtual void | OnActiveProcessDelete () |
virtual void | onCommandDelete (const itk::simple::Command *cmd) SITK_NOEXCEPT |
virtual void | PreUpdate (itk::ProcessObject *p) |
virtual void | RemoveITKObserver (EventCommand &e) |
Protected Member Functions inherited from itk::simple::NonCopyable | |
NonCopyable () | |
Static Protected Member Functions inherited from itk::simple::ImageFilter< 1 > | |
static void | FixNonZeroIndex (TImageType *img) |
Static Protected Member Functions inherited from itk::simple::ProcessObject | |
template<class TImageType > | |
static TImageType::ConstPointer | CastImageToITK (const Image &img) |
template<class TImageType > | |
static Image | CastITKToImage (TImageType *img) |
template<class TPixelType , unsigned int VImageDimension, unsigned int VLength, template< typename, unsigned int > class TVector> | |
static Image | CastITKToImage (itk::Image< TVector< TPixelType, VLength >, VImageDimension > *img) |
static const itk::EventObject & | GetITKEventObject (EventEnum e) |
template<typename T > | |
static std::ostream & | ToStringHelper (std::ostream &os, const T &v) |
static std::ostream & | ToStringHelper (std::ostream &os, const char &v) |
static std::ostream & | ToStringHelper (std::ostream &os, const signed char &v) |
static std::ostream & | ToStringHelper (std::ostream &os, const unsigned char &v) |
Simple Linear Iterative Clustering (SLIC) super-pixel segmentation.
The Simple Linear Iterative Clustering (SLIC) algorithm groups pixels into a set of labeled regions or super-pixels. Super-pixels follow natural image boundaries, are compact, and are nearly uniform regions which can be used as a larger primitive for more efficient computation. The SLIC algorithm can be viewed as a spatially constrained iterative k-means method.
The original algorithm was designed to cluster on the joint domain of the images index space and it's CIELAB color space. This implementation works with images of arbitrary dimension as well as scalar, single channel, images and most multi-component image types including ITK's arbitrary length VectorImage .
The distance between a pixel and a cluster is the sum of squares of the difference between their joint range and domains ( index and value ). The computation is done in index space with scales provided by the SpatialProximityWeight parameters.
The output is a label image with each label representing a superpixel cluster. Every pixel in the output is labeled, and the starting label id is zero.
This code was contributed in the Insight Journal paper: "Scalable Simple Linear Iterative Clustering (SSLIC) Using a Generic and Parallel Approach" by Lowekamp B. C., Chen D. T., Yaniv Z.
Definition at line 51 of file sitkSLICImageFilter.h.
|
private |
Setup for member function dispatching
Definition at line 149 of file sitkSLICImageFilter.h.
typedef typelist::Append<BasicPixelIDTypeList, VectorPixelIDTypeList>::Type itk::simple::SLICImageFilter::PixelIDTypeList |
Define the pixels types supported by this filter
Definition at line 63 of file sitkSLICImageFilter.h.
Definition at line 53 of file sitkSLICImageFilter.h.
|
virtual |
Destructor
itk::simple::SLICImageFilter::SLICImageFilter | ( | ) |
Default Constructor that takes no arguments and initializes default parameters
|
inline |
Definition at line 103 of file sitkSLICImageFilter.h.
|
inline |
Set the value of EnforceConnectivity to true or false respectfully.
Definition at line 102 of file sitkSLICImageFilter.h.
Execute the filter on the input image
Image itk::simple::SLICImageFilter::Execute | ( | const Image & | image1, |
const std::vector< unsigned int > & | superGridSize, | ||
double | spatialProximityWeight, | ||
uint32_t | maximumNumberOfIterations, | ||
bool | enforceConnectivity, | ||
bool | initializationPerturbation | ||
) |
Execute the filter on the input image with the given parameters
|
private |
|
inline |
Get the current average cluster residual. After each iteration the residual is computed as the distance between the current clusters and the previous. This is averaged so that the value is independent of the number of clusters.
This is an active measurement. It may be accessed while the filter is being executing in command call-backs and can be accessed after execution.
Definition at line 129 of file sitkSLICImageFilter.h.
|
inline |
Definition at line 107 of file sitkSLICImageFilter.h.
|
inline |
Definition at line 121 of file sitkSLICImageFilter.h.
|
inline |
Definition at line 93 of file sitkSLICImageFilter.h.
|
inlinevirtual |
Name of this class
Implements itk::simple::ProcessObject.
Definition at line 132 of file sitkSLICImageFilter.h.
|
inline |
Definition at line 83 of file sitkSLICImageFilter.h.
|
inline |
Definition at line 73 of file sitkSLICImageFilter.h.
|
inline |
Definition at line 117 of file sitkSLICImageFilter.h.
|
inline |
Set the value of InitializationPerturbation to true or false respectfully.
Definition at line 116 of file sitkSLICImageFilter.h.
|
inline |
Post processing step to enforce superpixel morphology. Enable an additional computation which ensures all label pixels of the same value are spatially connected. Disconnected labeled components are assigned a new value if of sufficient size, or are relabeled to the previously encountered value if small.
Definition at line 99 of file sitkSLICImageFilter.h.
|
inline |
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.
Definition at line 113 of file sitkSLICImageFilter.h.
|
inline |
Number of iterations to run. Specify the number of iterations to run when optimizing the clusters.
Definition at line 89 of file sitkSLICImageFilter.h.
|
inline |
The spatial weight for the distance function. Increasing this value makes the superpixel shape more regular, but more varied in image values. The range of the pixel values and image dimension can effect the appropriate value.
Definition at line 79 of file sitkSLICImageFilter.h.
|
inline |
Definition at line 69 of file sitkSLICImageFilter.h.
|
virtual |
Print ourselves out
Reimplemented from itk::simple::ProcessObject.
|
friend |
Definition at line 153 of file sitkSLICImageFilter.h.
|
private |
Definition at line 163 of file sitkSLICImageFilter.h.
|
private |
Definition at line 169 of file sitkSLICImageFilter.h.
|
private |
Definition at line 164 of file sitkSLICImageFilter.h.
|
private |
Definition at line 162 of file sitkSLICImageFilter.h.
|
private |
Definition at line 155 of file sitkSLICImageFilter.h.
|
private |
Definition at line 166 of file sitkSLICImageFilter.h.
|
private |
Definition at line 160 of file sitkSLICImageFilter.h.
|
private |
Definition at line 159 of file sitkSLICImageFilter.h.