OpendTect-6_4  6.4
wavelet.h
Go to the documentation of this file.
1 #ifndef wavelet_h
2 #define wavelet_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 24-3-1996
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "seismod.h"
16 #include "mathfunc.h"
17 #include "namedobj.h"
18 #include "ranges.h"
19 #include "valseries.h"
20 #include "uistring.h"
21 class IOObj;
22 template <class T> class ValueSeriesInterpolator;
23 
24 
27 public:
28  Wavelet(const char* nm=0);
29  Wavelet(bool ricker_else_sinc,float fpeak,
30  float sample_intv=mUdf(float),float scale=1);
31  Wavelet(const Wavelet&);
32  Wavelet& operator=(const Wavelet&);
33  virtual ~Wavelet();
34 
35  static Wavelet* get(const IOObj*);
36  static IOObj* getIOObj(const char* wvltnm);
37  bool put(const IOObj*) const;
38 
39  float* samples() { return samps_; }
40  const float* samples() const { return samps_; }
41  inline void set( int idx, float v )
42  { if ( isValidSample(idx) ) samps_[idx] = v; }
43  inline float get( int idx ) const
44  { return isValidSample(idx) ? samps_[idx] : 0.f; }
45  inline bool isValidSample( int idx ) const
46  { return idx>=0 && idx<sz_; }
47 
48  float sampleRate() const { return dpos_; }
49  int centerSample() const { return cidx_; }
51  { return StepInterval<float>(
52  -cidx_*dpos_, (sz_-cidx_-1)*dpos_, dpos_ ); }
53  int nearestSample(float z) const;
54  bool hasSymmetricalSamples() { return cidx_ * 2 + 1 == sz_; }
55 
56  int size() const { return sz_; }
57  float getValue(float) const;
58 
59  void setSampleRate(float sr) { dpos_ = sr; }
60  void setCenterSample(int cidx) { cidx_ = cidx; }
62  void reSize(int); // destroys current sample data!
63 
64  bool reSample(float newsr);
65  bool reSampleTime(float newsr);
66  void ensureSymmetricalSamples();
68  // for better results
69  void transform(float b,float a);
71  void normalize();
72  bool trimPaddedZeros();
73  float getExtrValue(bool ismax = true) const;
74  void getExtrValues(Interval<float>&) const;
75  int getPos(float val,bool closetocenteronly=false) const;
76 
77  const ValueSeriesInterpolator<float>& interpolator() const;
78  void setInterpolator(ValueSeriesInterpolator<float>*);
80 
81  static void markScaled(const MultiID& id);
82  static void markScaled(const MultiID& id,const MultiID& orgid,
83  const MultiID& horid,const MultiID& seisid,
84  const char* lvlnm);
85  static bool isScaled(const MultiID&);
86  static bool isScaled(const MultiID& id,MultiID& orgid,
87  MultiID& horid,MultiID& seisid,
88  BufferString& lvlnm);
90 
91 protected:
92 
93  float dpos_;
94  float* samps_;
95  int sz_;
96  int cidx_;
98 
99 };
100 
101 
110 public:
111 
113  :wv_(const_cast<Wavelet&>(wv)) {}
114 
115  float value( od_int64 idx ) const;
116  bool writable() const { return true; }
117  void setValue( od_int64 idx,float v);
118  float* arr();
119  const float* arr() const;
120 
121  inline ValueSeries<float>* clone() const;
122 
123 protected:
124 
126 };
127 
137 public:
139  : wv_(wv)
140  {}
141 
142  float getValue( float z ) const { return wv_.getValue(z); }
143  float getValue( const float* p ) const { return getValue(*p); }
144 
145 protected:
146 
147  const Wavelet& wv_;
148 };
149 
151 { return new WaveletValueSeries( wv_ ); }
152 
153 
154 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Summary for a Seismic object.
Definition: segydirectdef.h:23
float getValue(const float *p) const
Definition: wavelet.h:143
float * samps_
Definition: wavelet.h:94
Definition: ioobj.h:58
bool hasSymmetricalSamples()
Definition: wavelet.h:54
WaveletValueSeries(const Wavelet &wv)
Definition: wavelet.h:112
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
void setCenterSample(int cidx)
positive for starttwt < 0
Definition: wavelet.h:60
#define od_int64
Definition: plftypes.h:36
ValueSeriesInterpolator< float > * intpol_
Definition: wavelet.h:97
Definition: wavelet.h:25
Mathematical function.
Definition: mathfunc.h:61
bool isValidSample(int idx) const
Definition: wavelet.h:45
WaveletFunction(const Wavelet &wv)
Definition: wavelet.h:138
T value(const ValueSeries< T > &, T pos) const
Definition: valseriesinterpol.h:60
float * samples()
Definition: wavelet.h:39
int sz_
Definition: wavelet.h:95
int centerSample() const
Definition: wavelet.h:49
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
Interface to a series of values.
Definition: odmemory.h:17
Definition: valseriesinterpol.h:25
float sampleRate() const
Definition: wavelet.h:48
float dpos_
Definition: wavelet.h:93
void setSampleRate(float sr)
Definition: wavelet.h:59
int cidx_
The index of the center sample.
Definition: wavelet.h:96
const float * samples() const
Definition: wavelet.h:40
ValueSeries< float > * clone() const
Definition: wavelet.h:150
Wavelet & wv_
Definition: wavelet.h:125
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
int size() const
Definition: wavelet.h:56
Object with a name.
Definition: namedobj.h:35
bool writable() const
Definition: wavelet.h:116
float getValue(float z) const
Definition: wavelet.h:142
StepInterval< float > samplePositions() const
Definition: wavelet.h:50
Definition: wavelet.h:135
void reSample(const FloatMathFunction &input, const A &samplevals, B &output, int nrsamples)
Definition: genericnumer.h:203
Compound key consisting of ints.
Definition: multiid.h:25
Definition: wavelet.h:108
const Wavelet & wv_
Definition: wavelet.h:147

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