libwt  1.0.0
A C++ library for the continous wavelet transform.
waveletsynthesis.hh
1 #ifndef __WT_WAVELETSYNTHESIS_HH__
2 #define __WT_WAVELETSYNTHESIS_HH__
3 
4 #include "waveletanalysis.hh"
5 #include "convolution.hh"
6 #include <vector>
7 
8 
9 namespace wt {
10 
15 {
16 public:
18  WaveletSynthesis(const Wavelet &wavelet, const RVector &scales);
20  WaveletSynthesis(const Wavelet &wavelet, double *scales, int Nscales);
22  WaveletSynthesis(const WaveletAnalysis &other);
24  virtual ~WaveletSynthesis();
25 
27  template <class iDerived, class oDerived>
28  void operator() (const Eigen::DenseBase<iDerived> &transformed, Eigen::DenseBase<oDerived> &out)
29  {
30  CVector last(transformed.rows()), current(transformed.rows());
31  // Clear output vector
32  out.setZero();
33  // If there is no filter bank -> done.
34  if (0 == this->_filterBank.size()) { return; }
35  // Apply first scale
36  this->_filterBank[0]->apply(transformed.col(0), last);
37  // Iterate over all scales and integrate over scales (mid-point method)
38  for (size_t j=1; j<this->_filterBank.size(); j++) {
39  // Perform FFT convolution
40  this->_filterBank[j]->apply(transformed.col(j), current);
41  out.head(transformed.rows()) += ((this->_scales[j]-this->_scales[j-1])/2)*(current+last);
42  // store current into last
43  last.swap(current);
44  }
45  }
46 
47 protected:
49  void init_synthesis();
50 
51 protected:
53  std::vector<Convolution *> _filterBank;
54 };
55 
56 }
57 
58 
59 #endif // __WT_WAVELETSYNTHESIS_HH__
Abstract base class of all wavelet analyses (transform and synthesis).
Definition: waveletanalysis.hh:16
RVector _scales
The scales (in samples) of the transform.
Definition: waveletanalysis.hh:47
const Wavelet & wavelet() const
Returns the wavelet instance of this transform.
Definition: waveletanalysis.hh:41
const RVector & scales() const
Returns the scales of the wavelet transform.
Definition: waveletanalysis.hh:33
void operator()(const Eigen::DenseBase< iDerived > &transformed, Eigen::DenseBase< oDerived > &out)
Performs the wavelet synthesis.
Definition: waveletsynthesis.hh:28
Implements the wavelet synthesis, means the reconstruction of the signal from a wavelet transformed...
Definition: waveletsynthesis.hh:14
Base class of all wavelet object containers.
Definition: wavelet.hh:40
void init_synthesis()
Initializes the filter bank for the synthesis operation.
Definition: waveletsynthesis.cc:25
Definition: convolution.hh:7
WaveletSynthesis(const Wavelet &wavelet, const RVector &scales)
Constructor.
Definition: waveletsynthesis.cc:6
std::vector< Convolution * > _filterBank
The list of convolution filters applied for the wavelet synthesis.
Definition: waveletsynthesis.hh:53
virtual ~WaveletSynthesis()
Destructor.
Definition: waveletsynthesis.cc:44