OpendTect  6.3
fftfilter.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: Bruno
8 Date: 6-10-2009
9 ________________________________________________________________________
10 
11 */
12 
13 
14 #include "algomod.h"
15 #include "arrayndalgo.h"
16 #include "enums.h"
17 #include "odcomplex.h"
18 
19 namespace Fourier { class CC; }
20 
21 template <class T> class Array1DImpl;
22 
23 
31 {
32 
33 public:
34  FFTFilter(int sz, float step);
35  ~FFTFilter();
36 
37  enum Type { LowPass, HighPass, BandPass };
39 
40  void setLowPass(float cutf3,float cutf4);
41  void setHighPass(float cutf1,float cutf2);
42  void setBandPass(float cutf1,float cutf2,
43  float cutf3,float cutf4);
44  // The following will auto taper 5% of the filter size
45  void setLowPass(float cutf4);
46  void setHighPass(float cutf1);
47  void setBandPass(float cutf1,float cutf4);
48 
49  //will taper the array before apply
50  //do not use for strictly positive/negative signal
51  bool setTimeTaperWindow(int sz, BufferString wintype,
52  float var=0.95);
53 
54  bool apply(Array1DImpl<float>&);
55  bool apply(Array1DImpl<float_complex>&,bool dopreproc=true);
56 
57  Array1DImpl<float_complex>* getFreqDomainArr() const;
58  void requestStayInFreqDomain() { stayinfreq_ = true; }
59 
60  Type getFilterType() const;
61  bool isLowPass() const;
62  bool isHighPass() const;
63 
64 
65 protected:
66 
67  int fftsz_;
68  int sz_;
69  float df_;
70  float step_;
71  float cutfreq_[4];
73 
82 
83  void buildFreqTaperWin();
84 
85  // will store the position of undef points
86  bool interpUdf(Array1DImpl<float>&,bool isimag=false);
88  void restoreUdf(Array1DImpl<float>&,bool isimag=false) const;
89  void restoreUdf(Array1DImpl<float_complex>&) const;
90  // will store the removed trend
91  bool deTrend(Array1DImpl<float>& outp,bool isimag=false);
92  bool deTrend(Array1DImpl<float_complex>&);
93  bool restoreTrend(Array1DImpl<float>& outp,
94  bool isimag=false) const;
95  bool restoreTrend(Array1DImpl<float_complex>&) const;
96  void reSize(const Array1DImpl<float_complex>& inp,
97  Array1DImpl<float_complex>& outp) const;
98  void reSize(const Array1DImpl<float>& inp,
99  Array1DImpl<float>& outp) const;
100  void restoreSize(const Array1DImpl<float_complex>& inp,
101  Array1DImpl<float_complex>& outp) const;
102  void restoreSize(const Array1DImpl<float>& inp,
103  Array1DImpl<float>& outp) const;
104 };
#define mExpClass(module)
Definition: commondefs.h:157
Does Fourier Transforms of any size.
Definition: fourier.h:28
Fourier::CC * fft_
Definition: fftfilter.h:74
Array1DImpl< float_complex > * freqdomain_
Definition: fftfilter.h:81
Tapers the N-dimentional ArrayND with a windowFunction.
Definition: arrayndalgo.h:870
int fftsz_
Definition: fftfilter.h:67
ArrayNDWindow * freqwindow_
Definition: fftfilter.h:76
BoolTypeSet isudfreal_
Definition: fftfilter.h:79
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:188
float step_
Definition: fftfilter.h:70
Array1DImpl< float > * trendimag_
Definition: fftfilter.h:78
float df_
Definition: fftfilter.h:69
BoolTypeSet isudfimag_
Definition: fftfilter.h:80
ArrayNDWindow * timewindow_
Definition: fftfilter.h:75
std::complex< float > float_complex
Definition: odcomplex.h:16
Definition: convolve2d.h:25
bool stayinfreq_
Definition: fftfilter.h:72
bool interpUdf(Array1D< fT > &in, typename BendPointBasedMathFunction< fT, fT >::InterpolType ipoltyp=BendPointBasedMathFunction< fT, fT >::Poly)
Definition: arrayndalgo.h:833
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
Classical FFT filter, use set to set up data step, min and max frequency and type of the filter (minf...
Definition: fftfilter.h:30
Array1DImpl< float > * trendreal_
Definition: fftfilter.h:77
Implementation of Array1D.
Definition: arrayndimpl.h:51
int sz_
Definition: fftfilter.h:68
Type
Definition: fftfilter.h:37

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