Class SLICImageFilter


public class SLICImageFilter extends ImageFilter
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
  • 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

      protected static long getCPtr(SLICImageFilter obj)
    • swigRelease

      protected static long swigRelease(SLICImageFilter obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class ImageFilter
    • delete

      public void delete()
      virtual itk::simple::SLICImageFilter::~SLICImageFilter() Destructor
      Overrides:
      delete in class ImageFilter
    • setSuperGridSize

      public void setSuperGridSize(VectorUInt32 SuperGridSize)
      Self& itk::simple::SLICImageFilter::SetSuperGridSize(std::vector< unsigned int > SuperGridSize)
    • getSuperGridSize

      public VectorUInt32 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

      public String getName()
      std::string itk::simple::SLICImageFilter::GetName() const Name of this class
      Overrides:
      getName in class ProcessObject
    • toString

      public String toString()
      std::string itk::simple::SLICImageFilter::ToString() const Print ourselves out
      Overrides:
      toString in class ProcessObject
    • execute

      public Image execute(Image image1)
      Image itk::simple::SLICImageFilter::Execute(const Image &image1) Execute the filter on the input image