#include <itkImageKmeansModelEstimator.h>
Inheritance diagram for itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >:
itkImageKmeansModelEstimator generated the kmeans model (cluster centers). This object performs clustering of data sets into different clusters either using user provided seed points as initial guess or generating the clusters using a recursive approach when the user provides the number of desired clusters. Each cluster is represented by its cluster center. The two algorithms used are the generalized Lloyd algorithm (GLA) and the Linde-Buzo-Gray algorithms. The cluster centers are also referred to as codewords and a table of cluster centers is is referred as a codebook.
As required by the GLA algorithm, the initial seed cluster should contain approximate centers of clusters. The GLA algorithm genrates an updated cluster centers that result in a lower distortion than the input seed cluster when the input vectors are mapped/classified/labelled using the given codebooks.
If no codebook is provided, the Linde-Buzo-Gray algorithm is used. This algorithm uses the GLA algorithm at its core to generate the centroids of the input vectors (data). However, since there is no initial codebook, LBG first creates a one word codebook (or centroid of one cluster comprising of all the input training vectors). The LBG uses codeword/or centroid splitting to create increasing number of clusters. Each new set of clusters are optimized using the GLA algorithm. The number of clusters increases as $2^{n}$ n= 0, 1, ... The codebook is expected to be in the form of a vnl matrix, where there are N rows. each row representing the cluster mean of a given cluster. The number of columns in a the codebook should be equal to the input image vector dimension.
The threshold parameter controls the ``optimality'' of the returned codebook where optimality is related to the least possible mean-squared error distortion that can be found by the algorithm. For larger thresholds, the result will be less optimal. For smaller thresholds, the result will be more optimal. If a more optimal result is desired, then the algorithm will take longer to complete. A reasonable threshold value is 0.01.
If, during the operation of the algorithm, there are any unused clusters or cells, the m_OffsetAdd and m_OffsetMultiply parameters is used to split the cells with the highest distortion. This functions will attempt to fill empty cells up to 10 times (unless the overall distortion is zero). Using 0.01 is a reasonable default values for the m_OffsetAdd and m_OffsetMultiply parameters.
If the GLA is unable to resolve the data into the desired number of clusters or cells, only the codewords which were used will be returned.
In terms of clustering, codewords are cluster centers, and a codebook is a table containing all cluster centers. The GLA produces results that are equivalent to the K-means clustering algorithm.
For more information about the algorithms, see A. Gersho and R. M. Gray, {Vector Quantization and Signal Compression}, Kluwer Academic Publishers, Boston, MA, 1992.
This object supports data handling of multiband images. The object accepts the input image in vector format only, where each pixel is a vector and each element of the vector corresponds to an entry from 1 particular band of a multiband dataset. A single band image is treated as a vector image with a single element for every vector.
This function is templated over the type of input image. In addition, a second parameter for the MembershipFunction needs to be specified. In this case a Membership function that store cluster centroids models needs to be specified.
The Update() function enables the calculation of the various models, creates the membership function objects and populates them.
Note: There is a second implementation of k-means algorithm in ITK under the itk::statistics namespace. While this algorithm (GLA/LBG based algorithm) is memory efficient, the other algorithm is time efficient.
Definition at line 127 of file itkImageKmeansModelEstimator.h.
|
Type definition for a double matrix. Definition at line 168 of file itkImageKmeansModelEstimator.h. Referenced by itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetKmeansResults(), and itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetOutCodebook(). |
|
Type definition for an integer vector. Definition at line 171 of file itkImageKmeansModelEstimator.h. |
|
Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. Definition at line 136 of file itkImageKmeansModelEstimator.h. |
|
Definition at line 162 of file itkImageKmeansModelEstimator.h. |
|
Definition at line 147 of file itkImageKmeansModelEstimator.h. |
|
Type definition for the input image iterator type. Definition at line 159 of file itkImageKmeansModelEstimator.h. |
|
Type definition for the input image pixel type. Definition at line 155 of file itkImageKmeansModelEstimator.h. |
|
Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. Definition at line 146 of file itkImageKmeansModelEstimator.h. |
|
Type definition for the input image. Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. Definition at line 145 of file itkImageKmeansModelEstimator.h. |
|
Type definition for the vector associated with input image pixel type. Definition at line 152 of file itkImageKmeansModelEstimator.h. |
|
Type definitions for the membership function . Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. Definition at line 165 of file itkImageKmeansModelEstimator.h. |
|
Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. Definition at line 135 of file itkImageKmeansModelEstimator.h. |
|
Standard class typedefs. Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. Definition at line 132 of file itkImageKmeansModelEstimator.h. |
|
Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. Definition at line 133 of file itkImageKmeansModelEstimator.h. |
|
|
|
|
|
Allocate memory for the output model. |
|
Starts the image modelling process Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. |
|
Get the cluster centers. |
|
Return the codebook/cluster centers. Definition at line 208 of file itkImageKmeansModelEstimator.h. References itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::CodebookMatrixOfDoubleType. |
|
Get the manimum number of attempts to split a codeword. |
|
Run-time type information (and related methods). Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. |
|
Get the offset add parameter. |
|
Get the offset multiplication parameter. |
|
Get the optimized codebook or the centroids of the clusters. Definition at line 180 of file itkImageKmeansModelEstimator.h. References itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::CodebookMatrixOfDoubleType. |
|
Get the threshold parameter. |
|
Method for creation through the object factory. Reimplemented from itk::LightProcessObject. |
|
Print out the results on the screen for visual feedback. |
|
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >. |
|
Set the cluster centers. |
|
Set the maximum number of attempts to split a codeword. |
|
Set the offset add parameter. |
|
Set the offset multiplication parameter. |
|
Set the threshold parameter. |