Cluster img

From Eigenvector Research Documentation Wiki
Revision as of 17:25, 3 March 2011 by imported>Jeremy (→‎Description)
Jump to navigation Jump to search

Purpose

Perform automatic clustering of image using sample distances.

Synopsis

[clas,basis,info,h] = cluster_img(x,nclusters,options)
clas = cluster_img(x,basis,options)

Description

Performs partitional clustering (also known as Divisive Cluster Analysis, or DCA) in which samples are segregated into some pre-defined number of clusters (classes) based on their distance to the means of those classes.

The algorithm first identifies the specified number of unique samples (pixels) in a given image and considered the target spectrum for one of the target clusters. All other pixels are then classified into one of those clusters based on which of the target spectra they are closest to. When using the K-means algorithm, the mean of each cluster is then calculated and used as the new target spectrum for that cluster. All the pixels are re-evaluated for their cluster assignments again (allowing for some pixels to change assignment due to the change in target spectra). This process is repeated until pixels stop changing classes or the target spectra stop changing.

If the algorithm is DISTSLCT, the means of the classes are not used in place of the target spectra.

This function normally also implements a robustness test by discarding any target spectra which accumulate less than a specified percentage of the samples. Thus, very unusual pixels (samples) which are not like a significant portion of the other pixels will not be allowed to create useless clusters with no appreciable membership.

Inputs

  • [clas,basis,info,h] = cluster_img(x,nclusters,options) - The data to cluster (x), the total number of clusters to form (nclusters), and an optional (options) structure (see below), or
  • [clas,basis,info,h] = cluster_img(x,max_fract,options) - The data to cluster (x), the maximum fraction of samples allowed in a cluster (max_fract), and an optional (options) structure (see below), or
  • clas = cluster_img(x,basis,options) - A "prediction" call given the data to cluster (x), a previously calculated basis set returned by cluster_img (basis), and an optional (options) structure.

Outputs

Outputs are a vector of integer classes for each sample in x clas, the corresponding normalized basis spectra basis, information on the targets and correlation info, and the handle h of a figure if created. The output info is a structure containing the following fields:

  • corr = the correlation of each pixel to each target.
  • targets = the indices of the pixels used as targets.

Options

options = a structure array with the following fields:

  • plots: [ 'none' |{'final'}] governs plotting of results.
  • algorithm: [ 'distslct' |{'kmeans'}] algorithm for determining classes distslct is based solely on most unique samples; kmeans adjusts class target to mean of class (iterative).
  • minarea: { 1 } minimum area (in %) that a class must account for to be retained as a unique class.
  • preprocessing: { [] } preprocessing structure (see PREPROCESS).
  • pca: [ {'no'} | 'yes' ] When 'yes', A PCA model is calculated from the data and the scores are used to perform clustering. The output basis is in terms of the original variables.
  • ncomp: [ 1 ] Number of PCs (components) to retain from the PCA model. Only used if options.pca is 'yes'.

See Also

cluster, distslct, knn