Segmentation > Smart Cluster

Assigns each pixel to one of the specified classes using k-means clustering [1-4]. This can be a powerful and objective way of segmenting images. Works especially well for images with 3 or more feature types of interest, where different grayscale levels define the different feature types. This function results in a grayscale image where each class is colored according to the specified statistic of the underlying pixels.

To split the resulting image into different Layers, add a Set Memory image step afterwards, then iteratively call that restore image and use “Range Threshold” steps to select the different classes as B/W images.

1. Fill Type

Statistic to use to fill each cluster. Check “Auto Scale” to set the darkest class to black, set the brightest class to white, and scale in-between classes accordingly.

  • Mean: Fills each cluster with mean value of underlying pixels
  • Median: Fills each cluster with median value of underlying pixels
  • StdDev: Fills each cluster with standard deviation of underlying pixels
  • Min: Fills each cluster with minimum value of underlying pixels
  • Max: Fills each cluster with maximum value of underlying pixels
  • Class: Fills each cluster with value of its class. Image is normalized from 0 to 255 afterwards for easier visualization.

2. Classes

Number of classes to cluster each pixel into. If you are trying to segment one set of features from the background, you should enter 2 classes.

3. Edge Type

Class order for edge cleaning

  • Dark to Bright: Expands each class to clean edges from darkest class to brightest class. Recommended to clean edge artifacts for dark features on bright backgrounds.
  • Bright to Dark: Expands each class to clean edges from brightest class to darkest class. Recommended to clean edge artifacts for bright features on dark backgrounds.

4. Edge Clean

Factor which controls extent to which edge artifacts are removed. The value indicates the max pixel thickness of edge artifacts that will be removed. Use 0 for no cleaning.

5. Speed

Parameter that controls the resolution of the cluster. Lower speed results in higher resolution clustering, but takes longer. Higher speed results in faster execution but lower resolution clustering.


[1] Arthur, David, and Sergi Vassilvitskii. “K-means++: The Advantages of Careful Seeding.” SODA ‘07: Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms. 2007, pp. 1027–1035.

[2] Lloyd, Stuart P. “Least Squares Quantization in PCM.” IEEE Transactions on Information Theory. Vol. 28, 1982, pp. 129–137.

[3] Seber, G. A. F. Multivariate Observations. Hoboken, NJ: John Wiley & Sons, Inc., 1984.

[4] Spath, H. Cluster Dissection and Analysis: Theory, FORTRAN Programs, Examples. Translated by J. Goldschmidt. New York: Halsted Press, 1985.


  • Smart cluster with 2 classes is equivalent to a basic threshold with the ‘Auto’ setting, avoid this to improve objectivity
  • Use smart cluster to objectively classify grayscale image data into discrete feature clusters where the number of classes is equal to the number of discrete features you’re interested in.


Need more help with this?
Chat with an expert now ››

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.