te::cl::ISOData Class Reference

ISOData strategy for an unsupervised pixel-based classification algorithm. More...

#include <ISOData.h>

Classes

class  ClusterData
 Cluster data. More...
 
class  Parameters
 Classifier Parameters. More...
 

Public Member Functions

bool classify (const InputAdaptor< double > &input, const std::vector< unsigned int > &attributesIndices, const std::vector< double > &inputNoDataValues, InputOutputAdaptor< ClusterData::ClusterLabelT > &output, const unsigned int outputIndex, const ClusterData::ClusterLabelT outputNoDataValue, const bool enableProgressInterface, std::vector< ClusterData > *clustersDataPtr)
 Classify an input iterated data and save the result on the output iterated data. More...
 
bool initialize (const Parameters &params)
 Initialize this classifier instance with new parameters. More...
 
 ISOData ()
 
 ~ISOData ()
 

Protected Types

typedef std::map< ClusterData::ClusterLabelT, ISOData::ClusterDataClustersContainerT
 

Protected Member Functions

bool classifyElements (const InputAdaptor< double > &input, const std::vector< unsigned int > &attributesIndices, const std::vector< double > &inputNoDataValues, ClustersContainerT &clustersMap, InputOutputAdaptor< unsigned int > &output, const unsigned int outputIndex, const unsigned int outputNoDataValue, const std::vector< std::pair< double, double > > &inputElementsOffsetsAndGains) const
 Classify each element following clusers centers. More...
 
bool initializeClusters (const InputAdaptor< double > &input, const std::vector< unsigned int > &attributesIndices, ClustersContainerT &clustersMap, ClusterData::ClusterLabelT &nextAvaliableClusterLabel, const std::vector< double > &inputNoDataValues, std::vector< std::pair< double, double > > &inputElementsOffsetsAndGains) const
 Initialize clusters. More...
 
bool removeSmallClusters (const unsigned int inputElelementsCount, ClustersContainerT &clustersMap) const
 Remove too mall clusters following the current parameters. More...
 
void reset ()
 Reset this instance to its initial state. More...
 
bool splitClusters (const unsigned int inputElementsCount, const unsigned int maxNumberOfSplits, ClusterData::ClusterLabelT &nextAvaliableClusterLabel, ClustersContainerT &clustersMap) const
 Split clusters. More...
 
bool updateClustersStats (const InputAdaptor< double > &input, const std::vector< unsigned int > &attributesIndices, const std::vector< double > &inputNoDataValues, ClustersContainerT &clustersMap, const InputOutputAdaptor< unsigned int > &output, const unsigned int outputIndex, const std::vector< std::pair< double, double > > &inputElementsOffsetsAndGains) const
 Update clusters statistical data. More...
 

Static Protected Member Functions

static bool mergeClusters (const double mergeDistThreshold, const unsigned int maxNumberOfMerges, ClustersContainerT &clustersMap)
 Merge clusters. More...
 
static void printClusters (const ClustersContainerT &clustersMap)
 
static void recodeClustersLabels (ClustersContainerT &clustersMap)
 Recode clusters labels to be in range zero up to the number of clusters - 1. More...
 

Protected Attributes

bool m_isInitialized
 True if this instance is initialized. More...
 
Parameters m_parameters
 Internal execution parameters. More...
 

Detailed Description

ISOData strategy for an unsupervised pixel-based classification algorithm.

Note
Based on Reference: IsoData Algorithm - Pattern Recognition Principles - Rafael Gonzalez, Julius T. Tou - Addison Wesley Publishing Company - 1974.

Definition at line 51 of file ISOData.h.

Member Typedef Documentation

◆ ClustersContainerT

Definition at line 144 of file ISOData.h.

Constructor & Destructor Documentation

◆ ISOData()

te::cl::ISOData::ISOData ( )

◆ ~ISOData()

te::cl::ISOData::~ISOData ( )

Member Function Documentation

◆ classify()

bool te::cl::ISOData::classify ( const InputAdaptor< double > &  input,
const std::vector< unsigned int > &  attributesIndices,
const std::vector< double > &  inputNoDataValues,
InputOutputAdaptor< ClusterData::ClusterLabelT > &  output,
const unsigned int  outputIndex,
const ClusterData::ClusterLabelT  outputNoDataValue,
const bool  enableProgressInterface,
std::vector< ClusterData > *  clustersDataPtr 
)

Classify an input iterated data and save the result on the output iterated data.

Parameters
inputInput data to be classified.
attributesIndicesThe attributes indexes to process from the iterated train data.
inputNoDataValuesA vector of no-data values for each attribute dimension or an empty vector if no-data values are not used.
outputOutput classified data.
outputIndexThe output attribute index.
outputNoDataValueA output label value to use when dealing with input no-data.
enableProgressInterfaceEnable/disable the use of a progress interface.
clustersDataPtrA pointer to a vector where the current clusters data will be storer or a null pointer.

◆ classifyElements()

bool te::cl::ISOData::classifyElements ( const InputAdaptor< double > &  input,
const std::vector< unsigned int > &  attributesIndices,
const std::vector< double > &  inputNoDataValues,
ClustersContainerT clustersMap,
InputOutputAdaptor< unsigned int > &  output,
const unsigned int  outputIndex,
const unsigned int  outputNoDataValue,
const std::vector< std::pair< double, double > > &  inputElementsOffsetsAndGains 
) const
protected

Classify each element following clusers centers.

Parameters
inputInput data to be classified.
attributesIndicesThe attributes indexes to process from the iterated train data.
inputNoDataValuesA vector of no-data values for each attribute dimension or an empty vector if no-data values are not used.
outputOutput classified data.
outputIndexThe output attribute index.
clustersMapClusters map.
outputNoDataValueOutput no-data value.
inputElementsOffsetsAndGainsElements offsets (first) and gains (second).
Note
Only the member ClusterData::m_means is used for this operation.
Valid updated members after: ClusterData::m_label, ClusterData::m_means, ClusterData::m_sums, ClusterData::m_size

◆ initialize()

bool te::cl::ISOData::initialize ( const Parameters params)

Initialize this classifier instance with new parameters.

Parameters
paramsNew initialization parameters.

◆ initializeClusters()

bool te::cl::ISOData::initializeClusters ( const InputAdaptor< double > &  input,
const std::vector< unsigned int > &  attributesIndices,
ClustersContainerT clustersMap,
ClusterData::ClusterLabelT nextAvaliableClusterLabel,
const std::vector< double > &  inputNoDataValues,
std::vector< std::pair< double, double > > &  inputElementsOffsetsAndGains 
) const
protected

Initialize clusters.

Parameters
inputInput data to be classified.
attributesIndicesThe attributes indexes to process from the iterated train data.
inputNoDataValuesA vector of no-data values for each attribute dimension or an empty vector if no-data values are not used.
clustersMapClusters map.
nextAvaliableClusterLabelReference to the global clusters labels counter.
inputElementsOffsetsAndGainsElements offsets (first) and gains (second).
Note
Updated clusters members: ClusterData::m_means, ClusterData::m_label.
Output = ( input + offset ) * gain;

◆ mergeClusters()

static bool te::cl::ISOData::mergeClusters ( const double  mergeDistThreshold,
const unsigned int  maxNumberOfMerges,
ClustersContainerT clustersMap 
)
staticprotected

Merge clusters.

Parameters
clustersMapClusters map.
mergeDistThresholdA distance treshold to control the merge process (higher values will allow the merge more clusters. Valid values: zero or positive values ).
maxNumberOfMergesMaximum number of merges.
Note
Only the members ClusterData::m_label, ClusterData::m_means, ClusterData::m_size are used for this operation.
Only the following members will be valid after merging: ClusterData::m_means, ClusterData::m_label, ClusterData::m_size.

◆ printClusters()

static void te::cl::ISOData::printClusters ( const ClustersContainerT clustersMap)
staticprotected

◆ recodeClustersLabels()

static void te::cl::ISOData::recodeClustersLabels ( ClustersContainerT clustersMap)
staticprotected

Recode clusters labels to be in range zero up to the number of clusters - 1.

Parameters
clustersMapClusters map.

◆ removeSmallClusters()

bool te::cl::ISOData::removeSmallClusters ( const unsigned int  inputElelementsCount,
ClustersContainerT clustersMap 
) const
protected

Remove too mall clusters following the current parameters.

Parameters
inputElelementsCountInput data elements counte.
clustersMapClusters map.
Note
Only the member ClusterData::m_size is used for this operation.

◆ reset()

void te::cl::ISOData::reset ( )
protected

Reset this instance to its initial state.

◆ splitClusters()

bool te::cl::ISOData::splitClusters ( const unsigned int  inputElementsCount,
const unsigned int  maxNumberOfSplits,
ClusterData::ClusterLabelT nextAvaliableClusterLabel,
ClustersContainerT clustersMap 
) const
protected

Split clusters.

Parameters
clustersMapClusters map.
inputElementsCountInput data total elements number.
maxNumberOfSplitsMaximum number of splits.
nextAvaliableClusterLabelReference to the global clusters labels counter.
Note
Only the members ClusterData::m_label, ClusterData::m_means, ClusterData::m_stdDevs, ClusterData::m_size, ClusterData::m_avgDistToClusterCenter are used for this operation.
Only the following members will be valid after splitting: ClusterData::m_means, ClusterData::m_label.

◆ updateClustersStats()

bool te::cl::ISOData::updateClustersStats ( const InputAdaptor< double > &  input,
const std::vector< unsigned int > &  attributesIndices,
const std::vector< double > &  inputNoDataValues,
ClustersContainerT clustersMap,
const InputOutputAdaptor< unsigned int > &  output,
const unsigned int  outputIndex,
const std::vector< std::pair< double, double > > &  inputElementsOffsetsAndGains 
) const
protected

Update clusters statistical data.

Parameters
inputInput data to be classified.
attributesIndicesThe attributes indexes to process from the iterated train data.
inputNoDataValuesA vector of no-data values for each attribute dimension or an empty vector if no-data values are not used.
outputOutput classified data.
outputIndexThe output attribute index.
clustersMapClusters map.
inputElementsOffsetsAndGainsElements offsets (first) and gains (second).
Note
Used clusters members: ClusterData::m_label, ClusterData::m_means, ClusterData::m_size
Updated clusters members: ClusterData::m_avgDistToClusterCenter, ClusterData::m_stdDevs.

Member Data Documentation

◆ m_isInitialized

bool te::cl::ISOData::m_isInitialized
protected

True if this instance is initialized.

Definition at line 146 of file ISOData.h.

◆ m_parameters

Parameters te::cl::ISOData::m_parameters
protected

Internal execution parameters.

Definition at line 147 of file ISOData.h.


The documentation for this class was generated from the following file: