37 bool setWindow(
const char* nm,
float param,
39 int getWindowSize(
int dim)
const;
40 const char* getWindowName()
const;
41 float getWindowParam()
const;
47 inline bool execute();
48 inline void enableWorkControl(
bool);
52 static const char*
sKeyWinFunc() {
return "Window function"; }
68 template <
class T>
inline 70 : windowparam_(
mUdf(float) )
78 template <
class T>
inline 83 template <
class T>
inline 85 {
return window_->info().getSize( dim ); }
88 template <
class T>
inline 93 template <
class T>
inline 98 template <
class T>
inline 111 template <
class T>
inline 118 template <
class T>
inline 133 template <
class T>
inline 144 template <
class T>
inline 152 float var =
mUdf(
float);
159 #define mImplSetFunc( func, vartype ) \ 160 template <class T> inline void Smoother2D<T>::func( vartype var ) \ 161 { convolver_.func( var ); } 167 template <
class T>
inline 196 const float hwinsz0 = ((float)windowsz0_)/2;
200 const int sz0 =
window_->info().getSize( 0 );
201 const int sz1 =
window_->info().getSize( 1 );
202 const int hsz0 = sz0/2;
203 const int hsz1 = sz1/2;
205 double weightsum = 0;
207 for (
int idx0=0; idx0<sz0; idx0++ )
209 const float pos0 =
mCast(
float, idx0>hsz0 ? idx0-sz0 : idx0 );
210 pos[0] = pos0/hwinsz0;
211 for (
int idx1=0; idx1<sz1; idx1++ )
213 const float pos1 =
mCast(
float, idx1>hsz1 ? idx1-sz1 : idx1 );
214 pos[1] = pos1/hwinsz1;
215 const float weight = wf->
getValue( (
float) pos.
abs() );
216 window_->set( idx0, idx1, weight );
223 window_->info().getTotalSz(), ++ );
232 template <
class T>
inline Array2DImpl< T > * window_
Definition: smoother2d.h:61
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
static const char * sKeyWinFunc()
Definition: smoother2d.h:52
Convolver2D< T > convolver_
Definition: smoother2d.h:58
float windowparam_
Definition: smoother2d.h:64
is an interface where processes can report their progress.
Definition: progressmeter.h:21
#define mCast(tp, v)
Definition: commondefs.h:124
const char * getWindowName() const
Definition: smoother2d.h:89
Smoothes a 2d signal with an operator.
Definition: smoother2d.h:27
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
Implementation of Array2D.
Definition: arrayndimpl.h:102
BufferString windowname_
Definition: smoother2d.h:63
virtual bool hasVariable() const
Definition: windowfunction.h:31
A cartesian coordinate in 2D space.
Definition: coord.h:25
bool get(const char *, int &) const
Task::Control getState() const
Definition: smoother2d.h:233
#define mImplSetFunc(func, vartype)
Definition: smoother2d.h:159
int getWindowSize(int dim) const
Definition: smoother2d.h:84
void setOutput(Array2D< T > &)
Definition: smoother2d.h:112
void setInput(const Array2D< T > &, bool hasudf)
Definition: smoother2d.h:99
const T * getData() const
Definition: arraynd.h:55
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:131
void setProgressMeter(ProgressMeter *pm)
Must be called before execute()
Definition: smoother2d.h:163
float getWindowParam() const
Definition: smoother2d.h:94
Control
Definition: task.h:55
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
const char * find(const char *) const
returns null if not found
Convolves (or correlates) two 2D signals.
Definition: convolve2d.h:34
double abs() const
Definition: geometry.h:364
virtual bool setVariable(float)
Definition: windowfunction.h:33
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
void fillPar(IOPar &) const
Definition: smoother2d.h:134
static const char * sKeyWinSize()
Definition: smoother2d.h:54
const char * buf() const
Definition: odstring.h:47
bool setWindow(const char *nm, float param, int sz0, int sz1)
Definition: smoother2d.h:119
int windowsz1_
Definition: smoother2d.h:62
#define mDoArrayPtrOperation(type, arr, operation, arrsz, ptrinc)
Definition: commondefs.h:280
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
bool hasudf_
Definition: smoother2d.h:59
bool execute()
Definition: smoother2d.h:168
~Smoother2D()
Definition: smoother2d.h:79
int windowsz0_
Definition: smoother2d.h:62
void controlWork(Task::Control)
Definition: smoother2d.h:165
static const char * sKeyWinParam()
Definition: smoother2d.h:53
Smoother2D()
Definition: smoother2d.h:69
#define mClass(module)
Definition: commondefs.h:164
virtual const Array2DInfo & info() const =0
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:164
Generalization of something (e.g. a computation) that needs to be done in multiple steps...
Definition: task.h:28
bool usePar(const IOPar &)
Definition: smoother2d.h:145