 |
OpendTect
6.6
|
Go to the documentation of this file.
27 template <
class A,
class B,
class C>
29 int ly,
int ify,
const B& y,
30 int lz,
int ifz, C& z)
32 int ilx=ifx+lx-1,ily=ify+ly-1,ilz=ifz+lz-1,i,j,jlow,jhigh;
35 for ( i=ifz; i<=ilz; ++i )
38 if ( jlow < ifx ) jlow = ifx;
41 if ( jhigh > ilx ) jhigh = ilx;
43 for ( j=jlow,sum=0.0; j<=jhigh; ++j )
46 sum += x[j-ifx]*y[i-j-ify];
54 template <
class A,
class B,
class C>
56 int ly,
int ify,
const B& y,
57 int lz,
int ifz, C& z)
59 int ilx=ifx+lx-1,ily=ify+ly-1,ilz=ifz+lz-1,i,j,jlow,jhigh;
62 for ( i=ifz; i<=ilz; ++i )
65 if ( jlow < ifx ) jlow = ifx;
68 if ( jhigh > ilx ) jhigh = ilx;
70 for ( j=jlow,sum=0.0; j<=jhigh; ++j )
71 sum += x[j-ifx]*y[i-j-ify];
82 template <
class A,
class B>
83 inline float similarity(
const A& a,
const B& b,
int sz,
bool normalize=
false,
84 int firstposa=0,
int firstposb=0 )
87 double sqdist = 0, sq1 = 0, sq2 = 0;
89 double meana =
mUdf(
double), stddeva =
mUdf(
double);
90 double meanb =
mUdf(
double), stddevb =
mUdf(
double);
94 if ( sz==1 ) normalize =
false;
98 for (
int idx=0; idx<sz; idx++ )
100 asum += a[firstposa+idx];
101 bsum += b[firstposb+idx];
109 for (
int idx=0; idx<sz; idx++ )
111 const double adiff = a[firstposa+idx]-meana;
112 const double bdiff = b[firstposb+idx]-meanb;
125 int curposa = firstposa;
126 int curposb = firstposb;
128 for (
int idx=0; idx<sz; idx++ )
130 val1 = normalize ? (float) ( (a[curposa]-meana)/stddeva ) : a[curposa];
131 val2 = normalize ? (float) ( (b[curposb]-meanb)/stddevb ) : b[curposb];
157 float x1,
float x2,
float dist,
int sz,
bool normalize );
176 float& res,
float targetval = 0,
float tol=1e-5);
198 float x2,
float tol = 1e-5);
201 template <
class A,
class B>
inline
203 B& output,
int nrsamples )
205 for (
int idx=0; idx<nrsamples; idx++ )
207 const float sampleval = samplevals[idx];
228 template <
class A,
class B,
class C>
230 int ly,
int ify,
const B& y,
231 int lz,
int ifz, C& z)
235 for (
int i=0,j=lx-1; i<lx; ++i,--j)
245 for (
int idx=0; idx<sz; idx++ )
246 out[idx] = in[sz-1-idx];
250 for (
int idx=0; idx<sz/2; idx++ )
252 tmparr[idx] = in[idx];
253 int opsamp = sz-1-idx;
254 in[idx] = in[opsamp];
255 in[opsamp] = tmparr[idx];
void genericCrossCorrelation(int lx, int ifx, const A &x, int ly, int ify, const B &y, int lz, int ifz, C &z)
Definition: genericnumer.h:229
double LanczosKernel(int size, double x)
void GenericConvolve(int lx, int ifx, const A &x, int ly, int ify, const B &y, int lz, int ifz, C &z)
Definition: genericnumer.h:28
const T val1
Definition: arrayndalgo.h:1706
#define mGlobal(module)
Definition: commondefs.h:180
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:289
void reSample(const FloatMathFunction &input, const A &samplevals, B &output, int nrsamples)
Definition: genericnumer.h:202
#define mDefEps
Definition: commondefs.h:71
float findExtreme(const FloatMathFunction &, bool minima, float x1, float x2, float tol=1e-5)
bool isUdf(const T &t)
Definition: undefval.h:245
#define mIsZero(x, eps)
Definition: commondefs.h:66
float findValueInAperture(const FloatMathFunction &, float startx, const Interval< float > &aperture, float dx, float target=0, float tol=1e-5)
float semblance(const ObjectSet< float > &signals, const Interval< int > &)
float similarity(const A &a, const B &b, int sz, bool normalize=false, int firstposa=0, int firstposb=0)
Definition: genericnumer.h:83
#define mAllocLargeVarLenArr(type, varnm, __size)
Definition: varlenarray.h:30
bool findValue(const FloatMathFunction &, float x1, float x2, float &res, float targetval=0, float tol=1e-5)
virtual RT getValue(PT) const =0
#define mAllocVarLenArr(type, varnm, __size)
Definition: varlenarray.h:53
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
void GenericConvolveNoUdf(int lx, int ifx, const A &x, int ly, int ify, const B &y, int lz, int ifz, C &z)
Definition: genericnumer.h:55
const T val2
Definition: arrayndalgo.h:1706
void reverseArray(A *in, int sz, A *out=0)
Definition: genericnumer.h:242
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021