OpendTect-6_4  6.4
wavelettrans.h
Go to the documentation of this file.
1 #ifndef wavelettrans_h
2 #define wavelettrans_h
3 
4 /*@+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kristofer Tingdahl
9  Date: 10-12-1999
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 @$*/
14 
15 #include "algomod.h"
16 #include "transform.h"
17 #include "enums.h"
18 #include "arraynd.h"
19 #include "arrayndimpl.h"
20 #include "fourier.h"
21 #include "ranges.h"
22 
33 {
34 public:
35  enum WaveletType { Haar, Daubechies4, Daubechies6,
36  Daubechies8, Daubechies10,
37  Daubechies12, Daubechies14,
38  Daubechies16, Daubechies18,
39  Daubechies20, Beylkin, Coiflet1,
40  Coiflet2, Coiflet3, Coiflet4,
41  Coiflet5, Symmlet4, Symmlet5,
42  Symmlet6, Symmlet7, Symmlet8,
43  Symmlet9, Symmlet10, Vaidyanathan };
44 
46 
47  static void getInfo(WaveletType tp,int& len,TypeSet<float>&);
48 
49  static const float haar[3];
50 
51  static const float daub4[5];
52  static const float daub6[7];
53  static const float daub8[9];
54  static const float daub10[11];
55  static const float daub12[13];
56  static const float daub14[15];
57  static const float daub16[17];
58  static const float daub18[19];
59  static const float daub20[21];
60 
61  static const float beylkin[19];
62 
63  static const float coiflet1[7];
64  static const float coiflet2[13];
65  static const float coiflet3[19];
66  static const float coiflet4[25];
67  static const float coiflet5[31];
68 
69  static const float symmlet4[9];
70  static const float symmlet5[11];
71  static const float symmlet6[13];
72  static const float symmlet7[15];
73  static const float symmlet8[17];
74  static const float symmlet9[19];
75  static const float symmlet10[21];
76 
77  static const float vaidyanathan[25];
78 
79  static bool isCplx( WaveletType );
80 };
81 
82 
88 {
89 public:
91  bool setup();
92 
93 protected:
94 
95  mExpClass(Algo) FilterWT1D : public GenericTransformND::Transform1D
96  {
97  public:
98 
99  bool init();
100  bool run(bool);
102  : cc_( 0 )
103  , cr_( 0 )
104  , wt_( WaveletTransform::Haar )
105  {}
106 
107  ~FilterWT1D() { delete [] cr_; delete [] cc_; }
108 
109  void setWaveletType( WaveletTransform::WaveletType );
110  protected:
111 
112 #include "templ_wavlttransimpl.h"
113 
115 
116  float* cc_; // Filter Parameters
117  float* cr_;
119  int joff_;
120  int ioff_;
121  };
122 
124  { return new FilterWT1D; }
125 
127 };
128 
129 
135 {
136 public:
137  CWT();
138  ~CWT();
139 
140  bool init();
141 
142 
143  enum WaveletType { Morlet, Gaussian, MexicanHat };
145 
146  void setWavelet(CWT::WaveletType);
147 
149  { freqrg_ = rg; }
150  void setDeltaT( float dt ) { dt_ = dt; }
151 
152  bool setInputInfo(const ArrayNDInfo&);
153  const ArrayNDInfo& getInputInfo() const { return *info_; }
154 
155  bool real2real() const { return true; }
156  bool real2complex() const { return false; }
157  bool complex2real() const { return false; }
158  bool complex2complex() const { return true; }
159 
160  bool biDirectional() const { return false; }
161  bool setDir(bool forw);
162  bool getDir() const { return true; }
163 
164 
166  ArrayND<float>& ) const
167  { return false; }
169  ArrayND<float_complex>& ) const
170  { return false; }
171  bool transform(const ArrayND<float_complex>& input,
172  ArrayND<float>& output);
173 
174  float getScale(int ns,float dt,float freq) const;
175 
176  void setFreqIdxs( const TypeSet<int>& outfreqidxs )
177  { outfreqidxs_ = outfreqidxs; }
178 
179 protected:
180 
181  struct CWTWavelets
182  {
184 
185  void createWavelet(WaveletType,int nrsamples,
186  float scale);
187  const TypeSet<float>* getWavelet(float scale) const;
188  void createMorletWavelet(int,float,TypeSet<float>&);
189  void createMexhatWavelet(int,float,TypeSet<float>&);
190  void createGaussWavelet(int,float,TypeSet<float>&);
191 
192 
195  };
196 
197 
199 
200  bool isPossible(int sz) const;
201  bool isFast( int ) const { return true; }
202 
203  void transform(int,float,int,
206 
209 
211 
212  bool inited_;
213  float dt_;
215 
218 };
219 
220 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Does Fourier Transforms of any size.
Definition: fourier.h:30
Definition: wavelettrans.h:37
int filtersz_
Definition: wavelettrans.h:118
Definition: wavelettrans.h:95
FilterWT1D()
Definition: wavelettrans.h:101
WaveletTransform is a ND wavelet transform.
Definition: wavelettrans.h:32
Definition: wavelettrans.h:41
bool complex2real() const
Definition: wavelettrans.h:157
void setFreqIdxs(const TypeSet< int > &outfreqidxs)
Definition: wavelettrans.h:176
void transform(float b, float a)
a*X+b transformation
TypeSet< int > outfreqidxs_
Definition: wavelettrans.h:217
Fourier::CC * fft_
Definition: wavelettrans.h:207
void setDeltaT(float dt)
Definition: wavelettrans.h:150
Definition: wavelettrans.h:39
bool init()
bool real2real() const
Definition: wavelettrans.h:155
Definition: wavelettrans.h:42
Contains the information about the size of ArrayND, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:23
bool transform(const ArrayND< float > &, ArrayND< float > &) const
Definition: wavelettrans.h:165
Discrete Wavelet Transform.
Definition: wavelettrans.h:87
WaveletType wt_
Definition: wavelettrans.h:214
Continuous Wavelet Transform.
Definition: wavelettrans.h:134
Lets any 1D orthogonal transform (GenericTransformND::GenericTransform1D) be extended to ND...
Definition: transform.h:31
const ArrayNDInfo & getInputInfo() const
Definition: wavelettrans.h:153
Definition: wavelettrans.h:38
float * cc_
Definition: wavelettrans.h:116
bool isFast(int) const
Definition: wavelettrans.h:201
int ioff_
Definition: wavelettrans.h:120
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:258
WaveletType
Definition: wavelettrans.h:143
float * cr_
Definition: wavelettrans.h:117
CWTWavelets wvlts_
Definition: wavelettrans.h:198
WaveletTransform::WaveletType wt_
Definition: wavelettrans.h:126
bool transform(const ArrayND< float_complex > &, ArrayND< float_complex > &) const
Definition: wavelettrans.h:168
Definition: wavelettrans.h:40
TypeSet< TypeSet< float > > wavelets_
Definition: wavelettrans.h:194
void setTransformRange(const StepInterval< float > &rg)
Definition: wavelettrans.h:148
WaveletType
Definition: wavelettrans.h:35
bool complex2complex() const
Definition: wavelettrans.h:158
StepInterval< float > freqrg_
Definition: wavelettrans.h:216
Definition: transform.h:86
Fourier::CC * ifft_
Definition: wavelettrans.h:208
int joff_
Definition: wavelettrans.h:119
bool real2complex() const
Definition: wavelettrans.h:156
bool biDirectional() const
Definition: wavelettrans.h:160
Definition: wavelettrans.h:36
ArrayNDInfo * info_
Definition: wavelettrans.h:210
Transform1D * createTransform() const
Definition: wavelettrans.h:123
TypeSet< float > scales_
Definition: wavelettrans.h:193
float dt_
Definition: wavelettrans.h:213
bool inited_
Definition: wavelettrans.h:212
WaveletTransform::WaveletType wt_
Definition: wavelettrans.h:114
bool getDir() const
Definition: wavelettrans.h:162
~FilterWT1D()
Definition: wavelettrans.h:107
CWTWavelets()
Definition: wavelettrans.h:183
Definition: wavelettrans.h:181

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019