Openholo  v4.2
Open Source Digital Holographic Library
ophPAS.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef __ophPAS_h
4 #define __ophPAS_h
5 
6 #include "ophGen.h"
7 
8 
9 #define PI (3.14159265358979323846f)
10 #define M2_PI (PI*2.0)
11 #define RADIANS (PI/180.0) // Angle in radians
12 // DEGREE*asin(mytheta)
13 #define DEGREE2 (180./PI) // sin(RADIANS*DEGREE*asin(mytheta))
14 
15 #define NUMTBL 1024
16 #define NUMTBL2 (NUMTBL-1)
17 #define MAX_STR_LEN 4000
18 
19 #define FFT_SEGMENT_SIZE 64
20 
21 struct VoxelStruct;
22 struct Segment;
23 
24 using namespace oph;
25 
26 class GEN_DLL ophPAS : public ophGen
27 {
28 private:
29  OphPointCloudConfig pc_config;
30  OphPointCloudData pc_data;
31  int n_points;
32 public:
33  explicit ophPAS();
34 protected:
35  virtual ~ophPAS();
36 
37 public:
38  bool readConfig(const char* fname);
39  int loadPoint(const char* _filename);
40 
41 
42  //void PASCalcuation(long voxnum, unsigned char *cghfringe, VoxelStruct* h_vox, CGHEnvironmentData* _CGHE);
43  void PASCalculation(long voxnum, unsigned char * cghfringe, OphPointCloudData *data, OphPointCloudConfig& conf);
44  //void PAS(long voxelnum, struct VoxelStruct *voxel, double *m_pHologram, CGHEnvironmentData* _CGHE);
45  void PAS(long voxelnum, OphPointCloudData *data, double *m_pHologram, OphPointCloudConfig& conf);
46  void PAS_GPU(long voxelnum, OphPointCloudData *data, double *m_pHologram, OphPointCloudConfig& conf);
47  void DataInit(int segsize, int cghwidth, int cghheight, float xiinter, float etainter);
48  void init();
49  void MemoryRelease(void);
50 
51  void generateHologram();
52 
53  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);
54 
55  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);
56 
57  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);
58 
59  void encodeHologram(const vec2 band_limit, const vec2 spectrum_shift);
60  void encoding(unsigned int ENCODE_FLAG);
61 
62 
63  double *m_pHologram;
64 
65  float m_COStbl[NUMTBL];
66  float m_SINtbl[NUMTBL];
67 
68  int m_segSize;
71  int m_segNumx;
72  int m_segNumy;
75 
76  float* m_inRe_h;
77  float* m_inIm_h;
78 
85  float *m_xc;
86  float *m_yc;
87  unsigned char* cgh_fringe;
88 
89  float m_sf_base;
90 
91  fftw_complex *m_in, *m_out;
92  fftw_plan m_plan;
93 
94  float **m_inRe;
95  float **m_inIm;
96 
97  float m_cx;
98  float m_cy;
99  float m_cz;
100  float m_amp;
101 };
102 
103 typedef struct GEN_DLL _Voxel // voxel structure - data
104 {
105  int num; // voxel or point number
106  float x; // x axis coordinate
107  float y; // y axis coordinate
108  float z; // z axis coordinate
109  float ph; // phase
110  float r; // amplitude in red channel
111  float g; // amplitude in green channel
112  float b; // amplitude in blue channel
113 } Voxel;
114 
115 
116 struct GEN_DLL Segment
117 {
118  bool WorkingFlag;
119  long SegmentIndex;
120  int SegSize_x;
121  int SegSize_y;
122  int hSegSize_x; // Half size
123  int hSegSize_y; // Half size
124  double CenterX;
125  double CenterY;
126  double FrequencySlope;
127 };
128 #endif // !__ophPAS_h
struct GEN_DLL _Voxel Voxel
ENCODE_FLAG
Definition: ophGen.h:84
#define NUMTBL
Definition: ophPAS.h:15
int num
Definition: ophPAS.h:105
fftw_complex * m_out
Definition: ophPAS.h:91
int m_hsegNumx
Definition: ophPAS.h:73
float * m_yc
Definition: ophPAS.h:86
int m_segSize
Definition: ophPAS.h:68
float * m_inRe_h
Definition: ophPAS.h:76
int * m_PickPoint_cx
Definition: ophPAS.h:81
float * m_SFrequency_cx
Definition: ophPAS.h:79
int * m_Coefficient_cx
Definition: ophPAS.h:83
float ** m_inIm
Definition: ophPAS.h:95
float r
Definition: ophPAS.h:110
float * m_inIm_h
Definition: ophPAS.h:77
int m_segNumx
Definition: ophPAS.h:71
float m_cy
Definition: ophPAS.h:98
float m_amp
Definition: ophPAS.h:100
double * m_pHologram
Definition: ophPAS.h:63
float m_sf_base
Definition: ophPAS.h:89
float g
Definition: ophPAS.h:111
int m_segNumy
Definition: ophPAS.h:72
float * m_SFrequency_cy
Definition: ophPAS.h:80
int m_dsegSize
Definition: ophPAS.h:70
float x
Definition: ophPAS.h:106
float m_cx
Definition: ophPAS.h:97
#define GEN_DLL
Definition: ophGen.h:61
structure for 2-dimensional Real type vector and its arithmetic.
Definition: vec.h:66
float m_cz
Definition: ophPAS.h:99
int * m_Coefficient_cy
Definition: ophPAS.h:84
float ** m_inRe
Definition: ophPAS.h:94
Definition: ophPAS.h:103
int m_hsegNumy
Definition: ophPAS.h:74
Configuration for Point Cloud.
Definition: ophGen.h:555
float b
Definition: ophPAS.h:112
Data for Point Cloud.
Definition: ophGen.h:582
int * m_PickPoint_cy
Definition: ophPAS.h:82
float y
Definition: ophPAS.h:107
fftw_plan m_plan
Definition: ophPAS.h:92
Definition: ophPAS.h:26
float * m_xc
Definition: ophPAS.h:85
unsigned char * cgh_fringe
Definition: ophPAS.h:87
float ph
Definition: ophPAS.h:109
float z
Definition: ophPAS.h:108
Definition: Bitmap.h:49
int m_hsegSize
Definition: ophPAS.h:69
Definition: ophGen.h:76