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

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

#include <DGtal/math/Signal.h>

Inheritance 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 161 of file Signal.h.

Member Typedef Documentation

◆ Value

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

Definition at line 165 of file Signal.h.

Constructor & Destructor Documentation

◆ ~Signal()

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

Destructor.

◆ Signal() [1/4]

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

Constructor.

◆ Signal() [2/4]

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.

◆ Signal() [3/4]

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.

◆ Signal() [4/4]

template<typename TValue >
DGtal::Signal< TValue >::Signal ( const Signal< TValue > &  other)

Copy constructor.

Parameters
otherthe object to clone.

Member Function Documentation

◆ D2n()

template<typename TValue >
static Signal<TValue> DGtal::Signal< TValue >::D2n ( unsigned int  n)
static
Returns
the differential operator with binomial weights of order 2n.

◆ Delta()

template<typename TValue >
static Signal<TValue> DGtal::Signal< TValue >::Delta ( )
static
Returns
the right difference signal.

◆ G2()

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.

◆ G2n()

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).

◆ H2()

template<typename TValue >
static Signal<TValue> DGtal::Signal< TValue >::H2 ( )
static
Returns
the binomial signal of order 2.

◆ H2n()

template<typename TValue >
static Signal<TValue> DGtal::Signal< TValue >::H2n ( unsigned int  n)
static
Returns
the binomial signal of order 2n.

◆ init() [1/2]

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.

◆ init() [2/2]

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.

◆ isValid()

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.

◆ multiply()

template<typename TValue >
void DGtal::Signal< TValue >::multiply ( const TValue &  val)

External product of a signal by a scalar value.

Parameters
valthe external value.

◆ operator*()

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.

◆ operator=()

template<typename TValue >
Signal<TValue>& DGtal::Signal< TValue >::operator= ( const Signal< TValue > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ operator[]() [1/2]

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.

◆ operator[]() [2/2]

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.

◆ selfDisplay()

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.

◆ setAll()

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.

◆ size()

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

Field Documentation

◆ m_data

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

the array that stores the data.

Definition at line 350 of file Signal.h.


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