Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction > Class Template Reference
[Pixel Classification Filters]

Base class for ImageKmeansModelEstimator object. More...

#include <itkImageKmeansModelEstimator.h>

Inheritance diagram for itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >:

Inheritance graph
[legend]
Collaboration diagram for itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >:

Collaboration graph
[legend]
List of all members.

[NOHEADER]

void PrintKmeansAlgorithmResults ()

Public Types

typedef ImageKmeansModelEstimator Self
typedef ImageModelEstimatorBase<
TInputImage, TMembershipFunction > 
Superclass
typedef SmartPointer< SelfPointer
typedef SmartPointer< const
Self
ConstPointer
typedef TInputImage InputImageType
typedef TInputImage::Pointer InputImagePointer
typedef TInputImage::ConstPointer InputImageConstPointer
typedef TInputImage::PixelType::VectorType InputImageVectorType
typedef TInputImage::PixelType InputImagePixelType
typedef ImageRegionIterator<
TInputImage > 
InputImageIterator
typedef ImageRegionConstIterator<
TInputImage > 
InputImageConstIterator
typedef TMembershipFunction::Pointer MembershipFunctionPointer
typedef vnl_matrix< double > CodebookMatrixOfDoubleType
typedef vnl_matrix< int > CodebookMatrixOfIntegerType

Public Member Functions

virtual const char * GetClassName () const
void SetCodebook (CodebookMatrixOfDoubleType InCodebook)
virtual CodebookMatrixOfDoubleType GetCodebook ()
CodebookMatrixOfDoubleType GetOutCodebook ()
virtual void SetThreshold (double _arg)
virtual double GetThreshold ()
virtual void SetOffsetAdd (double _arg)
virtual double GetOffsetAdd ()
virtual void SetOffsetMultiply (double _arg)
virtual double GetOffsetMultiply ()
virtual void SetMaxSplitAttempts (int _arg)
virtual int GetMaxSplitAttempts ()
CodebookMatrixOfDoubleType GetKmeansResults (void)

Static Public Member Functions

Pointer New ()

Protected Member Functions

 ImageKmeansModelEstimator ()
 ~ImageKmeansModelEstimator ()
virtual void PrintSelf (std::ostream &os, Indent indent) const
void GenerateData ()
void Allocate ()

Detailed Description

template<class TInputImage, class TMembershipFunction>
class itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >

Base class for ImageKmeansModelEstimator object.

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.

See also:
KdTreeBasedKmeansEstimator, WeightedCentroidKdTreeGenerator, KdTree

Definition at line 126 of file itkImageKmeansModelEstimator.h.


Member Typedef Documentation

template<class TInputImage, class TMembershipFunction>
typedef vnl_matrix<double> itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::CodebookMatrixOfDoubleType
 

Type definition for a double matrix. Definition at line 167 of file itkImageKmeansModelEstimator.h.

Referenced by itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetKmeansResults(), and itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetOutCodebook().

template<class TInputImage, class TMembershipFunction>
typedef vnl_matrix<int> itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::CodebookMatrixOfIntegerType
 

Type definition for an integer vector. Definition at line 170 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef SmartPointer<const Self> itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::ConstPointer
 

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

Definition at line 135 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef ImageRegionConstIterator<TInputImage> itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::InputImageConstIterator
 

Definition at line 161 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef TInputImage::ConstPointer itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::InputImageConstPointer
 

Definition at line 146 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef ImageRegionIterator<TInputImage> itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::InputImageIterator
 

Type definition for the input image iterator type. Definition at line 158 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef TInputImage::PixelType itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::InputImagePixelType
 

Type definition for the input image pixel type. Definition at line 154 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef TInputImage::Pointer itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::InputImagePointer
 

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

Definition at line 145 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef TInputImage itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::InputImageType
 

Type definition for the input image.

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

Definition at line 144 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef TInputImage::PixelType::VectorType itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::InputImageVectorType
 

Type definition for the vector associated with input image pixel type. Definition at line 151 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef TMembershipFunction::Pointer itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::MembershipFunctionPointer
 

Type definitions for the membership function .

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

Definition at line 164 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef SmartPointer<Self> itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::Pointer
 

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

Definition at line 134 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef ImageKmeansModelEstimator itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::Self
 

Standard class typedefs.

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

Definition at line 131 of file itkImageKmeansModelEstimator.h.

template<class TInputImage, class TMembershipFunction>
typedef ImageModelEstimatorBase<TInputImage, TMembershipFunction> itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::Superclass
 

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

Definition at line 132 of file itkImageKmeansModelEstimator.h.


Constructor & Destructor Documentation

template<class TInputImage, class TMembershipFunction>
itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::ImageKmeansModelEstimator  )  [protected]
 

template<class TInputImage, class TMembershipFunction>
itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::~ImageKmeansModelEstimator  )  [protected]
 


Member Function Documentation

template<class TInputImage, class TMembershipFunction>
void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::Allocate  )  [protected]
 

Allocate memory for the output model.

template<class TInputImage, class TMembershipFunction>
void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GenerateData  )  [protected, virtual]
 

Starts the image modelling process

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

template<class TInputImage, class TMembershipFunction>
virtual const char* itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetClassName  )  const [virtual]
 

Run-time type information (and related methods).

Reimplemented from itk::ImageModelEstimatorBase< TInputImage, TMembershipFunction >.

template<class TInputImage, class TMembershipFunction>
virtual CodebookMatrixOfDoubleType itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetCodebook  )  [virtual]
 

Get the cluster centers.

template<class TInputImage, class TMembershipFunction>
CodebookMatrixOfDoubleType itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetKmeansResults void   )  [inline]
 

Return the codebook/cluster centers. Definition at line 207 of file itkImageKmeansModelEstimator.h.

References itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::CodebookMatrixOfDoubleType.

template<class TInputImage, class TMembershipFunction>
virtual int itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetMaxSplitAttempts  )  [virtual]
 

Get the manimum number of attempts to split a codeword.

template<class TInputImage, class TMembershipFunction>
virtual double itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetOffsetAdd  )  [virtual]
 

Get the offset add parameter.

template<class TInputImage, class TMembershipFunction>
virtual double itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetOffsetMultiply  )  [virtual]
 

Get the offset multiplication parameter.

template<class TInputImage, class TMembershipFunction>
CodebookMatrixOfDoubleType itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetOutCodebook  )  [inline]
 

Get the optimized codebook or the centroids of the clusters. Definition at line 179 of file itkImageKmeansModelEstimator.h.

References itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::CodebookMatrixOfDoubleType.

template<class TInputImage, class TMembershipFunction>
virtual double itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::GetThreshold  )  [virtual]
 

Get the threshold parameter.

template<class TInputImage, class TMembershipFunction>
Pointer itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::New  )  [static]
 

Method for creation through the object factory.

Reimplemented from itk::LightProcessObject.

template<class TInputImage, class TMembershipFunction>
void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::PrintKmeansAlgorithmResults  )  [protected]
 

Print out the results on the screen for visual feedback.

template<class TInputImage, class TMembershipFunction>
virtual void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::PrintSelf std::ostream &  os,
Indent  indent
const [protected, virtual]
 

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 >.

template<class TInputImage, class TMembershipFunction>
void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::SetCodebook CodebookMatrixOfDoubleType  InCodebook  ) 
 

Set the cluster centers.

template<class TInputImage, class TMembershipFunction>
virtual void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::SetMaxSplitAttempts int  _arg  )  [virtual]
 

Set the maximum number of attempts to split a codeword.

template<class TInputImage, class TMembershipFunction>
virtual void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::SetOffsetAdd double  _arg  )  [virtual]
 

Set the offset add parameter.

template<class TInputImage, class TMembershipFunction>
virtual void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::SetOffsetMultiply double  _arg  )  [virtual]
 

Set the offset multiplication parameter.

template<class TInputImage, class TMembershipFunction>
virtual void itk::ImageKmeansModelEstimator< TInputImage, TMembershipFunction >::SetThreshold double  _arg  )  [virtual]
 

Set the threshold parameter.


The documentation for this class was generated from the following file:
Generated at Sun Apr 1 02:50:19 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000