CWO++library  0.32
 All Classes Functions Variables Groups
Public Member Functions | Public Attributes | Friends
GWO Class Reference
Inheritance diagram for GWO:
CWO

List of all members.

Public Member Functions

 GWO (GWO &tmp)
 GWO (int Nx, int Ny)
 constructor
GWOoperator= (GWO &tmp)
GWOoperator= (float a)
GWOoperator= (const cwoComplex &a)
template<class T = GWO>
operator+ (T &a)
template<class T = GWO>
operator+ (float a)
template<class T = GWO>
operator+ (const cwoComplex &a)
template<class T = GWO>
operator- (T &a)
template<class T = GWO>
operator- (float a)
template<class T = GWO>
operator- (const cwoComplex &a)
template<class T = GWO>
operator* (T &a)
template<class T = GWO>
operator* (float a)
template<class T = GWO>
operator* (const cwoComplex &a)
template<class T = GWO>
operator/ (T &a)
template<class T = GWO>
operator/ (float a)
template<class T = GWO>
operator/ (const cwoComplex &a)
void SetDev (int dev)
void SetThreads (int Nx, int Ny)
 set the number of threads
int GetThreadsX ()
int GetThreadsY ()
void Delete ()
void Send (CWO &a)
 Send data to GPU.
void Recv (CWO &a)
 Receive data from GPU.
void CreateStream ()
cwoStream GetStream ()
void DestroyStream ()
void SyncStream ()
void SetStreamMode (int mode)
int GetStreamMode ()
int Load (const std::string &fname, int c=CWO_GREY)
 Load image file or cwo file.
int Load (const std::string &fname_amp, const std::string &fname_pha, int c=CWO_GREY)
 Load image file or cwo file.
int Save (const std::string &fname, int bmp_8_24=24)
 Save image file or cwo file.
int Save (const std::string &fname, CWO *r, CWO *g=nullptr, CWO *b=nullptr)
int SaveAsImage (const std::string &fname, float i1, float i2, float o1, float o2, int flag=CWO_SAVE_AS_RE)
int SaveAsImage (const std::string &fname, int flag=CWO_SAVE_AS_RE, CWO *r=nullptr, CWO *g=nullptr, CWO *b=nullptr)
int SaveAsImage (cwoComplex *p, int Nx, int Ny, const std::string &fname, int flag=CWO_SAVE_AS_RE, int bmp_8_24=24)
void * __Malloc (size_t size)
 Free buffers.
void __Free (void **a)
void __Memcpy (void *dst, void *src, size_t size)
void __Memset (void *p, int c, size_t size)
void Fill (cwoComplex pix)
void __Expand (void *src, int sx, int sy, int srcNx, int srcNy, void *dst, int dx, int dy, int dstNx, int dstNy, int type)
void __ShiftedFresnelAperture (cwoComplex *a)
void __ShiftedFresnelProp (cwoComplex *a)
void __ShiftedFresnelCoeff (cwoComplex *a)
void __ARSSFresnelAperture (cwoComplex *a)
void __ARSSFresnelProp (cwoComplex *a)
void __ARSSFresnelCoeff (cwoComplex *a)
void __FresnelConvProp (cwoComplex *a)
void __FresnelConvCoeff (cwoComplex *a, float const_val=1.0f)
void __AngularProp (cwoComplex *a, int flag)
void __HuygensProp (cwoComplex *a)
void __FresnelFourierProp (cwoComplex *a)
void __FresnelFourierCoeff (cwoComplex *a)
void __FresnelDblAperture (cwoComplex *a, float z1)
void __FresnelDblFourierDomain (cwoComplex *a, float z1, float z2, cwoInt4 *zp)
void __FresnelDblCoeff (cwoComplex *a, float z1, float z2)
void __FFT (void *src, void *dst, int type)
void __IFFT (void *src, void *dst)
void __FFTShift (void *src)
void __NUFFT_T1 (cwoComplex *p_fld, cwoFloat2 *p_x, int R=2, int Msp=12)
void __NUFFT_T2 (cwoComplex *p_fld, cwoFloat2 *p_x, int R=2, int Msp=12)
void __Add (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
void __Add (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Sub (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
void __Sub (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Mul (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
void __Mul (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Div (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
void __Div (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Rep (cwoComplex *a, float b, cwoComplex *c)
void __Rep (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
void __Rep (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __AddSphericalWave (cwoComplex *p, float x, float y, float z, float px, float py, float a)
void __MulSphericalWave (cwoComplex *p, float x, float y, float z, float px, float py, float a)
void __AddApproxSphWave (cwoComplex *p, float x, float y, float z, float zx, float zy, float px, float py, float a)
 Add Fresnel-approximated spherical wave to the field.
void __MulApproxSphWave (cwoComplex *p, float x, float y, float z, float zx, float zy, float px, float py, float a)
 Multiply Fresnel-approximated spherical wave to the field.
void __Re (cwoComplex *a, cwoComplex *b)
void __Im (cwoComplex *a, cwoComplex *b)
void __Intensity (cwoComplex *a, cwoComplex *b)
void __Amp (cwoComplex *a, cwoComplex *b)
void __Phase (cwoComplex *a, cwoComplex *b, float offset)
void __Arg (cwoComplex *a, cwoComplex *b, float scale, float offset)
void __Real2Complex (float *src, cwoComplex *dst)
void __Phase2Complex (float *src, cwoComplex *dst)
void __Arg2Cplx (cwoComplex *src, cwoComplex *dst, float scale, float offset)
void __Polar (float *amp, float *ph, cwoComplex *c)
void __ReIm (cwoComplex *re, cwoComplex *im, cwoComplex *c)
void __RectFillInside (cwoComplex *p, int x, int y, int Sx, int Sy, cwoComplex a)
void __RectFillOutside (cwoComplex *p, int x, int y, int Sx, int Sy, cwoComplex a)
void __CircFillInside (cwoComplex *p, int m, int n, int r, const cwoComplex a)
void __CircFillOutside (cwoComplex *p, int m, int n, int r, const cwoComplex a)
void __FloatToChar (char *dst, float *src, int N)
void __CharToFloat (float *dst, char *src, int N)
void __Copy (cwoComplex *src, int x1, int y1, int sNx, int sNy, cwoComplex *dst, int x2, int y2, int dNx, int dNy, int Sx, int Sy)
void FFTShift ()
 FFT Shift.
void SqrtReal ()
 Take the square root of only the real part of the complex amplitude field.
void SqrtCplx ()
 Take the square root of the amplitude of the complex amplitude field.
void Log (float base=10.0f, float eps=1.0f)
void Gamma (float g)
void Threshold (float max, float min=0.0)
void __PickupFloat (float *src, float *pix_p, float pix)
void __PickupCplx (cwoComplex *src, cwoComplex *pix_p, float pix)
void Binary (float th=0.0, float max=1.0, float min=0.0)
float Average ()
 calculate the average of the real part
float Variance ()
 calculate the variance of the real part
void SetRandSeed (long long s)
void RandReal (float max=1.0f, float min=0.0f)
void __RandPhase (cwoComplex *a, float max, float min)
void __MulRandPhase (cwoComplex *a, float max, float min)
void __WindowFlatCos (cwoComplex *p, int L, int L0, float k)
 Windoww function (flatheadded cos window)
void __MaxMin (cwoComplex *a, float *max, float *min, int *max_x=nullptr, int *max_y=nullptr, int *min_x=nullptr, int *min_y=nullptr)
cwoComplex TotalSum ()
 Calculate total sum of real part.
int __ScaleReal (float i1, float i2, float o1, float o2)
int __ScaleCplx (float i1, float i2, float o1, float o2)
void __ResizeNearest (cwoComplex *p_new, int dNx, int dNy, cwoComplex *p_old, int sNx, int sNy)
void __ResizeLinear (cwoComplex *p_new, int dNx, int dNy, cwoComplex *p_old, int sNx, int sNy)
void __ResizeCubic (cwoComplex *p_new, int dNx, int dNy, cwoComplex *p_old, int sNx, int sNy)
void __ResizeLanczos (cwoComplex *p_new, int dNx, int dNy, cwoComplex *p_old, int sNx, int sNy)
void __ResizeNearestScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
void __ResizeLinearScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
void __ResizeCubicScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
void __ResizeLanczosScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
void AffineAngularSpectrum (float *mat_affine, float px, float py, int flag)
void ErrorDiffusion (CWO *a=nullptr, int flag=CWO_ED_FS)
void ErrorDiffusionSegmented (CWO *a=nullptr, int flag=CWO_ED_FS)
float MSE (CWO &ref)
 Measure MSE between target and reference images.
virtual void __ArbitFresnelDirect (cwoComplex *p1, cwoComplex *p2, cwoFloat2 *p_x1, cwoFloat2 *p_x2, float *p_d1, float *p_d2)
virtual void __ArbitFresnelCoeff (cwoComplex *p, cwoFloat2 *p_x2, float *p_d2)
- Public Member Functions inherited from CWO
void InitParams ()
void InitBuffers ()
 Intialize parameters.
void FreeBuffers ()
 Initialze buffers.
virtual void __ExpandMirror (cwoComplex *src, int srcNx, int srcNy, cwoComplex *dst, int dstNx, int dstNy, int type)
virtual void __FresnelAnalysisTransfer (cwoComplex *a, cwoComplex *b)
void __AngularLim (float *fx_c, float *fx_w, float *fy_c, float *fy_w)
void __Add (cwoComplex *a, float b, cwoComplex *c)
void __Sub (cwoComplex *a, float b, cwoComplex *c)
void __Mul (cwoComplex *a, float b, cwoComplex *c)
void __Div (cwoComplex *a, float b, cwoComplex *c)
virtual void __Conj (cwoComplex *a)
void FromChar (const char *src, int Nx, int Ny)
void FromFloat (const float *src, int Nx, int Ny)
void SetSize (int Nx, int Ny)
void SetPropDist (float z)
float GetPropDist ()
 CWO ()
 constructor
virtual ~CWO ()
 Constructor with size.
 CWO (CWO &tmp)
 copy constructor
 CWO (int Nx, int Ny)
 constructor
CWOoperator= (CWO &tmp)
CWOoperator+= (CWO &const a)
CWOoperator+= (float a)
CWOoperator+= (cwoComplex a)
CWOoperator-= (CWO &a)
CWOoperator-= (float a)
CWOoperator-= (cwoComplex a)
CWOoperator*= (CWO &a)
CWOoperator*= (float a)
CWOoperator*= (cwoComplex a)
CWOoperator/= (CWO &a)
CWOoperator/= (float a)
CWOoperator/= (cwoComplex a)
int Create (int Nx, int Ny=1)
 Create complex amplitude with Nx x Ny size.
virtual void Destroy ()
 Release complex amplitude with Nx x Ny size (in pixel unit) from memory.
void Attach (cwoCtx *ctx, cwoComplex *p)
void SetTimer ()
 Start time mesurement.
double EndTimer ()
 End time mesurement.
void SetCtx (const cwoCtx &c)
 Set context which manages the parameters of the wavelength, pixel pitch, etc.
cwoCtx & GetCtx ()
 Get context which manages the parameters of the wavelength, pixel pitch, etc.
void SetCalcType (int type)
 Set diffraction type. Do not use it.
void SetPitch (float px, float py)
 Set the sampling rate on source and destination planes.
void SetPitch (float p)
void SetPitch (const cwoFloat2 &p)
void SetPitch (const cwoVect2< float > &p)
void SetSrcPitch (float px, float py)
 Set the sampling rate on source plane only.
void SetSrcPitch (float p)
void SetSrcPitch (const cwoFloat2 &p)
void SetSrcPitch (const cwoVect2< float > &p)
void SetDstPitch (float px, float py)
 Set the sampling rate on destination plane only.
void SetDstPitch (float p)
void SetDstPitch (const cwoFloat2 &p)
void SetDstPitch (const cwoVect2< float > &p)
void SetWaveLength (float w)
 Set the wavelength of light.
void SetOffset (float x, float y)
 Set the offset of source plane away from the origin.
void SetOffset (const cwoFloat2 &p)
void SetOffset (const cwoVect2< float > &p)
void SetSrcOffset (float x, float y)
 Set the offset of source plane away from the origin.
void SetSrcOffset (const cwoFloat2 &p)
void SetSrcOffset (const cwoVect2< float > &p)
void SetDstOffset (float x, float y)
 Set the offset of destination plane away from the origin.
void SetDstOffset (const cwoFloat2 &p)
void SetDstOffset (const cwoVect2< float > &p)
int GetThreads ()
 get the number of threads
size_t GetNx ()
 get horizontal pixel number
size_t GetNy ()
 get vertical pixel number
cwoVect2< size_t > GetShape ()
 get horizontal and vertical pixel number
float GetWaveLength ()
 get wavelength
float GetWaveNum ()
 get wave number
float GetDistance ()
 get propagation distance
float GetPx ()
 get sampling rate along to x-axis on source plane
float GetPy ()
 get sampling rate along to y-axis on source plane
cwoVect2< float > GetPitch ()
float GetSrcPx ()
 get sampling rate along to x-axis on source plane
float GetSrcPy ()
 get sampling rate along to y-axis on source plane
cwoVect2< float > GetSrcPitch ()
float GetDstPx ()
 get sampling rate along to x-axis on destination plane
float GetDstPy ()
 get sampling rate along to y-axis on destination plane
cwoVect2< float > GettDstPitch ()
float GetOx ()
 get offset along to x-axis on source plane
float GetOy ()
 get offset along to y-axis on source plane
cwoVect2< float > GetOffset ()
float GetSrcOx ()
 get offset along to x-axis on source plane
float GetSrcOy ()
 get offset along to y-axis on source plane
cwoVect2< float > GetSrcOffset ()
float GetDstOx ()
 get offset along to x-axis on destination plane
float GetDstOy ()
 get offset along to y-axis on destination plane
cwoVect2< float > GetDstOffset ()
float GetLx ()
 get physical length of source along to x-axis
float GetLy ()
 get physical length of source along to y-axis
cwoVect2< float > GetLength ()
float GetSrcLx ()
 get physical length of source along to x-axis
float GetSrcLy ()
 get physical length of source along to y-axis
cwoVect2< float > GetSrcLength ()
float GetDstLx ()
 get physical length of destication along to x-axis
float GetDstLy ()
 get physical length of destication along to y-axis
cwoVect2< float > GetDstLength ()
cwoVect2< int > GetCenterPix ()
int GetAliasingFreeApproxSphWave (float z, float p, float wl)
 get aliasing-free radius of approximated spherical wave
void ShowParam ()
 Show parameters of cwoCtx.
int CheckExt (const char *fname, const char *ext)
int SaveMonosToColor (const std::string &fname, const std::string &r_name, const std::string &g_name, const std::string &b_name)
int SaveAsImage (const std::string &fname, float i1, float i2, float o1, float o2, int flag=CWO_SAVE_AS_RE, int bmp_8_24=24)
int SaveAsImage (const std::string &fname, int flag=CWO_SAVE_AS_RE, int bmp_8_24=24)
int SaveLineAsText (const std::string &fname, int flag)
int SaveLineAsText (const std::string &fname, int flag, int x1, int y1, int x2, int y2)
cwoComplexGetBuffer ()
 Get pointer to the buffer of the complex amplitude.
int CmpCtx (cwoCtx &a, cwoCtx &b)
size_t GetMemSizeCplx ()
 Get required memory with Nx x Ny size in cwoComplex.
size_t GetMemSizeFloat ()
 Get required memory with Nx x Ny size in float.
size_t GetMemSizeChar ()
 Get required memory with Nx x Ny size in char.
int GetDfrExpand ()
 Calculate diffraction.
void SetDfrExpand (int flag=0)
void Diffract (float d, int type=CWO_ANGULAR, cwoInt4 *zp=nullptr, cwoComplex *knl_mask=nullptr, CWO *numap=nullptr)
void Diffract (float d, int type, CWO *tmp_buf)
void Diffract (int type, CWO *kernel[])
void DiffractConv (float d, int type, cwoComplex *ape, cwoComplex *prop, cwoInt4 *zp=nullptr, cwoComplex *knl_mask=nullptr, CWO *numap=nullptr, int prop_calc=1)
void DiffractFourier (float d, int type, cwoInt4 *zp=NULL)
void DiffractDirect (float d, CWO *snumap, CWO *dnumap)
void DiffractAffine (float *affine_mat, int interpolation=CWO_INTER_LINEAR)
 diffraction with affine matrix
void DiffractDepth (float z, float dz, int num, const char *path, const char *name, const char *ext, int type=CWO_ANGULAR)
void AngularProp (CWO *a)
void ShiftedAngularProp (CWO *a)
void FresnelConvProp (CWO *a)
void FresnelConvCoeff (CWO *a)
void ShiftedFresnelProp (CWO *a)
void ShiftedFresnelAperture (CWO *a)
void ShiftedFresnelCoeff (CWO *a)
void ARSSFresnelProp (CWO *a)
void ARSSFresnelAperture (CWO *a)
void ARSSFresnelCoeff (CWO *a)
void FresnelFourierProp (CWO *a)
void FresnelFourierCoeff (CWO *a)
void FresnelDblAperture (CWO *a, float z1)
void FresnelDblFourierDomain (CWO *a, float z1, float z2, cwoInt4 *zp)
void FresnelDblCoeff (CWO *a, float z1, float z2)
void FresnelDupProp (CWO *a, float M)
void PreDiffract (float z, int type, CWO *a[])
void ReleaseTmpBuffer ()
void FresnelCoeff (float z1, float z2, float wl1, float wl2)
float fresnel_c (float x)
float fresnel_s (float x)
void FresnelInt (float z, int x1, int y1, int x2, int y2)
virtual void __AddSphericalWave (cwoComplex *p, float x, float y, float z, float px, float py, float a, float ph=0.0f)
void AddSphericalWave (float x, float y, float z, float a, float ph=0.0f)
void AddSphericalWave (float x, float y, float z, float px, float py, float a, float ph=1.0f)
 Add spherical wave to the field.
void MulSphericalWave (float x, float y, float z, float a=1.0f)
 Multiply spherical wave to the field.
void MulSphericalWave (float x, float y, float z, float px, float py, float a=1.0f)
void AddApproxSphWave (float x, float y, float z, float a=1.0f)
void AddApproxSphWave (float x, float y, float z, float px, float py, float a=1.0f)
void AddApproxSphWave (float x, float y, float phi, float zx, float zy, float px, float py, float a=1.0f)
void MulApproxSphWave (float x, float y, float z, float a=1.0f)
void MulApproxSphWave (float x, float y, float z, float px, float py, float a=1.0f)
void MulApproxSphWave (float x, float y, float phi, float zx, float zy, float px, float py, float a=1.0f)
void AddPlanarWave (float kx, float ky, float px, float py, float a=1.0f)
 Add planar wave to the field.
void AddPlanarWave (float kx, float ky, float a=1.0f)
 Add planar wave to the field.
void MulPlanarWave (float kx, float ky, float px, float py, float a=1.0f)
 Multiply planar wave to the field.
void MulPlanarWave (float kx, float ky, float a=1.0f)
 Multiply planar wave to the field.
void Re ()
 Taking only the real part of complex amplitude.
void Im ()
 Taking only the imaginary part of complex amplitude.
void Conj ()
 Calculating the complex conjugation of complex amplitude.
void Intensity ()
 Calculating the absolute square (light intensity) of complex amplitude.
void Amp ()
 Calculating the amplitude of complex amplitude.
void Phase (float offset=0.0f)
 Calculating complex amplitude with the constant amplitude .
void Arg (float scale=1.0f, float offset=0.0f)
 Calculating the argument of complex amplitude with real value from $-\pi$ to $+\pi$.
.
void Expi ()
void Arg2Cplx (float scale=1.0, float offset=0.0)
void Cart2Polar ()
void Polar2Cart ()
void ReIm (CWO &re, CWO &im)
 replace the real and imaginary parts.

void Char ()
void Float ()
void Quant (float alpha)
void ToDouble (double *a)
void FromDouble (double *a)
void Div (float a)
cwoComplex Polar (float amp, float arg)
void SetPixel (int x, int y, float a)
void SetPixel (const cwoVect2< int > &v, float a)
void SetPixel (int x, int y, float amp, float ph)
void SetPixel (const cwoVect2< int > &v, float amp, float ph)
void SetPixel (int x, int y, cwoComplex &a)
void SetPixel (const cwoVect2< int > &v, cwoComplex &a)
void SetPixel (int x, int y, CWO &a)
void SetPixel (const cwoVect2< int > &v, CWO &a)
void AddPixel (int x, int y, cwoComplex a)
void AddPixel (const cwoVect2< int > &v, cwoComplex a)
void AddPixel (int x, int y, CWO &a)
void AddPixel (const cwoVect2< int > &v, CWO &a)
void MulPixel (int x, int y, float a)
void MulPixel (const cwoVect2< int > &v, float a)
void MulPixel (int x, int y, cwoComplex a)
void MulPixel (const cwoVect2< int > &v, cwoComplex a)
void GetPixel (int x, int y, float &a)
void GetPixel (const cwoVect2< int > &v, float &a)
void GetPixel (int x, int y, cwoComplex &a)
void GetPixel (const cwoVect2< int > &v, cwoComplex &a)
cwoComplex GetPixel (int m, int n)
cwoComplex GetPixel (const cwoVect2< int > &v)
void GetPixel (int x, int y, CWO &a)
void GetPixel (const cwoVect2< int > &v, CWO &a)
void GetLineH (int n, int N, CWO &a)
void GetLineV (int m, int N, CWO &a)
void GetLine (int m1, int n1, int m2, int n2, CWO &a)
void SetLineH (int n, CWO &a)
void SetLineV (int m, CWO &a)
void SetLine (int m1, int n1, int m2, int n2, CWO &a)
void Copy (CWO &a, int x1, int y1, int x2, int y2, int Sx, int Sy)
void Clear (int c=0)
template<class T >
void FlipH (T *a)
template<class T >
void FlipV (T *a)
void Flip (int mode=0)
void Crop (int x1, int y1, int Sx, int Sy)
void Crop (const cwoVect2< int > &v, const cwoVect2< int > &s)
void Crop (int x1, int y1, int Sx, int Sy, CWO &a)
void Crop (const cwoVect2< int > &v, const cwoVect2< int > &s, CWO &a)
void ShiftX (int s, int flag=0)
void ShiftY (int s, int flag=0)
void Transpose ()
virtual void __Transpose (cwoComplex *pi, cwoComplex *po)
void JoinH (CWO &a)
void JoinV (CWO &a)
void Rect (int m, int n, int Sx, int Sy, cwoComplex &a, int flag=CWO_FILL_INSIDE)
 fill inside and outside rectangular area
void Rect (const cwoVect2< int > &v, const cwoVect2< int > &s, cwoComplex &a, int flag=CWO_FILL_INSIDE)
void Circ (int m, int n, int r, cwoComplex &a, int flag=CWO_FILL_INSIDE)
 fill inside or outside circular area with radius r
void Circ (const cwoVect2< int > &v, int r, cwoComplex &a, int flag=CWO_FILL_INSIDE)
virtual void __CircFillInside (cwoComplex *p, int m, int n, int r, cwoComplex &a)
virtual void __CircFillOutside (cwoComplex *p, int m, int n, int r, cwoComplex &a)
void MulCirc (int m, int n, int r, cwoComplex &a)
 multiply complex value in circular area
void MulCirc (const cwoVect2< int > &v, int r, cwoComplex &a)
void Convolve (CWO &a, float *ker, int Sx, int Sy)
void ConvolveFFT (CWO *a, CWO *b, CWO *c)
virtual void Expand (int Nx, int Ny)
void ExpandMirror ()
void ExpandTwice (CWO *src)
void ExpandHalf (CWO *dst)
int ScaleReal (float lim=1.0)
 scale current pixels (real part of complex amplitude) by specified maximum value
int ScaleReal (float i1, float i2, float o1, float o2)
 scale real part of complex amplitude by specified range
int ScaleCplx (float lim=1.0)
 scale complex amplitude by specified maximum value
int ScaleCplx (float i1, float i2, float o1, float o2)
 scalecomplex amplitude by specified range
virtual void SetRandSeed (long long int s)
 set the seed of random sequence to generate other
long long int GetRandSeed ()
float GetRandVal ()
 get random value
cwoComplex GetRandComplex ()
void RandPhase (float max=CWO_PI, float min=-CWO_PI)
void SetRandPhase (float max=CWO_PI, float min=-CWO_PI)
void MulRandPhase (float max=CWO_PI, float min=-CWO_PI)
void __Hanning (cwoComplex *a, int m, int n, int Wx, int Wy)
 Hanning window.
void __Hamming (cwoComplex *a, int m, int n, int Wx, int Wy)
 Hamming window.
void __WindowCos (cwoComplex *a, int m, int n, int W, int Wa)
void __WindowTukey (cwoComplex *a, int m, int n, float r)
 Tukey window.
void __WindowFlatCosCirc (cwoComplex *p, int L, int L0, float k)
void __WindowSigmoid (cwoComplex *p, int m, int n, float a, float Tmax, float Tmin)
 Sigmoid window.
void AddNoiseWhite (float max=1.0)
void MulNoiseWhite (float max=1.0)
void AddNoiseGaussian (float mu, float sigma)
void MulNoiseGaussian (float mu, float sigma)
void Resize (int dNx, int dNy, int flag=CWO_INTER_LINEAR)
 resize an image

void Resize (const cwoVect2< int > &s, int flag=CWO_INTER_LINEAR)
void Resize (CWO *dst, float scale_x, float scale_y, int flag=CWO_INTER_LINEAR)
void Rotate (float deg)
void AffineAngularSpectrum (float *mat_affine, const cwoVect2< float > &pitch, int flag=CWO_INTER_LINEAR)
void RGB2YCbCr (CWO *rgb, CWO *ycbcr)
void YCbCr2RGB (CWO *rgb, CWO *ycbcr)
void MulMatrix (CWO *a, cwoComplex *b, CWO *c)
void FourierShift (float m, float n)
int FFT (int flag=0)
 Fast Fourier Transform (FFT)
int FFT (int dx, int dy, int flag=0)
 Fast Fourier Transform (FFT)
virtual void FFTShift (int dx, int dy)
 FFT Shift.
virtual void __ScaledFFTCoeff (cwoComplex *p, float sx, float sy, cwoComplex alpha)
virtual void __ScaledFFTKernel (cwoComplex *p, float sx, float sy, cwoComplex alpha)
void NUFFT1 (CWO *map, int R=2, int Msp=12)
 Non-uniform FFT (Type1)
void NUFFT2 (CWO *map, int R=2, int Msp=12)
 Non-uniform FFT (Type2)
void ConvertSamplingMap (int type)
void SamplingMapScaleOnly (int Nx, int Ny, float R, float sgn)
virtual void Threshold (float max_th, float max_val, float min_th, float min_val)
void ThresholdAmp (float max_amp, float min_amp)
void ThresholdToZero (float th)
void ThresholdAbsToZero (float th)
void ThresholdHist (float var)
void Pickup (CWO *a, float pix)
 Pickup pixels.
int POC (CWO &ref)
 phase only correlation (POC)
unsigned int Count (float a)
unsigned int CountNonZero ()
float Average (int m, int n, int Sx, int Sy)
float Variance (int m, int n, int Sx, int Sy)
float StdDev (int m, int n, int Sx, int Sy)
 calculate the standard deviation
float Max (int *m=NULL, int *n=NULL)
 find maximum of the real part
float Min (int *m=NULL, int *n=NULL)
 find minimum of the real part
int MaxMin (float *max, float *min, int *max_x=nullptr, int *max_y=nullptr, int *min_x=nullptr, int *min_y=nullptr)
 find maxmum and minimum of the real part
void VarianceMap (int sx, int sy)
 generate variance map
float Histogram (int *hist, int N)
 generate histogram
float SNR (CWO &ref)
 Measure SNR(Signal to Noise Ratio) between target and reference images.
float PSNR (CWO &ref)
 Measure PSNR between target and reference images.
float SSIM (CWO &ref)
 Measure SSIM between target and reference images.
float SpeckleContrast (int m, int n, int Sx, int Sy)
CWO LaplacianPhase ()
void PoisonSolverFFT ()
void PhaseUnwrap (int type=0)
virtual cwoObjPointGetPointBuffer ()
virtual int GetPointNum ()
virtual void SetPointNum (int num)
virtual void ScalePoint (float lim)
void PLS (int flag)
virtual void __PLS_Huygens (float ph=0.0f)
virtual void __PLS_Fresnel (float ph=0.0f)
virtual void __PLS_CGH_Fresnel (float ph=0.0f)
virtual void __InvFx2Fy2 (cwoComplex *a)
void ParticleField (cwoFloat3 pos, float radius, float amp=1.0f, float init_ph=0.0f)
 Complex amplitude from particle with radius.

Public Attributes

gwoCtx gtx
- Public Attributes inherited from CWO
cwoCtx ctx
long long int rnd_seed
void * p_field
float z0
float pz

Friends

template<class T >
GWO operator+ (const T &a, GWO &c)
template<class T >
GWO operator- (const T &a, GWO &c)
template<class T >
GWO operator* (const T &a, GWO &c)
template<class T >
GWO operator/ (const T &a, GWO &c)

Detailed Description

Examples:
simple_diffraction_with_gpu.cpp.

Member Function Documentation

void GWO::SetThreads ( int  Nx,
int  Ny 
)

set the number of threads

Parameters:
N: number of threads

Reimplemented from CWO.

void GWO::Send ( CWO a)
virtual

Send data to GPU.

Parameters:
asend the data of "CWO a" to GPU

Reimplemented from CWO.

Examples:
simple_diffraction_with_gpu.cpp.
void GWO::Recv ( CWO a)
virtual

Receive data from GPU.

Parameters:
a"CWO a" receives from the data on GPU

Reimplemented from CWO.

Examples:
simple_diffraction_with_gpu.cpp.
int GWO::Load ( const std::string &  fname,
int  c = CWO_GREY 
)

Load image file or cwo file.

Parameters:
fnameFilename
cselect color to be read the color image file. The default value is CWO_GREY.
Returns:
When the function success to load file, the return value is CWO_SUCCESS, otherwise CWO_ERROR.
Note:
This function can load bitmap format file. If you use jpeg, tiff, png image formats, you need to install ImageMagik.

Reimplemented from CWO.

int GWO::Load ( const std::string &  fname_amp,
const std::string &  fname_pha,
int  c = CWO_GREY 
)

Load image file or cwo file.

Parameters:
fname_ampfilename as amplitude
fname_phafilename as argument
cselect color to be read the color image file. The default value is CWO_GREY.
Returns:
When the function success to load file, the return value is CWO_SUCCESS, otherwise CWO_ERROR.
Note:
This function can load bitmap format file. If you use jpeg, tiff, png image formats, you need to install ImageMagik.

Reimplemented from CWO.

int GWO::Save ( const std::string &  fname,
int  bmp_8_24 = 24 
)

Save image file or cwo file.

Parameters:
fnamefilename
r
g
b
Returns:
When the function success to load file, the return value is CWO_SUCCESS, otherwise CWO_ERROR.
Note:
This function can load bitmap format file. If you use jpeg, tiff, png image formats, you need to install ImageMagik.

Reimplemented from CWO.

void GWO::__AddApproxSphWave ( cwoComplex p,
float  x,
float  y,
float  phi,
float  zx,
float  zy,
float  px,
float  py,
float  a 
)
virtual

Add Fresnel-approximated spherical wave to the field.

Parameters:
x: center of the spherical wave
y: center of the spherical wave
z: distance between the field and the spherical wave
px: sampling rate along to x-axis on the field
py: sampling rate along to y-axis on the field
a: amplitude of the spherical wave Add Fresnel-approximated spherical wave to the field.
    @param x : center of the spherical wave 
    @param y : center of the spherical wave
    @param phi : initial phase of the spherical wave
    @param px : sampling rate along to x-axis on the field
    @param py : sampling rate along to y-axis on the field
    @param a : amplitude of the spherical wave

Reimplemented from CWO.

void GWO::__MulApproxSphWave ( cwoComplex p,
float  x,
float  y,
float  phi,
float  zx,
float  zy,
float  px,
float  py,
float  a 
)
virtual

Multiply Fresnel-approximated spherical wave to the field.

Parameters:
x: center of the spherical wave
y: center of the spherical wave
phi: initial phase of the spherical wave
px: sampling rate along to x-axis on the field
py: sampling rate along to y-axis on the field
a: amplitude of the spherical wave

Reimplemented from CWO.

float GWO::Average ( )
virtual

calculate the average of the real part

Parameters:
m: coordinate of Region of Interest(ROI)
n: coordinate of ROI
Sx: ROI size
Sy: ROI size
Returns:
average

Reimplemented from CWO.

float GWO::Variance ( )
virtual

calculate the variance of the real part

Returns:
variance

Reimplemented from CWO.

void GWO::__WindowFlatCos ( cwoComplex p,
int  L,
int  L0,
float  k 
)
virtual

Windoww function (flatheadded cos window)

Note:
see Yancao Zhang, Jianlin Zhao, Qi Fan, Wei Zhang, and Sheng Yang, "Improving the reconstruction quality with extension and apodization of the digital hologram," Appl. Opt. 48, 3070-3074 (2009)

Reimplemented from CWO.

cwoComplex GWO::TotalSum ( )
virtual

Calculate total sum of real part.

Returns:
Total sum

Reimplemented from CWO.

float GWO::MSE ( CWO ref)
virtual

Measure MSE between target and reference images.

CWO ref,tar;
ref.Load("reference_image.bmp");
tar.Load("taeget_image.bmp");
float mse=tar.MSE(ref);
printf("MSE is %f\n",mse);

Reimplemented from CWO.


The documentation for this class was generated from the following file: