Openholo  v3.0
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...
 
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 num)
 Function for setting the wave number. More...
 
void setImageMerge (bool merge)
 Function for setting the image merge(true or false) More...
 
void setImageRotate (bool rotate)
 Function for setting the image rotate(true or false) More...
 
void setImageFlip (int flip)
 Function for setting the image flip. More...
 
void setMaxThreadNum (int num)
 Function for setting the max thread num. More...
 
int getMaxThreadNum ()
 Function for getting the max thread num. More...
 
bool mergeColor (int idx, int width, int height, uchar *src, uchar *dst)
 Function for generate RGB image from each grayscale image. More...
 
bool separateColor (int idx, int width, int height, uchar *src, uchar *dst)
 Function for generate each grayscale image from RGB image. More...
 
- 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)
 Resource release method. More...
 
void fftInit2D (ivec2 size, int sign, unsigned int flag)
 initialize method for 2D FFT More...
 
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
 
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 86 of file Openholo.h.

Constructor & Destructor Documentation

◆ Openholo()

Openholo::Openholo ( void  )
explicit

Constructor.

Definition at line 52 of file Openholo.cpp.

◆ ~Openholo()

Openholo::~Openholo ( void  )
protectedpure virtual

Destructor.

Pure virtual function for class abstraction

Definition at line 73 of file Openholo.cpp.

Member Function Documentation

◆ addComplexFieldDataOHC()

void Openholo::addComplexFieldDataOHC ( const OphComplexField complex_field)
inlineprotected

Definition at line 465 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 459 of file Openholo.h.

◆ addWaveLengthOHC()

void Openholo::addWaveLengthOHC ( const Real  wavelength)
inlineprotected

Definition at line 462 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 86 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.
[out]dstDestination image data.
[in]wImage size, width.
[in]hImage size, Height.
[in]bytesperpixelBytes per pixel.

Definition at line 512 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 528 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 707 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 596 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 630 of file Openholo.cpp.

◆ fftFree()

void Openholo::fftFree ( void  )
protected

Resource release method.

Definition at line 686 of file Openholo.cpp.

◆ fftInit2D()

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

initialize method for 2D FFT

Parameters
[in]sizeNumber of data (int x, int y)
[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 669 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 806 of file Openholo.cpp.

◆ fftShift() [2/3]

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

Definition at line 782 of file Openholo.cpp.

◆ fftShift() [3/3]

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

Definition at line 758 of file Openholo.cpp.

◆ getColorArrangeOHC()

void Openholo::getColorArrangeOHC ( ColorArran color_arrange)
inlineprotected

Definition at line 483 of file Openholo.h.

◆ getColorTypeOHC()

void Openholo::getColorTypeOHC ( ColorType color_type)
inlineprotected

Definition at line 480 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 161 of file Openholo.h.

◆ getComplexFieldDataOHC() [1/2]

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

Definition at line 489 of file Openholo.h.

◆ getComplexFieldDataOHC() [2/2]

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

Definition at line 492 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 170 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 177 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 407 of file Openholo.cpp.

◆ getMaxThreadNum()

int Openholo::getMaxThreadNum ( )

Function for getting the max thread num.

Returns
Type: int
If the currently max thread.

Definition at line 851 of file Openholo.cpp.

◆ getPixelNumberOHC()

void Openholo::getPixelNumberOHC ( ivec2 &  pixel_number)
inlineprotected

Definition at line 468 of file Openholo.h.

◆ getPixelPitchOHC()

void Openholo::getPixelPitchOHC ( vec2 &  pixel_pitch)
inlineprotected

Definition at line 471 of file Openholo.h.

◆ getWaveLengthNumOHC()

void Openholo::getWaveLengthNumOHC ( uint wavelength_num)
inlineprotected

Definition at line 477 of file Openholo.h.

◆ getWavelengthOHC()

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

Definition at line 474 of file Openholo.h.

◆ getWaveLengthUnitOHC()

void Openholo::getWaveLengthUnitOHC ( LenUnit length_unit)
inlineprotected

Definition at line 486 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.
[out]dstDestination image data.
[in]wOriginal width.
[in]hOriginal height.
[in]newwWidth to replace.
[in]newhHeight to replace.

Definition at line 437 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 324 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 357 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, ophGen, ophCascadedPropagation, and ophWaveAberration.

Definition at line 290 of file Openholo.cpp.

◆ mergeColor()

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

Function for generate RGB image from each grayscale image.

Parameters
[in]idx: 0 is red, 1 is green, 2 is blue.
[in]width: Number of pixel - width
[in]height: Number of pixel - height
[in]src: Source of Image file's data - grayscale
[out]dst: Destination of Image file's data - RGB
Returns
Type: bool
If the succeeds to merge image, the return value is true.
If the fails to merge image, the return value is false.

Definition at line 103 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, ophDepthMap, ophWaveAberration, ophLF, and ophRec.

Definition at line 863 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 137 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 262 of file Openholo.cpp.

◆ separateColor()

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

Function for generate each grayscale image from RGB image.

Parameters
[in]idx: 0 is red, 1 is green, 2 is blue.
[in]width: Number of pixel - width
[in]height: Number of pixel - height
[in]src: Source of Image file's data - RGB
[out]dst: Destination of Image file's data - grayscale
Returns
Type: bool
If the succeeds to separate image, the return value is true.
If the fails to separate image, the return value is false.

Definition at line 120 of file Openholo.cpp.

◆ setColorArrangeOHC()

void Openholo::setColorArrangeOHC ( const ColorArran  color_arrange)
inlineprotected

Definition at line 445 of file Openholo.h.

◆ setColorTypeOHC()

void Openholo::setColorTypeOHC ( const ColorType  color_type)
inlineprotected

Definition at line 442 of file Openholo.h.

◆ setFieldEncodingOHC()

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

Definition at line 451 of file Openholo.h.

◆ setImageFlip()

void Openholo::setImageFlip ( int  flip)
inline

Function for setting the image flip.

if flip == 0
not change.
else if flip == 1
vertical change.
else if flipp == 2
horizon tal change.
else B
both.
Parameters
[in]rotate: the value for specifying whether output image flip.

Definition at line 241 of file Openholo.h.

◆ setImageMerge()

void Openholo::setImageMerge ( bool  merge)
inline

Function for setting the image merge(true or false)

if merge == true
One RGB image
else
Each grayscale image 
Parameters
[in]merge: the value for specifying whether output image merge.

Definition at line 215 of file Openholo.h.

◆ setImageRotate()

void Openholo::setImageRotate ( bool  rotate)
inline

Function for setting the image rotate(true or false)

if rotate == true
180 degree rotate.
else
not change. 
Parameters
[in]rotate: the value for specifying whether output image rotate.

Definition at line 226 of file Openholo.h.

◆ setMaxThreadNum()

void Openholo::setMaxThreadNum ( int  num)

Function for setting the max thread num.

Parameters
[in]num: number of max thread.

Definition at line 839 of file Openholo.cpp.

◆ setPhaseEncodingOHC()

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

Definition at line 454 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 183 of file Openholo.h.

◆ setPixelNumber() [2/2]

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

Definition at line 184 of file Openholo.h.

◆ setPixelNumberOHC()

void Openholo::setPixelNumberOHC ( const ivec2  pixel_number)
inlineprotected

getter/setter for OHC file read and write

Definition at line 430 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 190 of file Openholo.h.

◆ setPixelPitch() [2/2]

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

Definition at line 191 of file Openholo.h.

◆ setPixelPitchOHC()

void Openholo::setPixelPitchOHC ( const vec2  pixel_pitch)
inlineprotected

Definition at line 433 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 198 of file Openholo.h.

◆ setWaveLengthNumOHC()

void Openholo::setWaveLengthNumOHC ( const uint  wavelength_num)
inlineprotected

Definition at line 439 of file Openholo.h.

◆ setWavelengthOHC()

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

Definition at line 436 of file Openholo.h.

◆ setWaveLengthUnitOHC()

void Openholo::setWaveLengthUnitOHC ( const LenUnit  length_unit)
inlineprotected

Definition at line 448 of file Openholo.h.

◆ setWaveNum()

void Openholo::setWaveNum ( int  num)

Function for setting the wave number.

Parameters
[in]numNumber of wave/

Definition at line 828 of file Openholo.cpp.

Member Data Documentation

◆ complex_H

Complex<Real>** Openholo::complex_H
protected

Definition at line 418 of file Openholo.h.

◆ context_

OphConfig Openholo::context_
protected

Definition at line 415 of file Openholo.h.

◆ imgCfg

ImageConfig Openholo::imgCfg
protected

Definition at line 416 of file Openholo.h.

◆ OHC_decoder

ImgDecoderOhc* Openholo::OHC_decoder
protected

Definition at line 424 of file Openholo.h.

◆ OHC_encoder

ImgEncoderOhc* Openholo::OHC_encoder
protected

OHC file format Variables for read and write.

Definition at line 423 of file Openholo.h.


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