Openholo  v5.0
Open Source Digital Holographic Library
ophNonHogelLF.h
Go to the documentation of this file.
1 #ifndef __ophNonHogelLF_h
2 #define __ophNonHogelLF_h
3 
4 #include "ophGen.h"
5 
6 using namespace oph;
7 
8 
9 //Build Option : Multi Core Processing (OpenMP)
10 #ifdef _OPENMP
11 #include <omp.h>
12 #endif
13 #pragma once
14 
15 
17 {
18 public:
22  explicit ophNonHogelLF(void);
23 
24 protected:
28  virtual ~ophNonHogelLF(void) {}
29 
30 
31 public:
32  inline void setNumImage(int nx, int ny) { num_image[_X] = nx; num_image[_Y] = ny; }
33  inline void setNumImage(ivec2 num) { num_image = num; }
34  inline void setResolImage(int nx, int ny) { resolution_image[_X] = nx; resolution_image[_Y] = ny; }
35  inline void setResolImage(ivec2 num) { resolution_image = num; }
36  inline void setDistRS2Holo(Real dist) { distanceRS2Holo = dist; }
37  inline void setFieldLens(Real lens) { fieldLens = lens; }
38  inline ivec2 getNumImage() { return num_image; }
39  inline ivec2 getResolImage() { return resolution_image; }
40  inline Real getDistRS2Holo() { return distanceRS2Holo; }
41  inline Real getFieldLens() { return fieldLens; }
42  inline uchar** getLF() { return LF; }
43 
44 public:
55  bool readConfig(const char* fname);
56 
64  int loadLF(const char* directory, const char* exten);
65  //void readPNG(const string filename, uchar* data);
66 
71  void preprocessLF();
72  void generateHologram();
73  void generateHologram(double thetaX, double thetaY);
74 
75  // for Testing
76  void writeIntensity_gray8_bmp(const char* fileName, int nx, int ny, Complex<Real>* complexvalue, int k = -1);
86  void setViewingWindow(bool is_ViewingWindow);
87 protected:
88 
89  // Inner functions
90 
91  void initializeLF();
92  void convertLF2ComplexFieldUsingNonHogelMethod();
93  void makeRandomWField();
94  void makePlaneWaveWField(double thetaX, double thetaY);
95  void fourierTransformOverUVLF();
96  void setBuffer();
97 
98  // ==== GPU Methods ===============================================
99  //void prepareInputdataGPU();
100  //void convertLF2ComplexField_GPU();
101  //void fresnelPropagation_GPU();
102 
103 private:
104 
105  ivec2 num_image;
106  ivec2 resolution_image;
107  Real distanceRS2Holo;
108  Real fieldLens;
109  bool is_ViewingWindow;
110  int nImages;
111  int nBufferX;
112  int nBufferY;
113  uchar** LF;
114  Complex<Real>** FToverUV_LF;
115  Complex<Real>* WField;
116  Complex<Real>* Hologram;
117 
118  // Light Field save parameters
119 
120  const char* LF_directory;
121  const char* ext;
122 };
123 
124 
125 #endif
unsigned char uchar
Definition: typedef.h:64
void setResolImage(ivec2 num)
Definition: ophNonHogelLF.h:35
void setResolImage(int nx, int ny)
Definition: ophNonHogelLF.h:34
float Real
Definition: typedef.h:55
structure for 2-dimensional integer vector and its arithmetic.
Definition: ivec.h:66
#define _Y
Definition: define.h:96
#define _X
Definition: define.h:92
void setNumImage(ivec2 num)
Definition: ophNonHogelLF.h:33
uchar ** getLF()
Definition: ophNonHogelLF.h:42
void setDistRS2Holo(Real dist)
Definition: ophNonHogelLF.h:36
#define GEN_DLL
Definition: ophGen.h:61
virtual ~ophNonHogelLF(void)
Destructor.
Definition: ophNonHogelLF.h:28
ivec2 getResolImage()
Definition: ophNonHogelLF.h:39
Real getFieldLens()
Definition: ophNonHogelLF.h:41
void setNumImage(int nx, int ny)
Definition: ophNonHogelLF.h:32
void setFieldLens(Real lens)
Definition: ophNonHogelLF.h:37
Definition: Bitmap.h:49
Real getDistRS2Holo()
Definition: ophNonHogelLF.h:40
Definition: ophGen.h:76
ivec2 getNumImage()
Definition: ophNonHogelLF.h:38