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

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