35 bool setWindow(
const char* nm,
float param,
37 int getWindowSize(
int dim)
const;
38 const char* getWindowName()
const;
39 float getWindowParam()
const;
45 inline bool execute();
46 inline void enableWorkControl(
bool);
50 static const char*
sKeyWinFunc() {
return "Window function"; }
66 template <
class T>
inline 68 : windowparam_(
mUdf(float) )
76 template <
class T>
inline 81 template <
class T>
inline 83 {
return window_->info().getSize( dim ); }
86 template <
class T>
inline 91 template <
class T>
inline 96 template <
class T>
inline 109 template <
class T>
inline 116 template <
class T>
inline 131 template <
class T>
inline 143 template <
class T>
inline 151 float var =
mUdf(
float);
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 195 const float hwinsz0 = ((float)windowsz0_)/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( pos.
abs<
float>() );
215 window_->set( idx0, idx1, weight );
223 window_->info().getTotalSz(), ++ );
232 template <
class T>
inline Array2DImpl< T > * window_
Definition: smoother2d.h:59
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:285
static const char * sKeyWinFunc()
Definition: smoother2d.h:50
Convolver2D< T > convolver_
Definition: smoother2d.h:56
float windowparam_
Definition: smoother2d.h:62
is an interface where processes can report their progress.
Definition: progressmeter.h:19
FT abs() const
Definition: geometry.h:619
#define mCast(tp, v)
Definition: commondefs.h:120
const char * getWindowName() const
Definition: smoother2d.h:87
Smoothes a 2d signal with an operator.
Definition: smoother2d.h:25
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
Implementation of Array2D.
Definition: arrayndimpl.h:101
BufferString windowname_
Definition: smoother2d.h:61
virtual bool hasVariable() const
Definition: windowfunction.h:29
bool get(const char *, int &) const
Task::Control getState() const
Definition: smoother2d.h:233
#define mImplSetFunc(func, vartype)
Definition: smoother2d.h:158
int getWindowSize(int dim) const
Definition: smoother2d.h:82
void setOutput(Array2D< T > &)
Definition: smoother2d.h:110
void setInput(const Array2D< T > &, bool hasudf)
Definition: smoother2d.h:97
const T * getData() const
Definition: arraynd.h:51
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:127
void setProgressMeter(ProgressMeter *pm)
Must be called before execute()
Definition: smoother2d.h:162
float getWindowParam() const
Definition: smoother2d.h:92
Control
Definition: task.h:45
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:270
const char * find(const char *) const
returns null if not found
Convolves (or correlates) two 2D signals.
Definition: convolve2d.h:32
virtual bool setVariable(float)
Definition: windowfunction.h:31
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
void fillPar(IOPar &) const
Definition: smoother2d.h:132
static const char * sKeyWinSize()
Definition: smoother2d.h:52
const char * buf() const
Definition: odstring.h:45
bool setWindow(const char *nm, float param, int sz0, int sz1)
Definition: smoother2d.h:117
int windowsz1_
Definition: smoother2d.h:60
#define mDoArrayPtrOperation(type, arr, operation, arrsz, ptrinc)
Definition: commondefs.h:283
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
bool hasudf_
Definition: smoother2d.h:57
bool execute()
Definition: smoother2d.h:167
~Smoother2D()
Definition: smoother2d.h:77
int windowsz0_
Definition: smoother2d.h:60
void controlWork(Task::Control)
Definition: smoother2d.h:164
static const char * sKeyWinParam()
Definition: smoother2d.h:51
Smoother2D()
Definition: smoother2d.h:67
#define mClass(module)
Definition: commondefs.h:161
virtual const Array2DInfo & info() const =0
2D point or vector class.
Definition: commontypes.h:58
void set(const char *ky, const char *val)
virtual RT getValue(PT) const =0
void enableWorkControl(bool)
Must be called before execute()
Definition: smoother2d.h:163
Generalization of something (e.g. a computation) that needs to be done in multiple steps...
Definition: task.h:26
bool usePar(const IOPar &)
Definition: smoother2d.h:144