SurpriseImage< T > Class Template Reference

A 2D array of SurpriseModel objects. More...

#include <Surprise/SurpriseImage.H>

Inheritance diagram for SurpriseImage< T >:
Inheritance graph
[legend]
Collaboration diagram for SurpriseImage< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SurpriseImage ()
 Uninitialized constructor.
 SurpriseImage (const Dims &dims)
 Constructor for an empty SurpriseImage with uninitialized models.
 SurpriseImage (const double updfac, const Image< double > &sampleval, const Image< double > &samplevar)
 Constructor from given sample means and variances.
virtual ~SurpriseImage ()
 Virtual destructor ensures proper destruction of derived classes.
virtual void reset ()
 Reset all models to initial state.
virtual void init (const double updfac, const Image< double > &sampleval, const Image< double > &samplevar)
 Init to given sample mean and variance.
virtual void resetUpdFac (const double updfac)
 reset our update factor
virtual Image< double > surprise (const SurpriseImage< T > &other)
 Compute surprise between us and another model.
virtual void preComputeHyperParams (const SurpriseImage< T > &models)
 For models with covariance, pre-compute hyper parameters.
virtual void neighborhoods (const SurpriseImage< T > &models, const float neighsigma)
 Initialize us as a weighted combination of the given map of models.
virtual void neighborhoods (const SurpriseImage< T > &models, const Image< float > &weights)
 Initialize us as a weighted combination of the given map of models.
virtual void neighborhoods (const SurpriseImage< T > &models, const Image< float > &weights, const bool NO_INIT)
 Call this to re-use the model and not initialize the model with a new one.
virtual Image< double > getMean () const
 get our means
virtual Image< double > getVar () const
 get our variances
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSP > &models, const Image< float > &weights)
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSP1 > &models, const Image< float > &weights)
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSPC > &models, const Image< float > &weights)
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSPF > &models, const Image< float > &weights)
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSP > &models, const Image< float > &weights, const bool NO_INIT)
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSP1 > &models, const Image< float > &weights, const bool NO_INIT)
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSPC > &models, const Image< float > &weights, const bool NO_INIT)
template<>
void neighborhoods (const SurpriseImage< SurpriseModelSPF > &models, const Image< float > &weights, const bool NO_INIT)

Detailed Description

template<class T>
class SurpriseImage< T >

A 2D array of SurpriseModel objects.

This class is derived fromImage and inherits all its functionality, and in addition provides batch access to several of the SurpriseModel functions. Although the template argument T could in principle be anything, it is required that it supports the SurpriseModel functions like update(), surprise(), etc

Definition at line 52 of file SurpriseImage.H.


Constructor & Destructor Documentation

template<class T >
SurpriseImage< T >::SurpriseImage (  )  [inline]

Uninitialized constructor.

Definition at line 45 of file SurpriseImage.C.

template<class T >
SurpriseImage< T >::SurpriseImage ( const Dims dims  )  [inline]

Constructor for an empty SurpriseImage with uninitialized models.

Definition at line 51 of file SurpriseImage.C.

template<class T >
SurpriseImage< T >::SurpriseImage ( const double  updfac,
const Image< double > &  sampleval,
const Image< double > &  samplevar 
) [inline]

Constructor from given sample means and variances.

Definition at line 57 of file SurpriseImage.C.

References SurpriseImage< T >::init().

template<class T >
SurpriseImage< T >::~SurpriseImage (  )  [inline, virtual]

Virtual destructor ensures proper destruction of derived classes.

Definition at line 65 of file SurpriseImage.C.


Member Function Documentation

template<class T >
Image< double > SurpriseImage< T >::getMean (  )  const [inline, virtual]

get our means

Definition at line 430 of file SurpriseImage.C.

References Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), and Image< T >::getDims().

Referenced by SurpriseMap< T >::surprise().

template<class T >
Image< double > SurpriseImage< T >::getVar (  )  const [inline, virtual]

get our variances

Definition at line 445 of file SurpriseImage.C.

References Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), and Image< T >::getDims().

Referenced by SurpriseMap< T >::surprise().

template<class T >
void SurpriseImage< T >::init ( const double  updfac,
const Image< double > &  sampleval,
const Image< double > &  samplevar 
) [inline, virtual]

Init to given sample mean and variance.

Definition at line 79 of file SurpriseImage.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), and Image< T >::isSameSize().

Referenced by SurpriseImage< T >::SurpriseImage().

template<class T>
void SurpriseImage< T >::neighborhoods ( const SurpriseImage< T > &  models,
const Image< float > &  weights,
const bool  NO_INIT 
) [inline, virtual]

Call this to re-use the model and not initialize the model with a new one.

This is a variant to use neighborhoods without needing to copy in a new model but insted preserves the current model params

Definition at line 283 of file SurpriseImage.C.

References ASSERT, Image< T >::beginw(), Image< T >::getHeight(), Image< T >::getWidth(), and Point2D< T >::i.

template<class T>
void SurpriseImage< T >::neighborhoods ( const SurpriseImage< T > &  models,
const Image< float > &  weights 
) [inline, virtual]

Initialize us as a weighted combination of the given map of models.

This will initialize us so that each of our pixels is built from the SurpriseModel combineFrom() function. In this version, weights should be an image with double+1 the width and height of models.

Definition at line 147 of file SurpriseImage.C.

References ASSERT, Image< T >::beginw(), Image< T >::getHeight(), Image< T >::getWidth(), and Point2D< T >::i.

template<class T>
void SurpriseImage< T >::neighborhoods ( const SurpriseImage< T > &  models,
const float  neighsigma 
) [inline, virtual]

Initialize us as a weighted combination of the given map of models.

This will initialize us so that each of our pixels is built from the SurpriseModel combineFrom() function, with a Gaussian weighing mask centered onto that pixel and with sigma given here as argument.

Definition at line 128 of file SurpriseImage.C.

References Image< T >::beginw(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getWidth(), and Point2D< T >::i.

Referenced by SurpriseMap< T >::surprise().

template<class T>
void SurpriseImage< T >::preComputeHyperParams ( const SurpriseImage< T > &  models  )  [inline, virtual]

For models with covariance, pre-compute hyper parameters.

Definition at line 118 of file SurpriseImage.C.

References Image< T >::begin(), Image< T >::beginw(), and Image< T >::endw().

template<class T >
void SurpriseImage< T >::reset ( void   )  [inline, virtual]

Reset all models to initial state.

Definition at line 70 of file SurpriseImage.C.

References Image< T >::beginw(), and Image< T >::endw().

template<class T >
void SurpriseImage< T >::resetUpdFac ( const double  updfac  )  [inline, virtual]

reset our update factor

Definition at line 94 of file SurpriseImage.C.

References Image< T >::beginw(), and Image< T >::endw().

Referenced by SurpriseMap< T >::surprise().

template<class T>
Image< double > SurpriseImage< T >::surprise ( const SurpriseImage< T > &  other  )  [inline, virtual]

Compute surprise between us and another model.

Definition at line 102 of file SurpriseImage.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), Image< T >::getDims(), Image< T >::isSameSize(), and NO_INIT.

Referenced by SurpriseMap< T >::surprise().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:50 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3