 |
OpendTect
6.6
|
Go to the documentation of this file.
36 bool setWindow(
const char* nm,
float param,
38 int getWindowSize(
int dim)
const;
39 const char* getWindowName()
const;
40 float getWindowParam()
const;
46 inline bool execute();
47 inline void enableWorkControl(
bool);
51 static const char*
sKeyWinFunc() {
return "Window function"; }
67 template <
class T>
inline
69 : windowparam_(
mUdf(float) )
77 template <
class T>
inline
82 template <
class T>
inline
84 {
return window_->info().getSize( dim ); }
87 template <
class T>
inline
89 {
return windowname_.buf(); }
92 template <
class T>
inline
94 {
return windowparam_; }
97 template <
class T>
inline
102 if ( !input || hasudf_!=hasudf || input->
info()!=ni.
info() )
103 {
delete window_; window_ = 0; }
105 convolver_.setX( ni, hasudf );
110 template <
class T>
inline
113 convolver_.setZ( no );
117 template <
class T>
inline
122 windowparam_ = param;
126 delete window_; window_ = 0;
132 template <
class T>
inline
135 par.
set( sKeyWinFunc(), windowname_ );
136 if ( !
mIsUdf(windowparam_) )
137 par.
set( sKeyWinParam(), windowparam_ );
139 par.
set(sKeyWinSize(),window_->info().getSize(0),window_->info().getSize(1));
143 template <
class T>
inline
147 if ( !par.
get(sKeyWinSize(), sz0, sz1 ) )
150 const char* wn = par.
find( sKeyWinFunc() );
151 float var =
mUdf(
float);
152 par.
get( sKeyWinParam(), var );
154 return setWindow( wn, var, sz0, sz1 );
158 #define mImplSetFunc( func, vartype ) \
159 template <class T> inline void Smoother2D<T>::func( vartype var ) \
160 { convolver_.func( var ); }
166 template <
class T>
inline
183 if ( windowsz0_<=0 || windowsz1_<=0 )
187 if (
typeid(T)==
typeid(
float) && input->
getData() && !hasudf_ )
192 if ( !window_->isOK() )
195 const float hwinsz0 = ((float)windowsz0_)/2;
196 const float hwinsz1 = ((float)windowsz1_)/2;
199 const int sz0 = window_->info().getSize( 0 );
200 const int sz1 = window_->info().getSize( 1 );
201 const int hsz0 = sz0/2;
202 const int hsz1 = sz1/2;
204 double weightsum = 0;
206 for (
int idx0=0; idx0<sz0; idx0++ )
208 const float pos0 =
mCast(
float, idx0>hsz0 ? idx0-sz0 : idx0 );
209 pos[0] = pos0/hwinsz0;
210 for (
int idx1=0; idx1<sz1; idx1++ )
212 const float pos1 =
mCast(
float, idx1>hsz1 ? idx1-sz1 : idx1 );
213 pos[1] = pos1/hwinsz1;
214 const float weight = wf->
getValue( (
float) pos.
abs() );
215 window_->set( idx0, idx1, weight );
222 window_->info().getTotalSz(), ++ );
224 convolver_.setY( *window_,
false );
227 return convolver_.execute();
231 template <
class T>
inline
233 {
return convolver_.getState(); }
~Smoother2D()
Definition: smoother2d.h:78
void set(const char *ky, const char *val)
void setOutput(Array2D< T > &)
Definition: smoother2d.h:111
static const char * sKeyWinParam()
Definition: smoother2d.h:52
bool get(const char *, short &) const
Smoothes a 2d signal with an operator.
Definition: smoother2d.h:27
BufferString windowname_
Definition: smoother2d.h:62
Array2DImpl< T > * window_
Definition: smoother2d.h:60
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:289
is an interface where processes can report their progress.
Definition: progressmeter.h:21
float getWindowParam() const
Definition: smoother2d.h:93
virtual bool hasVariable() const
Definition: windowfunction.h:30
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
Control
Definition: task.h:55
double abs() const
Definition: geometry.h:376
const char * getWindowName() const
Definition: smoother2d.h:88
A cartesian coordinate in 2D space.
Definition: coord.h:25
Convolves (or correlates) two 2D signals.
Definition: convolve2d.h:34
int getWindowSize(int dim) const
Definition: smoother2d.h:83
Generalization of something (e.g. a computation) that needs to be done in multiple steps.
Definition: task.h:28
#define mClass(module)
Definition: commondefs.h:181
void setInput(const Array2D< T > &, bool hasudf)
Definition: smoother2d.h:98
int windowsz1_
Definition: smoother2d.h:61
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:174
virtual const Array2DInfo & info() const =0
bool usePar(const IOPar &)
Definition: smoother2d.h:144
static const char * sKeyWinSize()
Definition: smoother2d.h:53
virtual bool setVariable(float)
Definition: windowfunction.h:32
#define mCast(tp, v)
Definition: commondefs.h:137
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
#define mImplSetFunc(func, vartype)
Definition: smoother2d.h:158
static const char * sKeyWinFunc()
Definition: smoother2d.h:51
#define mDoArrayPtrOperation(type, arr, operation, arrsz, ptrinc)
Definition: commondefs.h:285
Task::Control getState() const
Definition: smoother2d.h:232
Implementation of Array2D.
Definition: arrayndimpl.h:102
Convolver2D< T > convolver_
Definition: smoother2d.h:57
const char * find(const char *) const
returns null if not found
void fillPar(IOPar &) const
Definition: smoother2d.h:133
virtual RT getValue(PT) const =0
bool execute()
Definition: smoother2d.h:167
bool setWindow(const char *nm, float param, int sz0, int sz1)
Definition: smoother2d.h:118
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
Smoother2D()
Definition: smoother2d.h:68
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:140
const T * getData() const
Definition: arraynd.h:54
float windowparam_
Definition: smoother2d.h:63
bool hasudf_
Definition: smoother2d.h:58
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021