DGtal  0.9.4beta
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
DGtal::Signal< TValue > Class Template Reference

#include <DGtal/math/Signal.h>

Inheritance diagram for DGtal::Signal< TValue >:
[legend]
Collaboration diagram for DGtal::Signal< TValue >:
[legend]

Public Types

typedef TValue Value
 

Public Member Functions

 ~Signal ()
 
 Signal ()
 
 Signal (unsigned int size, int z, bool periodic, const TValue &def=TValue(0))
 
 Signal (const TValue *t, unsigned int size, int z, bool periodic, const TValue &def=TValue(0))
 
 Signal (const Signal< TValue > &other)
 
Signal< TValue > & operator= (const Signal< TValue > &other)
 
void init (unsigned int s, int z=0, bool p=false, const TValue &def=TValue(0))
 
void init (const TValue *t, unsigned int size, int z=0, bool p=false, const TValue &def=TValue(0))
 
unsigned int size () const
 
TValue & operator[] (int i)
 
const TValue & operator[] (int i) const
 
void setAll (const TValue &val=TValue(0))
 
void multiply (const TValue &val)
 
Signal< TValue > operator* (const Signal< TValue > &G)
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Static Public Member Functions

static Signal< TValue > G2 ()
 
static Signal< TValue > H2 ()
 
static Signal< TValue > Delta ()
 
static Signal< TValue > G2n (unsigned int n)
 
static Signal< TValue > H2n (unsigned int n)
 
static Signal< TValue > D2n (unsigned int n)
 

Private Attributes

CowPtr< SignalData< TValue > > m_data
 

Detailed Description

template<typename TValue>
class DGtal::Signal< TValue >

Aim: Represents a discrete signal, periodic or not. The signal can be passed by value since it is only cloned when modified.

Description of template class 'Signal'

Template Parameters
TValuethe type chosen for each sample (generally float or double).

This class is a backport from ImaGene.

Definition at line 162 of file Signal.h.

Member Typedef Documentation

template<typename TValue>
typedef TValue DGtal::Signal< TValue >::Value

Definition at line 166 of file Signal.h.

Constructor & Destructor Documentation

template<typename TValue>
DGtal::Signal< TValue >::~Signal ( )

Destructor.

template<typename TValue>
DGtal::Signal< TValue >::Signal ( )

Constructor.

template<typename TValue>
DGtal::Signal< TValue >::Signal ( unsigned int  size,
int  z,
bool  periodic,
const TValue &  def = TValue(0) 
)

Constructor.

Parameters
sizethe size of the signal.
zthe index of the zero-th element.
periodic'true' if the signal is periodic.
defthe default value.
template<typename TValue>
DGtal::Signal< TValue >::Signal ( const TValue *  t,
unsigned int  size,
int  z,
bool  periodic,
const TValue &  def = TValue(0) 
)

Constructor.

Parameters
tthe array containing initial data.
sizethe size of the signal.
zthe index of the zero-th element.
periodic'true' if the signal is periodic.
defthe default value.
template<typename TValue>
DGtal::Signal< TValue >::Signal ( const Signal< TValue > &  other)

Copy constructor.

Parameters
otherthe object to clone.

Member Function Documentation

template<typename TValue>
static Signal<TValue> DGtal::Signal< TValue >::D2n ( unsigned int  n)
static
Returns
the differential operator with binomial weights of order 2n.
template<typename TValue>
static Signal<TValue> DGtal::Signal< TValue >::Delta ( )
static
Returns
the right difference signal.
template<typename TValue>
static Signal<TValue> DGtal::Signal< TValue >::G2 ( )
static
Returns
the gaussian signal of order 2 (binomial signal of order 2 / 4).

TValue must be able to represent real values.

template<typename TValue>
static Signal<TValue> DGtal::Signal< TValue >::G2n ( unsigned int  n)
static
Returns
the gaussian signal of order 2n (binomial signal of order 2n / 2^n).
template<typename TValue>
static Signal<TValue> DGtal::Signal< TValue >::H2 ( )
static
Returns
the binomial signal of order 2.
template<typename TValue>
static Signal<TValue> DGtal::Signal< TValue >::H2n ( unsigned int  n)
static
Returns
the binomial signal of order 2n.
template<typename TValue>
void DGtal::Signal< TValue >::init ( unsigned int  s,
int  z = 0,
bool  p = false,
const TValue &  def = TValue(0) 
)

Initializer.

Parameters
sthe number of data in the signal.
zthe index of the zero-th element.
p'true' if the signal is periodic.
defthe default value.
template<typename TValue>
void DGtal::Signal< TValue >::init ( const TValue *  t,
unsigned int  size,
int  z = 0,
bool  p = false,
const TValue &  def = TValue(0) 
)

Initializer.

Parameters
tthe array containing initial data.
sizethe size of the signal.
zthe index of the zero-th element.
p'true' if the signal is periodic.
defthe default value.
template<typename TValue>
bool DGtal::Signal< TValue >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TValue>
void DGtal::Signal< TValue >::multiply ( const TValue &  val)

External product of a signal by a scalar value.

Parameters
valthe external value.
template<typename TValue>
Signal<TValue> DGtal::Signal< TValue >::operator* ( const Signal< TValue > &  G)

Convolution product of two signals (F = this). F*G( a ) = sum F(a-i)G(i)

Parameters
Gthe second signal (not periodic)
Returns
the signal that is the convolution of F and G, of type F. The returned signal is periodic iff Fis periodic.
template<typename TValue>
Signal<TValue>& DGtal::Signal< TValue >::operator= ( const Signal< TValue > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.
template<typename TValue>
TValue& DGtal::Signal< TValue >::operator[] ( int  i)

Protected rw access to value. If index is out of bound, return 0 if not periodic or the correct value otherwise.

Parameters
ithe index in the signal .
Returns
the i-th value in the signal.
template<typename TValue>
const TValue& DGtal::Signal< TValue >::operator[] ( int  i) const

Protected ro access to value. If index is out of bound, return 0 if not periodic or the correct value otherwise.

Parameters
ithe index in the signal .
Returns
the i-th value in the signal.
template<typename TValue>
void DGtal::Signal< TValue >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TValue>
void DGtal::Signal< TValue >::setAll ( const TValue &  val = TValue(0))

The signal becomes a constant signal of value [val].

Parameters
valthe value of the whole signal.
template<typename TValue>
unsigned int DGtal::Signal< TValue >::size ( ) const
Returns
the number of elements in the signal.

Field Documentation

template<typename TValue>
CowPtr< SignalData<TValue> > DGtal::Signal< TValue >::m_data
private

the array that stores the data.

Definition at line 351 of file Signal.h.


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