cmeans.hh File Reference
`#include <mia/core/probmap.hh>`
`#include <mia/core/sparse_histogram.hh>`
Include dependency graph for cmeans.hh:

Go to the source code of this file.

## Data Structures

class | CMeans
class | CMeansInitializerSizedPlugin
class | CMeans::Initializer
class | CMeans::SparseProbmap

## Typedefs

typedef TFactory< CMeans::Initializer > | CMeansInitializerPlugin
typedef THandlerSingleton< TFactoryPluginHandler< CMeansInitializerPlugin > > | CMeansInitializerPluginHandler

## Functions

template<typename T, template< class > class Field>
void | cmeans_evaluate_probabilities (const Field< T > &image, const Field< float > &gain, const std::vector< double > &class_centers, std::vector< Field< float > > &pv)
| evaluate the probabilities for a c-means classification with gain field
template<typename T, template< class > class Field>
double | cmeans_update_class_centers (const Field< T > &image, const Field< float > &gain, const std::vector< Field< float > > &pv, std::vector< double > &class_centers)

## Variables

template<>
const char *const | TPluginHandler< TFactory< CMeans::Initializer > >::m_help
| *‍/

## Typedef Documentation

## CMeansInitializerPlugin

typedef TFactory<CMeans::Initializer> CMeansInitializerPlugin

Definition at line 277 of file cmeans.hh.

## CMeansInitializerPluginHandler

typedef THandlerSingleton<TFactoryPluginHandler<CMeansInitializerPlugin> > CMeansInitializerPluginHandler

Definition at line 308 of file cmeans.hh.

## Function Documentation

## cmeans_evaluate_probabilities()

template<typename T, template< class > class Field>

void cmeans_evaluate_probabilities | ( | const Field< T > & | image,
|  | const Field< float > & | gain,
|  | const std::vector< double > & | class_centers,
|  | std::vector< Field< float > > & | pv )

evaluate the probabilities for a c-means classification with gain field

This function evaluates the per-pixel class probabilities for a c-means classification with gain field correction.

With n classes the evalaution is done aoocrding to

\[p_{k,i} := \left\{\begin{array}{lcl} I_k < c_0 & & p_{k,0} = 1, p_{k,i} = 0 \: \forall \: i \in [1, n-1]\\ c_j < I_k < c_{j+1} & & p_{k,l} = \frac{(I_k - g_k * c_{m})^2}{(I_k - g_k * c_{m})^2 + (I_k - g_k * c_{l})^2} \: \forall \: (l,m) \in \{(j, j+1), (j+1, j)\}\\ I_k > c_{n-1} & & p_{k,n} = 1, p_{k,i} = 0 \: \forall \: i \in [0, n-2] \end{array} \right. \]

Template Parameters

  T | input pixel type of the data to be classified
  Field | template of the data field type

Parameters

  [in] | image | image the classification is applied to
  [in] | gain | multiplicative gain field
  [in] | class_centers |
  [out] | pv | probability fields containing the evaluated probabilities

Definition at line 144 of file cmeans.hh.

## cmeans_update_class_centers()

template<typename T, template< class > class Field>

double cmeans_update_class_centers | ( | const Field< T > & | image,
|  | const Field< float > & | gain,
|  | const std::vector< Field< float > > & | pv,
|  | std::vector< double > & | class_centers )

Evaluate the new clas centers from

\[\sum_{k,i} (p_{i,k} I_k - g_k c_i)^2 \rightarrow \min \]

In order to avoid a ping-pong effect, the actual class center update is evaluated according to

\[c_i^{(t+1)} = \frac{1}{2} \left( \sum_{k} \frac{p_{i,k}^2 g_k I_k}{ p_{i,k}^2 g_k^2 } - c_i^{(t)} \right) \]

Template Parameters

  T | input pixel type of the data to be classified
  Field | template of the data field type

Parameters

  [in] | image | image the classification is applied to
  [in] | gain | multiplicative gain field
  [in] | pv | probability fields
  [in,out] | class_centers |

Returns
  sum of absolute change applied to the class centers

Definition at line 234 of file cmeans.hh.

References cvwarn().

## Variable Documentation

## TPluginHandler< TFactory< CMeans::Initializer > >::m_help

template<>

const char* const TPluginHandler< TFactory< CMeans::Initializer > >::m_help

*‍/

Definition at line 305 of file cmeans.hh.