Openholo  v1.0
Open Source Digital Holographic Library
ophPAS Class Reference

#include <ophPAS.h>

Inheritance diagram for ophPAS:
Collaboration diagram for ophPAS:

Public Member Functions

 ophPAS ()
 
int init (const char *_filename, CGHEnvironmentData *_CGHE)
 
bool loadConfig (const char *filename, CGHEnvironmentData *_CGHE)
 
bool readConfig (const char *fname, OphPointCloudConfig &configdata)
 
bool loadPoint (const char *_filename, VoxelStruct *h_vox)
 
bool load_Num_Point (const char *_filename, long *num_point)
 
int save (const char *fname, uint8_t bitsperpixel, uchar *src, uint px, uint py)
 
char * trim (char *s)
 
char * ltrim (char *s)
 
char * rtrim (char *s)
 
void DataInit (CGHEnvironmentData *_CGHE)
 
void PASCalcuation (long voxnum, unsigned char *cghfringe, OphPointCloudData *data, OphPointCloudConfig &conf)
 
void PAS (long voxelnum, OphPointCloudData *data, double *m_pHologram, OphPointCloudConfig &conf)
 
void DataInit (int segsize, int cghwidth, int cghheight, float xiinter, float etainter)
 
void DataInit (OphPointCloudConfig &conf)
 
void MemoryRelease (void)
 
void CalcSpatialFrequency (float cx, float cy, float cz, float amp, int segnumx, int segnumy, int segsize, int hsegsize, float sf_base, float *xc, float *yc, float *sf_cx, float *sf_cy, int *pp_cx, int *pp_cy, int *cf_cx, int *cf_cy, float xiint, float etaint, CGHEnvironmentData *_CGHE)
 
void CalcSpatialFrequency (float cx, float cy, float cz, float amp, int segnumx, int segnumy, int segsize, int hsegsize, float sf_base, float *xc, float *yc, float *sf_cx, float *sf_cy, int *pp_cx, int *pp_cy, int *cf_cx, int *cf_cy, float xiint, float etaint, OphPointCloudConfig &conf)
 
void CalcCompensatedPhase (float cx, float cy, float cz, float amp, int segnumx, int segnumy, int segsize, int hsegsize, float sf_base, float *xc, float *yc, int *cf_cx, int *cf_cy, float *COStbl, float *SINtbl, float **inRe, float **inIm, CGHEnvironmentData *_CGHE)
 
void CalcCompensatedPhase (float cx, float cy, float cz, float amp, int segnumx, int segnumy, int segsize, int hsegsize, float sf_base, float *xc, float *yc, int *cf_cx, int *cf_cy, float *COStbl, float *SINtbl, float **inRe, float **inIm, OphPointCloudConfig &conf)
 
void RunFFTW (int segnumx, int segnumy, int segsize, int hsegsize, float **inRe, float **inIm, fftw_complex *in, fftw_complex *out, fftw_plan *plan, double *pHologram, CGHEnvironmentData *_CGHE)
 
void RunFFTW (int segnumx, int segnumy, int segsize, int hsegsize, float **inRe, float **inIm, fftw_complex *in, fftw_complex *out, fftw_plan *plan, double *pHologram, OphPointCloudConfig &conf)
 
- Public Member Functions inherited from ophGen
 ophGen (void)
 Constructor. More...
 
Real ** getEncodedBuffer (void)
 Function for getting the encoded complex field buffer. More...
 
uchar ** getNormalizedBuffer (void)
 Function for getting the normalized(0~255) complex field buffer. More...
 
void initialize (void)
 Initialize variables for Hologram complex field, encoded data, normalized data. More...
 
int loadPointCloud (const char *pc_file, OphPointCloudData *pc_data_)
 load to point cloud data. More...
 
bool readConfig (const char *fname)
 load to configuration file. More...
 
void propagationAngularSpectrum (int ch, Complex< Real > *input_u, Real propagation_dist, Real k, Real lambda)
 Angular spectrum propagation method. More...
 
void normalize (void)
 Normalization function to save as image file after hologram creation. More...
 
bool save (const char *fname, uint8_t bitsperpixel=8, uchar *src=nullptr, uint px=0, uint py=0)
 Function for saving image files. More...
 
void * load (const char *fname)
 Function for loading image files. More...
 
virtual bool loadAsOhc (const char *fname)
 Function to read OHC file. More...
 
virtual void encoding (unsigned int ENCODE_FLAG, Complex< Real > *holo=nullptr, bool bShift=false)
 Encoding Functions. More...
 
virtual void encoding (unsigned int ENCODE_FLAG, unsigned int SSB_PASSBAND, Complex< Real > *holo=nullptr)
 
void encoding ()
 
void waveCarry (Real carryingAngleX, Real carryingAngleY, Real distance)
 Wave carry. More...
 
ivec2 & getEncodeSize (void)
 Function for getting encode size. More...
 
void setResolution (ivec2 resolution)
 Function for setting buffer size. More...
 
Real getElapsedTime ()
 Function for getting elapsed time.
More...
 
void fresnelPropagation (OphConfig context, Complex< Real > *in, Complex< Real > *out, Real distance)
 Fresnel propagation. More...
 
void fresnelPropagation (Complex< Real > *in, Complex< Real > *out, Real distance, uint channel)
 Fresnel propagation. More...
 
- Public Member Functions inherited from Openholo
 Openholo (void)
 Constructor. More...
 
virtual bool saveAsImg (const char *fname, uint8_t bitsperpixel, uchar *src, int width, int height)
 Function for creating image files. More...
 
virtual ucharloadAsImg (const char *fname)
 Function for loading image files. More...
 
virtual bool saveAsOhc (const char *fname)
 Function to write OHC file
More...
 
Complex< Real > ** getComplexField (void)
 Function for getting the complex field. More...
 
OphConfiggetContext (void)
 Function for getting the current context. More...
 
void setPixelNumber (ivec2 n)
 Function for setting the output resolution. More...
 
void setPixelPitch (vec2 p)
 Function for setting the output pixel pitch. More...
 
void setWaveLength (Real w, const uint idx)
 Function for setting the wave length. More...
 
- Public Member Functions inherited from Base
 Base (void)
 Constructor. More...
 
unsigned long addRef (void)
 If referenced this(Base's child, not abstract class) instance, must call this method. More...
 
unsigned long release (void)
 Call release() when reference is finished. More...
 

Public Attributes

double * m_pHologram
 
float m_COStbl [NUMTBL]
 
float m_SINtbl [NUMTBL]
 
int m_segSize
 
int m_hsegSize
 
int m_dsegSize
 
int m_segNumx
 
int m_segNumy
 
int m_hsegNumx
 
int m_hsegNumy
 
float * m_SFrequency_cx
 
float * m_SFrequency_cy
 
int * m_PickPoint_cx
 
int * m_PickPoint_cy
 
int * m_Coefficient_cx
 
int * m_Coefficient_cy
 
float * m_xc
 
float * m_yc
 
float m_sf_base
 
fftw_complex * m_in
 
fftw_complex * m_out
 
fftw_plan m_plan
 
float ** m_inRe
 
float ** m_inIm
 
float m_cx
 
float m_cy
 
float m_cz
 
float m_amp
 

Protected Member Functions

virtual ~ophPAS ()
 
- Protected Member Functions inherited from ophGen
virtual ~ophGen (void)=0
 Destructor. More...
 
bool save (const char *fname, uint8_t bitsperpixel, uint px, uint py, uint fnum, uchar *args ...)
 Called when saving multiple hologram data at a time. More...
 
void resetBuffer ()
 reset buffer More...
 
void numericalInterference (Complex< Real > *holo, Real *encoded, const int size)
 Encoding method. More...
 
void twoPhaseEncoding (Complex< Real > *holo, Real *encoded, const int size)
 
void burckhardt (Complex< Real > *holo, Real *encoded, const int size)
 
void singleSideBand (Complex< Real > *holo, Real *encoded, const ivec2 holosize, int passband)
 Encoding method. More...
 
void encodeSymmetrization (Complex< Real > *holo, Real *encoded, const ivec2 sig_loc)
 Encoding method. More...
 
void freqShift (Complex< Real > *src, Complex< Real > *dst, const ivec2 holosize, int shift_x, int shift_y)
 Frequency shift. More...
 
void encodeSideBand (bool bCPU, ivec2 sig_location)
 Encode the CGH according to a signal location parameter. More...
 
void encodeSideBand_CPU (int cropx1, int cropx2, int cropy1, int cropy2, ivec2 sig_location)
 Encode the CGH according to a signal location parameter on the CPU. More...
 
void encodeSideBand_GPU (int cropx1, int cropx2, int cropy1, int cropy2, ivec2 sig_location)
 Encode the CGH according to a signal location parameter on the GPU. More...
 
void getShiftPhaseValue (Complex< Real > &shift_phase_val, int idx, ivec2 sig_location)
 Calculate the shift phase value. More...
 
void getRandPhaseValue (Complex< Real > &rand_phase_val, bool rand_phase)
 Assign random phase value if RANDOM_PHASE == 1. More...
 
virtual void ophFree (void)
 Pure virtual function for override in child classes. More...
 
- Protected Member Functions inherited from Openholo
virtual ~Openholo (void)=0
 Destructor. More...
 
bool checkExtension (const char *fname, const char *ext)
 Functions for extension checking. More...
 
bool loadAsImgUpSideDown (const char *fname, uchar *dst)
 Function for loading image files | Output image data upside down. More...
 
bool getImgSize (int &w, int &h, int &bytesperpixel, const char *fname)
 Function for getting the image size. More...
 
void imgScaleBilnear (uchar *src, uchar *dst, int w, int h, int neww, int newh)
 Function for change image size. More...
 
void convertToFormatGray8 (uchar *src, uchar *dst, int w, int h, int bytesperpixel)
 Function for convert image format to gray8. More...
 
void fft1 (int n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
 Functions for performing fftw 1-dimension operations inside Openholo. More...
 
void fft2 (ivec2 n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
 Functions for performing fftw 2-dimension operations inside Openholo. More...
 
void fft3 (ivec3 n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
 Functions for performing fftw 3-dimension operations inside Openholo. More...
 
void fftExecute (Complex< Real > *out)
 Execution functions to be called after fft1, fft2, and fft3. More...
 
void fftFree (void)
 
void fftwShift (Complex< Real > *src, Complex< Real > *dst, int nx, int ny, int type, bool bNormalized=false)
 Convert data from the spatial domain to the frequency domain using 2D FFT on CPU. More...
 
void fftShift (int nx, int ny, Complex< Real > *input, Complex< Real > *output)
 Swap the top-left quadrant of data with the bottom-right , and the top-right quadrant with the bottom-left. More...
 
void setPixelNumberOHC (const ivec2 pixel_number)
 getter/setter for OHC file read and write More...
 
void setPixelPitchOHC (const vec2 pixel_pitch)
 
void setWavelengthOHC (const Real wavelength, const LenUnit wavelength_unit)
 
void setWaveLengthNumOHC (const uint wavelength_num)
 
void setColorTypeOHC (const ColorType color_type)
 
void setColorArrangeOHC (const ColorArran color_arrange)
 
void setWaveLengthUnitOHC (const LenUnit length_unit)
 
void setFieldEncodingOHC (const FldStore field_store, const FldCodeType field_code_type)
 
void setPhaseEncodingOHC (const BPhaseCode phase_code, const vec2 phase_code_range)
 
void addWaveLengthNComplexFieldDataOHC (const Real wavelength, const OphComplexField &complex_field)
 Function to add ComplexField when adding wavelength data. More...
 
void addWaveLengthOHC (const Real wavelength)
 
void addComplexFieldDataOHC (const OphComplexField &complex_field)
 
void getPixelNumberOHC (ivec2 &pixel_number)
 
void getPixelPitchOHC (vec2 &pixel_pitch)
 
void getWavelengthOHC (vector< Real > &wavelength)
 
void getWaveLengthNumOHC (uint &wavelength_num)
 
void getColorTypeOHC (ColorType &color_type)
 
void getColorArrangeOHC (ColorArran &color_arrange)
 
void getWaveLengthUnitOHC (LenUnit &length_unit)
 
void getComplexFieldDataOHC (Complex< Real > **cmplx, uint wavelen_idx)
 
void getComplexFieldDataOHC (OphComplexField &cmplx, uint wavelen_idx)
 
- Protected Member Functions inherited from Base
virtual ~Base (void)
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from ophGen
enum  ENCODE_FLAG {
  ENCODE_PHASE, ENCODE_AMPLITUDE, ENCODE_REAL, ENCODE_SIMPLENI,
  ENCODE_BURCKHARDT, ENCODE_TWOPHASE, ENCODE_SSB, ENCODE_OFFSSB,
  ENCODE_SYMMETRIZATION
}
 
enum  SSB_PASSBAND { SSB_LEFT, SSB_RIGHT, SSB_TOP, SSB_BOTTOM }
 
- Protected Attributes inherited from ophGen
ivec2 encode_size
 Encoded hologram size, varied from encoding type. More...
 
int ENCODE_METHOD
 Encoding method flag. More...
 
int SSB_PASSBAND
 Passband in Single-side band encoding. More...
 
Real elapsedTime
 Elapsed time of generate hologram. More...
 
Real ** holo_encoded
 buffer to encoded. More...
 
uchar ** holo_normalized
 buffer to normalized. More...
 
- Protected Attributes inherited from Openholo
OphConfig context_
 
Complex< Real > ** complex_H
 
ImgEncoderOhcOHC_encoder
 OHC file format Variables for read and write. More...
 
ImgDecoderOhcOHC_decoder
 
- Protected Attributes inherited from Base
unsigned long refCnt
 

Detailed Description

Definition at line 27 of file ophPAS.h.

Constructor & Destructor Documentation

◆ ophPAS()

ophPAS::ophPAS ( )
explicit

Definition at line 19 of file ophPAS.cpp.

◆ ~ophPAS()

ophPAS::~ophPAS ( )
protectedvirtual

Definition at line 23 of file ophPAS.cpp.

Member Function Documentation

◆ CalcCompensatedPhase() [1/2]

void ophPAS::CalcCompensatedPhase ( float  cx,
float  cy,
float  cz,
float  amp,
int  segnumx,
int  segnumy,
int  segsize,
int  hsegsize,
float  sf_base,
float *  xc,
float *  yc,
int *  cf_cx,
int *  cf_cy,
float *  COStbl,
float *  SINtbl,
float **  inRe,
float **  inIm,
CGHEnvironmentData _CGHE 
)

Definition at line 834 of file ophPAS.cpp.

◆ CalcCompensatedPhase() [2/2]

void ophPAS::CalcCompensatedPhase ( float  cx,
float  cy,
float  cz,
float  amp,
int  segnumx,
int  segnumy,
int  segsize,
int  hsegsize,
float  sf_base,
float *  xc,
float *  yc,
int *  cf_cx,
int *  cf_cy,
float *  COStbl,
float *  SINtbl,
float **  inRe,
float **  inIm,
OphPointCloudConfig conf 
)

Definition at line 871 of file ophPAS.cpp.

◆ CalcSpatialFrequency() [1/2]

void ophPAS::CalcSpatialFrequency ( float  cx,
float  cy,
float  cz,
float  amp,
int  segnumx,
int  segnumy,
int  segsize,
int  hsegsize,
float  sf_base,
float *  xc,
float *  yc,
float *  sf_cx,
float *  sf_cy,
int *  pp_cx,
int *  pp_cy,
int *  cf_cx,
int *  cf_cy,
float  xiint,
float  etaint,
CGHEnvironmentData _CGHE 
)

Definition at line 774 of file ophPAS.cpp.

◆ CalcSpatialFrequency() [2/2]

void ophPAS::CalcSpatialFrequency ( float  cx,
float  cy,
float  cz,
float  amp,
int  segnumx,
int  segnumy,
int  segsize,
int  hsegsize,
float  sf_base,
float *  xc,
float *  yc,
float *  sf_cx,
float *  sf_cy,
int *  pp_cx,
int *  pp_cy,
int *  cf_cx,
int *  cf_cy,
float  xiint,
float  etaint,
OphPointCloudConfig conf 
)

Definition at line 804 of file ophPAS.cpp.

◆ DataInit() [1/3]

void ophPAS::DataInit ( CGHEnvironmentData _CGHE)

Definition at line 441 of file ophPAS.cpp.

◆ DataInit() [2/3]

void ophPAS::DataInit ( int  segsize,
int  cghwidth,
int  cghheight,
float  xiinter,
float  etainter 
)

Definition at line 691 of file ophPAS.cpp.

◆ DataInit() [3/3]

void ophPAS::DataInit ( OphPointCloudConfig conf)

Definition at line 453 of file ophPAS.cpp.

◆ init()

int ophPAS::init ( const char *  _filename,
CGHEnvironmentData _CGHE 
)

Definition at line 28 of file ophPAS.cpp.

◆ load_Num_Point()

bool ophPAS::load_Num_Point ( const char *  _filename,
long *  num_point 
)

Definition at line 300 of file ophPAS.cpp.

◆ loadConfig()

bool ophPAS::loadConfig ( const char *  filename,
CGHEnvironmentData _CGHE 
)

Definition at line 37 of file ophPAS.cpp.

◆ loadPoint()

bool ophPAS::loadPoint ( const char *  _filename,
VoxelStruct h_vox 
)

Definition at line 244 of file ophPAS.cpp.

◆ ltrim()

char * ophPAS::ltrim ( char *  s)

Definition at line 417 of file ophPAS.cpp.

◆ MemoryRelease()

void ophPAS::MemoryRelease ( void  )

Definition at line 746 of file ophPAS.cpp.

◆ PAS()

void ophPAS::PAS ( long  voxelnum,
OphPointCloudData data,
double *  m_pHologram,
OphPointCloudConfig conf 
)

Definition at line 598 of file ophPAS.cpp.

◆ PASCalcuation()

void ophPAS::PASCalcuation ( long  voxnum,
unsigned char *  cghfringe,
OphPointCloudData data,
OphPointCloudConfig conf 
)

Definition at line 498 of file ophPAS.cpp.

◆ readConfig()

bool ophPAS::readConfig ( const char *  fname,
OphPointCloudConfig configdata 
)

Definition at line 120 of file ophPAS.cpp.

◆ rtrim()

char * ophPAS::rtrim ( char *  s)

Definition at line 398 of file ophPAS.cpp.

◆ RunFFTW() [1/2]

void ophPAS::RunFFTW ( int  segnumx,
int  segnumy,
int  segsize,
int  hsegsize,
float **  inRe,
float **  inIm,
fftw_complex *  in,
fftw_complex *  out,
fftw_plan *  plan,
double *  pHologram,
CGHEnvironmentData _CGHE 
)

Definition at line 908 of file ophPAS.cpp.

◆ RunFFTW() [2/2]

void ophPAS::RunFFTW ( int  segnumx,
int  segnumy,
int  segsize,
int  hsegsize,
float **  inRe,
float **  inIm,
fftw_complex *  in,
fftw_complex *  out,
fftw_plan *  plan,
double *  pHologram,
OphPointCloudConfig conf 
)

Definition at line 937 of file ophPAS.cpp.

◆ save()

int ophPAS::save ( const char *  fname,
uint8_t  bitsperpixel,
uchar src,
uint  px,
uint  py 
)

Definition at line 320 of file ophPAS.cpp.

◆ trim()

char * ophPAS::trim ( char *  s)

Definition at line 436 of file ophPAS.cpp.

Member Data Documentation

◆ m_amp

float ophPAS::m_amp

Definition at line 99 of file ophPAS.h.

◆ m_Coefficient_cx

int* ophPAS::m_Coefficient_cx

Definition at line 83 of file ophPAS.h.

◆ m_Coefficient_cy

int* ophPAS::m_Coefficient_cy

Definition at line 84 of file ophPAS.h.

◆ m_COStbl

float ophPAS::m_COStbl[NUMTBL]

Definition at line 68 of file ophPAS.h.

◆ m_cx

float ophPAS::m_cx

Definition at line 96 of file ophPAS.h.

◆ m_cy

float ophPAS::m_cy

Definition at line 97 of file ophPAS.h.

◆ m_cz

float ophPAS::m_cz

Definition at line 98 of file ophPAS.h.

◆ m_dsegSize

int ophPAS::m_dsegSize

Definition at line 73 of file ophPAS.h.

◆ m_hsegNumx

int ophPAS::m_hsegNumx

Definition at line 76 of file ophPAS.h.

◆ m_hsegNumy

int ophPAS::m_hsegNumy

Definition at line 77 of file ophPAS.h.

◆ m_hsegSize

int ophPAS::m_hsegSize

Definition at line 72 of file ophPAS.h.

◆ m_in

fftw_complex* ophPAS::m_in

Definition at line 90 of file ophPAS.h.

◆ m_inIm

float** ophPAS::m_inIm

Definition at line 94 of file ophPAS.h.

◆ m_inRe

float** ophPAS::m_inRe

Definition at line 93 of file ophPAS.h.

◆ m_out

fftw_complex * ophPAS::m_out

Definition at line 90 of file ophPAS.h.

◆ m_pHologram

double* ophPAS::m_pHologram

Definition at line 66 of file ophPAS.h.

◆ m_PickPoint_cx

int* ophPAS::m_PickPoint_cx

Definition at line 81 of file ophPAS.h.

◆ m_PickPoint_cy

int* ophPAS::m_PickPoint_cy

Definition at line 82 of file ophPAS.h.

◆ m_plan

fftw_plan ophPAS::m_plan

Definition at line 91 of file ophPAS.h.

◆ m_segNumx

int ophPAS::m_segNumx

Definition at line 74 of file ophPAS.h.

◆ m_segNumy

int ophPAS::m_segNumy

Definition at line 75 of file ophPAS.h.

◆ m_segSize

int ophPAS::m_segSize

Definition at line 71 of file ophPAS.h.

◆ m_sf_base

float ophPAS::m_sf_base

Definition at line 88 of file ophPAS.h.

◆ m_SFrequency_cx

float* ophPAS::m_SFrequency_cx

Definition at line 79 of file ophPAS.h.

◆ m_SFrequency_cy

float* ophPAS::m_SFrequency_cy

Definition at line 80 of file ophPAS.h.

◆ m_SINtbl

float ophPAS::m_SINtbl[NUMTBL]

Definition at line 69 of file ophPAS.h.

◆ m_xc

float* ophPAS::m_xc

Definition at line 85 of file ophPAS.h.

◆ m_yc

float* ophPAS::m_yc

Definition at line 86 of file ophPAS.h.


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