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;
69  int m_hsegSize;
70  int m_dsegSize;
71  int m_segNumx;
72  int m_segNumy;
73  int m_hsegNumx;
74  int m_hsegNumy;
75 
76  float* m_inRe_h;
77  float* m_inIm_h;
78 
79  float *m_SFrequency_cx;
80  float *m_SFrequency_cy;
81  int *m_PickPoint_cx;
82  int *m_PickPoint_cy;
83  int *m_Coefficient_cx;
84  int *m_Coefficient_cy;
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
#define GEN_DLL
Definition: ophGen.h:61
structure for 2-dimensional Real type vector and its arithmetic.
Definition: vec.h:66
Definition: ophPAS.h:103
Configuration for Point Cloud.
Definition: ophGen.h:555
Data for Point Cloud.
Definition: ophGen.h:582
Definition: ophPAS.h:26
Definition: Bitmap.h:49
#define NUMTBL
Definition: ophPAS.h:15
Definition: ophGen.h:76