Openholo  v1.1
Open Source Digital Holographic Library
ophWaveAberration Class Reference

Wave Aberration module. More...

#include <ophWaveAberration.h>

Inheritance diagram for ophWaveAberration:
Collaboration diagram for ophWaveAberration:

Public Member Functions

 ophWaveAberration ()
 Constructor. More...
 
 ~ophWaveAberration ()
 Destructor. More...
 
bool readConfig (const char *fname)
 read configuration from a configration file More...
 
Real factorial (double x)
 Factorial using recursion. More...
 
void imresize (double **X, int Nx, int Ny, int nx, int ny, double **Y)
 Resizes 2D data using bilinear interpolation. More...
 
double ** calculateZernikePolynomial (double n, double m, vector< double > x, vector< double > y, double d)
 Calculates Zernike polynomial. More...
 
void accumulateZernikePolynomial ()
 Sums up the calculated Zernike polynomials. More...
 
void Free2D (oph::Complex< Real > **doublePtr)
 deletes 2D memory array using double pointer More...
 
void saveAberration (const char *fname)
 saves the 2D data array of a wave aberration into a file More...
 
void readAberration (const char *fname)
 reads the 2D data array of a wave aberration from a file More...
 
virtual bool loadAsOhc (const char *fname)
 Function to read OHC file. More...
 
void ophFree (void)
 Pure virtual function for override in child classes. More...
 
 ophWaveAberration ()
 Constructor. More...
 
 ~ophWaveAberration ()
 Destructor. More...
 
bool readConfig (const char *fname)
 read configuration from a configration file More...
 
Real factorial (double x)
 Factorial using recursion. More...
 
void imresize (double **X, int Nx, int Ny, int nx, int ny, double **Y)
 Resizes 2D data using bilinear interpolation. More...
 
double ** calculateZernikePolynomial (double n, double m, vector< double > x, vector< double > y, double d)
 Calculates Zernike polynomial. More...
 
void accumulateZernikePolynomial ()
 Sums up the calculated Zernike polynomials. More...
 
void Free2D (oph::Complex< Real > **doublePtr)
 deletes 2D memory array using double pointer More...
 
void saveAberration (const char *fname)
 saves the 2D data array of a wave aberration into a file More...
 
void readAberration (const char *fname)
 reads the 2D data array of a wave aberration from a file More...
 
virtual bool loadAsOhc (const char *fname)
 Function to read OHC file. More...
 
void ophFree (void)
 Pure virtual function for override in child classes. More...
 
- Public Member Functions inherited from ophRec
 ophRec (void)
 Constructor. More...
 
void SaveImage (const char *path, const char *ext="bmp")
 
void setConfig (OphRecConfig config)
 
OphRecConfiggetConfig ()
 
bool ReconstructImage ()
 
bool readConfig (const char *fname)
 
bool readImage (const char *path)
 
bool readImagePNA (const char *phase, const char *amplitude)
 
bool readImageRNI (const char *real, const char *imaginary)
 
void Perform_Simulation ()
 
void Initialize ()
 
template<typename T >
void normalize (T *src, uchar *dst, int x, int y)
 
 ophRec (void)
 Constructor. More...
 
void SaveImage (const char *path, const char *ext="bmp")
 
void setConfig (OphRecConfig config)
 
OphRecConfiggetConfig ()
 
bool ReconstructImage ()
 
bool readConfig (const char *fname)
 
bool readImage (const char *path)
 
bool readImagePNA (const char *phase, const char *amplitude)
 
bool readImageRNI (const char *real, const char *imaginary)
 
void Perform_Simulation ()
 
void Initialize ()
 
template<typename T >
void normalize (T *src, uchar *dst, int x, int y)
 
- 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 setPixelNumber (int width, int height)
 
void setPixelPitch (vec2 p)
 Function for setting the output pixel pitch. More...
 
void setPixelPitch (Real pitchX, Real pitchY)
 
void setWaveLength (Real w, const uint idx=0)
 Function for setting the wave length. More...
 
void setMergeImage (bool bMerge)
 
void setWaveNum (int nNum)
 
 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 setPixelNumber (int width, int height)
 
void setPixelPitch (vec2 p)
 Function for setting the output pixel pitch. More...
 
void setPixelPitch (Real pitchX, Real pitchY)
 
void setWaveLength (Real w, const uint idx=0)
 Function for setting the wave length. More...
 
void setMergeImage (bool bMerge)
 
void setWaveNum (int nNum)
 
- 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...
 
 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

oph::uint resolutionX
 
oph::uint resolutionY
 
oph::Complex< Real > ** complex_W
 double pointer of the 2D data array of a wave aberration More...
 

Additional Inherited Members

- Protected Member Functions inherited from ophRec
virtual ~ophRec (void)
 Destructor. More...
 
void GetPupilFieldFromHologram ()
 
void GetPupilFieldFromVWHologram ()
 
void Propagation_Fresnel_FFT (int chnum)
 
void GetPupilFieldImage (Complex< Real > *src, double *dst, int pnx, int pny, double ppx, double ppy, double scaleX, double scaleY)
 
void getVarname (int vtr, vec3 &var_vals, std::string &varname2)
 
virtual ~ophRec (void)
 Destructor. More...
 
void GetPupilFieldFromHologram ()
 
void GetPupilFieldFromVWHologram ()
 
void Propagation_Fresnel_FFT (int chnum)
 
void GetPupilFieldImage (Complex< Real > *src, double *dst, int pnx, int pny, double ppx, double ppy, double scaleX, double scaleY)
 
void getVarname (int vtr, vec3 &var_vals, std::string &varname2)
 
- 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 imgScaleBilinear (uchar *src, uchar *dst, int w, int h, int neww, int newh, int channels=1)
 Function for change image size. More...
 
void ImageRotation (double rotate, uchar *src, uchar *dst, int w, int h, int channels)
 
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, bool bReverse=false)
 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)
 
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 imgScaleBilinear (uchar *src, uchar *dst, int w, int h, int neww, int newh, int channels=1)
 Function for change image size. More...
 
void ImageRotation (double rotate, uchar *src, uchar *dst, int w, int h, int channels)
 
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, bool bReverse=false)
 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...
 
virtual ~Base (void)
 Destructor. 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

Wave Aberration module.

Author
Minsik Park

Definition at line 94 of file ophWaveAberration.h.

Constructor & Destructor Documentation

◆ ophWaveAberration() [1/2]

ophWaveAberration::ophWaveAberration ( )

Constructor.

Definition at line 59 of file ophWaveAberration.cpp.

◆ ~ophWaveAberration() [1/2]

ophWaveAberration::~ophWaveAberration ( )

Destructor.

Definition at line 69 of file ophWaveAberration.cpp.

◆ ophWaveAberration() [2/2]

ophWaveAberration::ophWaveAberration ( )

Constructor.

◆ ~ophWaveAberration() [2/2]

ophWaveAberration::~ophWaveAberration ( )

Destructor.

Member Function Documentation

◆ accumulateZernikePolynomial() [1/2]

void ophWaveAberration::accumulateZernikePolynomial ( )

Sums up the calculated Zernike polynomials.

Definition at line 179 of file ophWaveAberration.cpp.

◆ accumulateZernikePolynomial() [2/2]

void ophWaveAberration::accumulateZernikePolynomial ( )

Sums up the calculated Zernike polynomials.

◆ calculateZernikePolynomial() [1/2]

double ** ophWaveAberration::calculateZernikePolynomial ( double  n,
double  m,
vector< double >  x,
vector< double >  y,
double  d 
)

Calculates Zernike polynomial.

Parameters
norder of the radial term of Zernike polynomial
mfrequency of the sinusoidal component of Zernike polynomial
xresolution in y axis of the exit pupil
yresolution in y axis of the exit pupil
ddiameter of aperture of the exit pupil

Definition at line 75 of file ophWaveAberration.cpp.

◆ calculateZernikePolynomial() [2/2]

double** ophWaveAberration::calculateZernikePolynomial ( double  n,
double  m,
vector< double >  x,
vector< double >  y,
double  d 
)

Calculates Zernike polynomial.

Parameters
norder of the radial term of Zernike polynomial
mfrequency of the sinusoidal component of Zernike polynomial
xresolution in y axis of the exit pupil
yresolution in y axis of the exit pupil
ddiameter of aperture of the exit pupil

◆ factorial() [1/2]

double ophWaveAberration::factorial ( double  x)
inline

Factorial using recursion.

Parameters
xa number of factorial

Definition at line 50 of file ophWaveAberration.cpp.

◆ factorial() [2/2]

Real ophWaveAberration::factorial ( double  x)

Factorial using recursion.

Parameters
xa number of factorial

◆ Free2D() [1/2]

void ophWaveAberration::Free2D ( oph::Complex< Real > **  doublePtr)

deletes 2D memory array using double pointer

◆ Free2D() [2/2]

void ophWaveAberration::Free2D ( oph::Complex< Real > **  doublePtr)

deletes 2D memory array using double pointer

Definition at line 357 of file ophWaveAberration.cpp.

◆ imresize() [1/2]

void ophWaveAberration::imresize ( double **  X,
int  Nx,
int  Ny,
int  nx,
int  ny,
double **  Y 
)

Resizes 2D data using bilinear interpolation.

Parameters
X2D source image
Nxresolution in x axis of source image
Nyresolution in y axis of source image
nxresolution in x axis target image
nyresolution in y axis target image
ny2D target image

Definition at line 150 of file ophWaveAberration.cpp.

◆ imresize() [2/2]

void ophWaveAberration::imresize ( double **  X,
int  Nx,
int  Ny,
int  nx,
int  ny,
double **  Y 
)

Resizes 2D data using bilinear interpolation.

Parameters
X2D source image
Nxresolution in x axis of source image
Nyresolution in y axis of source image
nxresolution in x axis target image
nyresolution in y axis target image
ny2D target image

◆ loadAsOhc() [1/2]

bool ophWaveAberration::loadAsOhc ( const char *  fname)
virtual

Function to read OHC file.

Parameters
[in]fnameFile name
Returns
Type: bool
If the succeeds to load OHC file, the return value is true.
If the fails to load OHC file, the return value is false.

Reimplemented from Openholo.

Definition at line 483 of file ophWaveAberration.cpp.

◆ loadAsOhc() [2/2]

virtual bool ophWaveAberration::loadAsOhc ( const char *  fname)
virtual

Function to read OHC file.

Parameters
[in]fnameFile name
Returns
Type: bool
If the succeeds to load OHC file, the return value is true.
If the fails to load OHC file, the return value is false.

Reimplemented from Openholo.

◆ ophFree() [1/2]

void ophWaveAberration::ophFree ( void  )
virtual

Pure virtual function for override in child classes.

Reimplemented from ophRec.

Definition at line 365 of file ophWaveAberration.cpp.

◆ ophFree() [2/2]

void ophWaveAberration::ophFree ( void  )
virtual

Pure virtual function for override in child classes.

Reimplemented from ophRec.

◆ readAberration() [1/2]

void ophWaveAberration::readAberration ( const char *  fname)

reads the 2D data array of a wave aberration from a file

Parameters
fnamea path name of a file to save a wave aberration

◆ readAberration() [2/2]

void ophWaveAberration::readAberration ( const char *  fname)

reads the 2D data array of a wave aberration from a file

Parameters
fnamea path name of a file to save a wave aberration

Definition at line 471 of file ophWaveAberration.cpp.

◆ readConfig() [1/2]

bool ophWaveAberration::readConfig ( const char *  fname)

read configuration from a configration file

Parameters
fnamea path name of a configration file

◆ readConfig() [2/2]

bool ophWaveAberration::readConfig ( const char *  fname)

read configuration from a configration file

Parameters
fnamea path name of a configration file

Definition at line 372 of file ophWaveAberration.cpp.

◆ saveAberration() [1/2]

void ophWaveAberration::saveAberration ( const char *  fname)

saves the 2D data array of a wave aberration into a file

Parameters
fnamea path name of a file to save a wave aberration

Definition at line 464 of file ophWaveAberration.cpp.

◆ saveAberration() [2/2]

void ophWaveAberration::saveAberration ( const char *  fname)

saves the 2D data array of a wave aberration into a file

Parameters
fnamea path name of a file to save a wave aberration

Member Data Documentation

◆ complex_W

oph::Complex< Real > ** ophWaveAberration::complex_W

double pointer of the 2D data array of a wave aberration

Definition at line 136 of file ophWaveAberration.h.

◆ resolutionX

oph::uint ophWaveAberration::resolutionX
Parameters
resolutionin x axis of the exit pupil

Definition at line 128 of file ophWaveAberration.h.

◆ resolutionY

oph::uint ophWaveAberration::resolutionY
Parameters
resolutionin y axis of the exit pupil

Definition at line 132 of file ophWaveAberration.h.


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