53 , is_ViewingWindow(false)
56 LOG(
"*** POINT CLOUD : BUILD DATE: %s %s ***\n\n", __DATE__, __TIME__);
61 , is_ViewingWindow(false)
64 LOG(
"*** POINT CLOUD : BUILD DATE: %s %s ***\n\n", __DATE__, __TIME__);
65 if (
loadPointCloud(pc_file) == -1) LOG(
"<FAILED> Load point cloud data file(\'%s\')", pc_file);
66 if (!
readConfig(cfg_file)) LOG(
"<FAILED> Load config specification data file(\'%s\')", cfg_file);
80 this->is_ViewingWindow = is_ViewingWindow;
98 LOG(
"<FAILED> Wrong file ext.\n");
103 LOG(
"<FAILED> Loading file (%d)\n", error);
109 char szNodeName[32] = { 0, };
110 sprintf(szNodeName,
"ScaleX");
113 if (!next ||
XML_SUCCESS != next->QueryDoubleText(&pc_config_.scale[
_X]))
115 LOG(
"<FAILED> Not found node : \'%s\' (Double) \n", szNodeName);
118 sprintf(szNodeName,
"ScaleY");
120 if (!next ||
XML_SUCCESS != next->QueryDoubleText(&pc_config_.scale[
_Y]))
122 LOG(
"<FAILED> Not found node : \'%s\' (Double) \n", szNodeName);
125 sprintf(szNodeName,
"ScaleZ");
127 if (!next ||
XML_SUCCESS != next->QueryDoubleText(&pc_config_.scale[
_Z]))
129 LOG(
"<FAILED> Not found node : \'%s\' (Double) \n", szNodeName);
132 sprintf(szNodeName,
"Distance");
134 if (!next ||
XML_SUCCESS != next->QueryDoubleText(&pc_config_.distance))
136 LOG(
"<FAILED> Not found node : \'%s\' (Double) \n", szNodeName);
142 LOG(
"**************************************************\n");
143 LOG(
" Read Config (Point Cloud) \n");
144 LOG(
"1) Focal Length : %.5lf\n", pc_config_.distance);
145 LOG(
"2) Object Scale : %.5lf / %.5lf / %.5lf\n", pc_config_.scale[
_X], pc_config_.scale[
_Y], pc_config_.scale[
_Z]);
146 LOG(
"**************************************************\n");
155 LOG(
"<FAILED> Wrong parameters.");
160 LOG(
"**************************************************\n");
161 LOG(
" Generate Hologram \n");
162 LOG(
"1) Algorithm Method : Point Cloud\n");
171 LOG(
"3) Diffraction Method : %s\n", diff_flag ==
PC_DIFF_RS ?
"R-S" :
"Fresnel");
172 LOG(
"4) Number of Point Cloud : %llu\n", pc_data_.
n_points);
173 LOG(
"5) Precision Level : %s\n",
m_mode &
MODE_FLOAT ?
"Single" :
"Double");
176 LOG(
"**************************************************\n");
180 genCghPointCloudGPU(diff_flag);
183 genCghPointCloudCPU(diff_flag);
188 LOG(
"Total Elapsed Time: %.5lf (s)\n", elapsed_time);
196 LOG(
"<FAILED> Not found diffracted data.");
205 const long long int pnXY = pnX * pnY;
212 Real halfppX = ppX / 2;
213 Real halfssX = ss[
_X] / 2;
217 for (
uint ch = 0; ch < nChannel; ch++) {
224 for (
int i = 0; i < pnXY; i++)
230 Real y = (ss[
_Y] - ppY) - (ppY *
h);
231 Real Y = (
M_PI * y * spectrum_shift[
_Y]) / ppY;
232 Real x = -halfssX + ppX *
w + halfppX;
233 Real X = (
M_PI * x * spectrum_shift[
_X]) / ppX;
235 shift_phase[
_RE] = shift_phase[
_RE] * (cos(X) * cos(Y) - sin(X) * sin(Y));
236 m_lpEncoded[ch][i] = (tmp[i] * shift_phase).real();
253 void ophPointCloud::genCghPointCloudCPU(
uint diff_flag)
282 Vertex *pVertex =
nullptr;
283 if (is_ViewingWindow) {
292 for (
uint ch = 0; ch < nChannel; ++ch) {
297 #pragma omp parallel for firstprivate(lambda) 299 for (
int i = 0; i < n_points; ++i) {
322 m_nProgress = (int)((
Real)
sum * 100 / ((
Real)n_points * nChannel));
325 if (is_ViewingWindow) {
331 void ophPointCloud::ophFree(
void)
void RS_Diffraction(Point src, Complex< Real > *dst, Real lambda, Real distance, Real amplitude)
RS-diffraction method.
Real distance
Offset value of point cloud.
ulonglong n_points
Number of points.
vec2 tilt_angle
Tilt angle for spatial filtering.
void initialize(void)
Initialize variables for Hologram complex field, encoded data, normalized data.
bool checkExtension(const char *fname, const char *ext)
Functions for extension checking.
structure for 2-dimensional integer vector and its arithmetic.
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
void encodeHologram(vec2 band_limit=vec2(0.8, 0.5), vec2 spectrum_shift=vec2(0.0, 0.5))
encode Single-side band
vec3 scale
Scaling factor of coordinate of point cloud.
ivec2 m_vecEncodeSize
Encoded hologram size, varied from encoding type.
int loadPointCloud(const char *pc_file)
override
bool readConfig(const char *cfg_file)
Import Specification Config File(*.config) file.
Real ** m_lpEncoded
buffer to encoded.
virtual ~ophPointCloud(void)
Destructor.
void fft2(ivec2 n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
Functions for performing fftw 2-dimension operations inside Openholo.
ophPointCloud(void)
Constructor.
structure for 2-dimensional Real type vector and its arithmetic.
void setViewingWindow(bool is_ViewingWindow)
Set the value of a variable is_ViewingWindow(true or false)
SSB_PASSBAND
Passband in Single-side band encoding.
bool readConfig(const char *fname)
load to configuration file.
XMLError LoadFile(const char *filename)
Vertex * vertices
Data of point clouds.
Complex< Real > ** complex_H
void resetBuffer()
reset buffer
#define ELAPSED_TIME(x, y)
void Fresnel_Diffraction(Point src, Complex< Real > *dst, Real lambda, Real distance, Real amplitude)
Fresnel-diffraction method.
Real generateHologram(uint diff_flag=PC_DIFF_RS)
Generate a hologram, main funtion.
void transVW(int nVertex, Vertex *dst, Vertex *src)
int loadPointCloud(const char *pc_file, OphPointCloudData *pc_data_)
load to point cloud data.
const XMLElement * FirstChildElement(const char *name=0) const