Package org.itk.simple
Class SLICImageFilter
java.lang.Object
org.itk.simple.ProcessObject
org.itk.simple.ImageFilter
org.itk.simple.SLICImageFilter
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 its 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., Yoo T. S. https://www.insight-journal.org/browse/publication/989
See:
itk::simple::SLIC for the procedural interface
itk::SLICImageFilter for the Doxygen on the original ITK class.
C++ includes: sitkSLICImageFilter.h
-
Field Summary
Fields inherited from class org.itk.simple.ProcessObject
swigCMemOwn
-
Constructor Summary
ConstructorsModifierConstructorDescriptionitk::simple::SLICImageFilter::SLICImageFilter() Default Constructor that takes no arguments and initializes default parametersprotected
SLICImageFilter
(long cPtr, boolean cMemoryOwn) -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
virtual itk::simple::SLICImageFilter::~SLICImageFilter() Destructorvoid
Self& itk::simple::SLICImageFilter::EnforceConnectivityOff()void
Self& itk::simple::SLICImageFilter::EnforceConnectivityOn() Set the value of EnforceConnectivity to true or false respectfully.Image itk::simple::SLICImageFilter::Execute(const Image &image1) Execute the filter on the input imageprotected void
finalize()
double
double itk::simple::SLICImageFilter::GetAverageResidual() const Get the current average cluster residual.protected static long
getCPtr
(SLICImageFilter obj) boolean
bool itk::simple::SLICImageFilter::GetEnforceConnectivity() constboolean
bool itk::simple::SLICImageFilter::GetInitializationPerturbation() constlong
uint32_t itk::simple::SLICImageFilter::GetMaximumNumberOfIterations() constgetName()
std::string itk::simple::SLICImageFilter::GetName() const Name of this classdouble
double itk::simple::SLICImageFilter::GetSpatialProximityWeight() conststd::vector<unsigned int> itk::simple::SLICImageFilter::GetSuperGridSize() constvoid
Self& itk::simple::SLICImageFilter::InitializationPerturbationOff()void
Self& itk::simple::SLICImageFilter::InitializationPerturbationOn() Set the value of InitializationPerturbation to true or false respectfully.void
setEnforceConnectivity
(boolean EnforceConnectivity) Self& itk::simple::SLICImageFilter::SetEnforceConnectivity(bool EnforceConnectivity) Post processing step to enforce superpixel morphology.void
setInitializationPerturbation
(boolean InitializationPerturbation) Self& itk::simple::SLICImageFilter::SetInitializationPerturbation(bool InitializationPerturbation) Enable perturbation of initial cluster center location.void
setMaximumNumberOfIterations
(long MaximumNumberOfIterations) Self& itk::simple::SLICImageFilter::SetMaximumNumberOfIterations(uint32_t MaximumNumberOfIterations) Number of iterations to run.void
setSpatialProximityWeight
(double SpatialProximityWeight) Self& itk::simple::SLICImageFilter::SetSpatialProximityWeight(double SpatialProximityWeight) The spatial weight for the distance function.void
setSuperGridSize
(VectorUInt32 SuperGridSize) Self& itk::simple::SLICImageFilter::SetSuperGridSize(std::vector< unsigned int > SuperGridSize)protected static long
toString()
std::string itk::simple::SLICImageFilter::ToString() const Print ourselves outMethods inherited from class org.itk.simple.ImageFilter
getCPtr, swigRelease
Methods inherited from class org.itk.simple.ProcessObject
abort, addCommand, debugOff, debugOn, getCPtr, getDebug, getGlobalDefaultCoordinateTolerance, getGlobalDefaultDebug, getGlobalDefaultDirectionTolerance, getGlobalDefaultNumberOfThreads, getGlobalDefaultThreader, getGlobalWarningDisplay, getNumberOfThreads, getNumberOfWorkUnits, getProgress, globalDefaultDebugOff, globalDefaultDebugOn, globalWarningDisplayOff, globalWarningDisplayOn, hasCommand, removeAllCommands, setDebug, setGlobalDefaultCoordinateTolerance, setGlobalDefaultDebug, setGlobalDefaultDirectionTolerance, setGlobalDefaultNumberOfThreads, setGlobalDefaultThreader, setGlobalWarningDisplay, setNumberOfThreads, setNumberOfWorkUnits, swigRelease
-
Constructor Details
-
SLICImageFilter
protected SLICImageFilter(long cPtr, boolean cMemoryOwn) -
SLICImageFilter
public SLICImageFilter()itk::simple::SLICImageFilter::SLICImageFilter() Default Constructor that takes no arguments and initializes default parameters
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalize
in classImageFilter
-
delete
public void delete()virtual itk::simple::SLICImageFilter::~SLICImageFilter() Destructor- Overrides:
delete
in classImageFilter
-
setSuperGridSize
Self& itk::simple::SLICImageFilter::SetSuperGridSize(std::vector< unsigned int > SuperGridSize) -
getSuperGridSize
std::vector<unsigned int> itk::simple::SLICImageFilter::GetSuperGridSize() const -
setSpatialProximityWeight
public void setSpatialProximityWeight(double SpatialProximityWeight) Self& itk::simple::SLICImageFilter::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. -
getSpatialProximityWeight
public double getSpatialProximityWeight()double itk::simple::SLICImageFilter::GetSpatialProximityWeight() const -
setMaximumNumberOfIterations
public void setMaximumNumberOfIterations(long MaximumNumberOfIterations) Self& itk::simple::SLICImageFilter::SetMaximumNumberOfIterations(uint32_t MaximumNumberOfIterations) Number of iterations to run. Specify the number of iterations to run when optimizing the clusters. -
getMaximumNumberOfIterations
public long getMaximumNumberOfIterations()uint32_t itk::simple::SLICImageFilter::GetMaximumNumberOfIterations() const -
setEnforceConnectivity
public void setEnforceConnectivity(boolean EnforceConnectivity) Self& itk::simple::SLICImageFilter::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. -
enforceConnectivityOn
public void enforceConnectivityOn()Self& itk::simple::SLICImageFilter::EnforceConnectivityOn() Set the value of EnforceConnectivity to true or false respectfully. -
enforceConnectivityOff
public void enforceConnectivityOff()Self& itk::simple::SLICImageFilter::EnforceConnectivityOff() -
getEnforceConnectivity
public boolean getEnforceConnectivity()bool itk::simple::SLICImageFilter::GetEnforceConnectivity() const -
setInitializationPerturbation
public void setInitializationPerturbation(boolean InitializationPerturbation) Self& itk::simple::SLICImageFilter::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. -
initializationPerturbationOn
public void initializationPerturbationOn()Self& itk::simple::SLICImageFilter::InitializationPerturbationOn() Set the value of InitializationPerturbation to true or false respectfully. -
initializationPerturbationOff
public void initializationPerturbationOff()Self& itk::simple::SLICImageFilter::InitializationPerturbationOff() -
getInitializationPerturbation
public boolean getInitializationPerturbation()bool itk::simple::SLICImageFilter::GetInitializationPerturbation() const -
getAverageResidual
public double getAverageResidual()double itk::simple::SLICImageFilter::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. 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. -
getName
std::string itk::simple::SLICImageFilter::GetName() const Name of this class- Overrides:
getName
in classProcessObject
-
toString
std::string itk::simple::SLICImageFilter::ToString() const Print ourselves out- Overrides:
toString
in classProcessObject
-
execute
Image itk::simple::SLICImageFilter::Execute(const Image &image1) Execute the filter on the input image
-