Openholo  v2.1
Open Source Digital Holographic Library
Openholo Class Referenceabstract

Abstract class. More...

#include <Openholo.h>

Inheritance diagram for Openholo:
Collaboration diagram for Openholo:

Public Member Functions

 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...
 
virtual bool loadAsOhc (const char *fname)
 Function to read OHC file. More...
 
Complex< Real > ** getComplexField (void)
 Function for getting the complex field. More...
 
Complex< float > ** getComplexfField (void)
 
OphConfiggetContext (void)
 Function for getting the current context. More...
 
ImageConfiggetImageConfig ()
 Function for getting the image config. 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 setWaveNum (int nNum)
 
void setImageMerge (bool bMerge)
 
void setImageRotate (bool rotate)
 
void setImageFlip (int flip)
 
bool getImageRotate ()
 
void SetMaxThreadNum (int num)
 
int GetMaxThreadNum ()
 
bool mergeColor (int idx, int width, int height, uchar *src, uchar *dst)
 
bool separateColor (int idx, int width, int height, uchar *src, uchar *dst)
 
- 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...
 

Protected Member Functions

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 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 fftInit2D (ivec2 size, int sign, unsigned int flag)
 
void fft2 (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 fftShift (int nx, int ny, Complex< Real > *input, fftw_complex *output)
 
void fftShift (int nx, int ny, fftw_complex *input, Complex< Real > *output)
 
virtual void ophFree (void)
 Pure virtual function for override in child classes. 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...
 

Protected Attributes

OphConfig context_
 
ImageConfig imgCfg
 
Complex< Real > ** complex_H
 
Complex< float > ** complexf_H
 
ImgEncoderOhcOHC_encoder
 OHC file format Variables for read and write. More...
 
ImgDecoderOhcOHC_decoder
 
- Protected Attributes inherited from Base
unsigned long refCnt
 

Detailed Description

Abstract class.

Top class of Openholo library. Common functions required by subclasses are implemented.

Author
Kim Ryeon-woo, Nam Min-woo

Definition at line 88 of file Openholo.h.

Constructor & Destructor Documentation

◆ Openholo()

Openholo::Openholo ( void  )
explicit

Constructor.

Definition at line 55 of file Openholo.cpp.

◆ ~Openholo()

Openholo::~Openholo ( void  )
protectedpure virtual

Destructor.

Pure virtual function for class abstraction

Definition at line 77 of file Openholo.cpp.

Member Function Documentation

◆ addComplexFieldDataOHC()

void Openholo::addComplexFieldDataOHC ( const OphComplexField complex_field)
inlineprotected

Definition at line 387 of file Openholo.h.

◆ addWaveLengthNComplexFieldDataOHC()

void Openholo::addWaveLengthNComplexFieldDataOHC ( const Real  wavelength,
const OphComplexField complex_field 
)
inlineprotected

Function to add ComplexField when adding wavelength data.

Definition at line 381 of file Openholo.h.

◆ addWaveLengthOHC()

void Openholo::addWaveLengthOHC ( const Real  wavelength)
inlineprotected

Definition at line 384 of file Openholo.h.

◆ checkExtension()

bool Openholo::checkExtension ( const char *  fname,
const char *  ext 
)
protected

Functions for extension checking.

Parameters
[in]fnameFile name
[in]extFile extension
Returns
Type: bool
If fname contains ext, the return value is true.
If fname not contains ext, the return value is false.

Definition at line 90 of file Openholo.cpp.

◆ convertToFormatGray8()

void Openholo::convertToFormatGray8 ( uchar src,
uchar dst,
int  w,
int  h,
int  bytesperpixel 
)
protected

Function for convert image format to gray8.

Parameters
[in]srcSource image data.
[in]dstDestination image data.
[in]wImage size, width.
[in]hImage size, Height.
[in]bytesperpixelBytes per pixel.

Definition at line 499 of file Openholo.cpp.

◆ fft1()

void Openholo::fft1 ( int  n,
Complex< Real > *  in,
int  sign = OPH_FORWARD,
uint  flag = OPH_ESTIMATE 
)
protected

Functions for performing fftw 1-dimension operations inside Openholo.

Parameters
[in]nNumber of data.
[in]inSource of data.
[in]signSign of FFTW(FORWARD or BACKWARD)
[in]flagFlag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY)

Definition at line 513 of file Openholo.cpp.

◆ fft2() [1/2]

void Openholo::fft2 ( ivec2  n,
Complex< Real > *  in,
int  sign = OPH_FORWARD,
uint  flag = OPH_ESTIMATE 
)
protected

Functions for performing fftw 2-dimension operations inside Openholo.

Parameters
[in]nNumber of data(int x, int y)
[in]inSource of data.
[in]signSign of FFTW(FORWARD or BACKWARD)
[in]flagFlag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY)

◆ fft2() [2/2]

void Openholo::fft2 ( Complex< Real > *  src,
Complex< Real > *  dst,
int  nx,
int  ny,
int  type,
bool  bNormalized = false 
)
protected

Convert data from the spatial domain to the frequency domain using 2D FFT on CPU.

Parameters
[in]srcInput data variable.
[out]dstOutput data variable.
[in]nxthe number of column of the input data.
[in]nythe number of row of the input data.
[in]typeIf type == 1, forward FFT, if type == -1, backward FFT.
[in]bNormalizedIf bNomarlized == true, normalize the result after FFT.

Definition at line 692 of file Openholo.cpp.

◆ fft3()

void Openholo::fft3 ( ivec3  n,
Complex< Real > *  in,
int  sign = OPH_FORWARD,
uint  flag = OPH_ESTIMATE 
)
protected

Functions for performing fftw 3-dimension operations inside Openholo.

Parameters
[in]nNumber of data(int x, int y, int z)
[in]inSource of data.
[in]signSign of FFTW(FORWARD or BACKWARD)
[in]flagFlag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY)

Definition at line 581 of file Openholo.cpp.

◆ fftExecute()

void Openholo::fftExecute ( Complex< Real > *  out,
bool  bReverse = false 
)
protected

Execution functions to be called after fft1, fft2, and fft3.

Parameters
[out]outDest of data.

Definition at line 615 of file Openholo.cpp.

◆ fftFree()

void Openholo::fftFree ( void  )
protected

Definition at line 671 of file Openholo.cpp.

◆ fftInit2D()

void Openholo::fftInit2D ( ivec2  size,
int  sign,
unsigned int  flag 
)
protected

Definition at line 654 of file Openholo.cpp.

◆ fftShift() [1/3]

void Openholo::fftShift ( int  nx,
int  ny,
Complex< Real > *  input,
Complex< Real > *  output 
)
protected

Swap the top-left quadrant of data with the bottom-right , and the top-right quadrant with the bottom-left.

Parameters
[in]nxthe number of column of the input data.
[in]nythe number of row of the input data.
[in]inputinput data variable.
[out]outputoutput data variable.

Definition at line 791 of file Openholo.cpp.

◆ fftShift() [2/3]

void Openholo::fftShift ( int  nx,
int  ny,
Complex< Real > *  input,
fftw_complex *  output 
)
protected

Definition at line 767 of file Openholo.cpp.

◆ fftShift() [3/3]

void Openholo::fftShift ( int  nx,
int  ny,
fftw_complex *  input,
Complex< Real > *  output 
)
protected

Definition at line 743 of file Openholo.cpp.

◆ getColorArrangeOHC()

void Openholo::getColorArrangeOHC ( ColorArran color_arrange)
inlineprotected

Definition at line 405 of file Openholo.h.

◆ getColorTypeOHC()

void Openholo::getColorTypeOHC ( ColorType color_type)
inlineprotected

Definition at line 402 of file Openholo.h.

◆ getComplexfField()

Complex<float>** Openholo::getComplexfField ( void  )
inline

Definition at line 164 of file Openholo.h.

◆ getComplexField()

Complex<Real>** Openholo::getComplexField ( void  )
inline

Function for getting the complex field.

Returns
Type: Complex<Real>**
If the succeeds to get complex field, the return value is complex field data's pointer.
If the fails to get complex field, the return value is nullptr.

Definition at line 163 of file Openholo.h.

◆ getComplexFieldDataOHC() [1/2]

void Openholo::getComplexFieldDataOHC ( Complex< Real > **  cmplx,
uint  wavelen_idx 
)
inlineprotected

Definition at line 411 of file Openholo.h.

◆ getComplexFieldDataOHC() [2/2]

void Openholo::getComplexFieldDataOHC ( OphComplexField cmplx,
uint  wavelen_idx 
)
inlineprotected

Definition at line 414 of file Openholo.h.

◆ getContext()

OphConfig& Openholo::getContext ( void  )
inline

Function for getting the current context.

Returns
Type: OphConfig&
If the succeeds to get context, the return value is cotext pointer.
If the fails to get context, the return value is nullptr.

Definition at line 173 of file Openholo.h.

◆ getImageConfig()

ImageConfig& Openholo::getImageConfig ( )
inline

Function for getting the image config.

Returns
Type: ImageConfig
The return value is Image config pointer.

Definition at line 180 of file Openholo.h.

◆ getImageRotate()

bool Openholo::getImageRotate ( )
inline

Definition at line 208 of file Openholo.h.

◆ getImgSize()

bool Openholo::getImgSize ( int &  w,
int &  h,
int &  bytesperpixel,
const char *  fname 
)
protected

Function for getting the image size.

Parameters
[out]wImage size - width.
[out]hImage size - Height.
[out]bytesperpixelBytes per pixel.
[in]fnameInput file name.
Returns
Type: bool
If the function succeeds, the return value is true.
If the function fails, the return value is false.

Definition at line 389 of file Openholo.cpp.

◆ GetMaxThreadNum()

int Openholo::GetMaxThreadNum ( )

Definition at line 833 of file Openholo.cpp.

◆ getPixelNumberOHC()

void Openholo::getPixelNumberOHC ( ivec2 &  pixel_number)
inlineprotected

Definition at line 390 of file Openholo.h.

◆ getPixelPitchOHC()

void Openholo::getPixelPitchOHC ( vec2 &  pixel_pitch)
inlineprotected

Definition at line 393 of file Openholo.h.

◆ getWaveLengthNumOHC()

void Openholo::getWaveLengthNumOHC ( uint wavelength_num)
inlineprotected

Definition at line 399 of file Openholo.h.

◆ getWavelengthOHC()

void Openholo::getWavelengthOHC ( vector< Real > &  wavelength)
inlineprotected

Definition at line 396 of file Openholo.h.

◆ getWaveLengthUnitOHC()

void Openholo::getWaveLengthUnitOHC ( LenUnit length_unit)
inlineprotected

Definition at line 408 of file Openholo.h.

◆ imgScaleBilinear()

void Openholo::imgScaleBilinear ( uchar src,
uchar dst,
int  w,
int  h,
int  neww,
int  newh,
int  channels = 1 
)
protected

Function for change image size.

Parameters
[in]srcSource image data.
[in]dstDestination image data.
[in]wOriginal width.
[in]hOriginal height.
[in]newwWidth to replace.
[in]newhHeight to replace.

Definition at line 420 of file Openholo.cpp.

◆ loadAsImg()

uchar * Openholo::loadAsImg ( const char *  fname)
virtual

Function for loading image files.

Parameters
[in]fnameInput file name
Returns
Type: uchar*
If the succeeds to load image file, the return value is image data' pointer.
If the fails to load image file, the return value is nullptr.

Definition at line 270 of file Openholo.cpp.

◆ loadAsImgUpSideDown()

bool Openholo::loadAsImgUpSideDown ( const char *  fname,
uchar dst 
)
protected

Function for loading image files | Output image data upside down.

Parameters
[in]Inputfile name.
[out]destinationto load.
Returns
Type: bool
If the function succeeds, the return value is true.
If the function fails, the return value is false.

Definition at line 347 of file Openholo.cpp.

◆ loadAsOhc()

bool Openholo::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 in ophSig, ophCascadedPropagation, ophWaveAberration, and ophGen.

Definition at line 321 of file Openholo.cpp.

◆ mergeColor()

bool Openholo::mergeColor ( int  idx,
int  width,
int  height,
uchar src,
uchar dst 
)

Definition at line 107 of file Openholo.cpp.

◆ ophFree()

void Openholo::ophFree ( void  )
protectedvirtual

Pure virtual function for override in child classes.

Implements Base.

Reimplemented in ophGen, ophSig, ophCascadedPropagation, ophWaveAberration, ophDepthMap, ophLF, and ophRec.

Definition at line 845 of file Openholo.cpp.

◆ saveAsImg()

bool Openholo::saveAsImg ( const char *  fname,
uint8_t  bitsperpixel,
uchar src,
int  width,
int  height 
)
virtual

Function for creating image files.

Parameters
[in]fnameOutput file name
[in]bitsperpixelBit per pixel
[in]srcSource of Image file's data
[in]widthNumber of pixel - width
[in]heightNumber of pixel - height
Returns
Type: bool
If the succeeds to save image file, the return value is true.
If the fails to save image file, the return value is false.

Definition at line 141 of file Openholo.cpp.

◆ saveAsOhc()

bool Openholo::saveAsOhc ( const char *  fname)
virtual

Function to write OHC file

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

Reimplemented in ophSig, and ophCascadedPropagation.

Definition at line 300 of file Openholo.cpp.

◆ separateColor()

bool Openholo::separateColor ( int  idx,
int  width,
int  height,
uchar src,
uchar dst 
)

Definition at line 124 of file Openholo.cpp.

◆ setColorArrangeOHC()

void Openholo::setColorArrangeOHC ( const ColorArran  color_arrange)
inlineprotected

Definition at line 367 of file Openholo.h.

◆ setColorTypeOHC()

void Openholo::setColorTypeOHC ( const ColorType  color_type)
inlineprotected

Definition at line 364 of file Openholo.h.

◆ setFieldEncodingOHC()

void Openholo::setFieldEncodingOHC ( const FldStore  field_store,
const FldCodeType  field_code_type 
)
inlineprotected

Definition at line 373 of file Openholo.h.

◆ setImageFlip()

void Openholo::setImageFlip ( int  flip)
inline

Definition at line 207 of file Openholo.h.

◆ setImageMerge()

void Openholo::setImageMerge ( bool  bMerge)
inline

Definition at line 205 of file Openholo.h.

◆ setImageRotate()

void Openholo::setImageRotate ( bool  rotate)
inline

Definition at line 206 of file Openholo.h.

◆ SetMaxThreadNum()

void Openholo::SetMaxThreadNum ( int  num)

Definition at line 824 of file Openholo.cpp.

◆ setPhaseEncodingOHC()

void Openholo::setPhaseEncodingOHC ( const BPhaseCode  phase_code,
const vec2  phase_code_range 
)
inlineprotected

Definition at line 376 of file Openholo.h.

◆ setPixelNumber() [1/2]

void Openholo::setPixelNumber ( ivec2  n)
inline

Function for setting the output resolution.

Parameters
[in]nresolution vector value.

Definition at line 186 of file Openholo.h.

◆ setPixelNumber() [2/2]

void Openholo::setPixelNumber ( int  width,
int  height 
)
inline

Definition at line 187 of file Openholo.h.

◆ setPixelNumberOHC()

void Openholo::setPixelNumberOHC ( const ivec2  pixel_number)
inlineprotected

getter/setter for OHC file read and write

Definition at line 352 of file Openholo.h.

◆ setPixelPitch() [1/2]

void Openholo::setPixelPitch ( vec2  p)
inline

Function for setting the output pixel pitch.

Parameters
[in]ppitch vector value.

Definition at line 193 of file Openholo.h.

◆ setPixelPitch() [2/2]

void Openholo::setPixelPitch ( Real  pitchX,
Real  pitchY 
)
inline

Definition at line 194 of file Openholo.h.

◆ setPixelPitchOHC()

void Openholo::setPixelPitchOHC ( const vec2  pixel_pitch)
inlineprotected

Definition at line 355 of file Openholo.h.

◆ setWaveLength()

void Openholo::setWaveLength ( Real  w,
const uint  idx = 0 
)
inline

Function for setting the wave length.

Parameters
[in]wwave length.
[in]idxindex of channel.

Definition at line 201 of file Openholo.h.

◆ setWaveLengthNumOHC()

void Openholo::setWaveLengthNumOHC ( const uint  wavelength_num)
inlineprotected

Definition at line 361 of file Openholo.h.

◆ setWavelengthOHC()

void Openholo::setWavelengthOHC ( const Real  wavelength,
const LenUnit  wavelength_unit 
)
inlineprotected

Definition at line 358 of file Openholo.h.

◆ setWaveLengthUnitOHC()

void Openholo::setWaveLengthUnitOHC ( const LenUnit  length_unit)
inlineprotected

Definition at line 370 of file Openholo.h.

◆ setWaveNum()

void Openholo::setWaveNum ( int  nNum)

Definition at line 813 of file Openholo.cpp.

Member Data Documentation

◆ complex_H

Complex<Real>** Openholo::complex_H
protected

Definition at line 339 of file Openholo.h.

◆ complexf_H

Complex<float>** Openholo::complexf_H
protected

Definition at line 340 of file Openholo.h.

◆ context_

OphConfig Openholo::context_
protected

Definition at line 336 of file Openholo.h.

◆ imgCfg

ImageConfig Openholo::imgCfg
protected

Definition at line 337 of file Openholo.h.

◆ OHC_decoder

ImgDecoderOhc* Openholo::OHC_decoder
protected

Definition at line 346 of file Openholo.h.

◆ OHC_encoder

ImgEncoderOhc* Openholo::OHC_encoder
protected

OHC file format Variables for read and write.

Definition at line 345 of file Openholo.h.


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