56 #define SIG_DLL __declspec(dllexport) 58 #define SIG_DLL __declspec(dllimport) 62 #define SIG_DLL __attribute__((visibility("default"))) 482 virtual ~
ophSig(
void) =
default;
503 bool sigConvertOffaxis_CPU(
Real angleX,
Real angleY);
511 bool sigConvertOffaxis_GPU(
Real angleX,
Real angleY);
538 bool sigConvertCAC_CPU(
double red,
double green,
double blue);
547 bool sigConvertCAC_GPU(
double red,
double green,
double blue);
553 double sigGetParamAT_CPU();
559 double sigGetParamAT_GPU();
569 double sigGetParamSF_CPU(
float zMax,
float zMin,
int sampN,
float th);
579 double sigGetParamSF_GPU(
float zMax,
float zMin,
int sampN,
float th);
586 bool propagationHolo_CPU(
float depth);
592 bool propagationHolo_GPU(
float depth);
594 bool Color_propagationHolo_GPU(
float depth);
606 bool load(
const char *real,
const char *imag);
613 bool save(
const char *real,
const char *imag);
614 bool save(
const char *real);
636 void linInterp(vector<T> &X, matrix<Complex<T>> &src, vector<T> &Xq, matrix<Complex<T>> &dst);
646 vector<Real> result(len);
647 Real step = (last - first) / (len - 1);
648 for (
int i = 0; i < len; i++) { result[i] = first + i * step; }
657 void absMat(matrix<Complex<T>>& src, matrix<T>& dst) {
658 if (src.size != dst.size) {
659 dst.resize(src.size[
_X], src.size[
_Y]);
661 for (
int i = 0; i < src.size[
_X]; i++)
663 for (
int j = 0; j < src.size[
_Y]; j++)
665 dst.mat[i][j] = sqrt(src.mat[i][j][
_RE] * src.mat[i][j][
_RE] + src.mat[i][j][
_IM] * src.mat[i][j][
_IM]);
675 void absMat(matrix<T>& src, matrix<T>& dst) {
676 if (src.size != dst.size) {
677 dst.resize(src.size[
_X], src.size[
_Y]);
679 for (
int i = 0; i < src.size[
_X]; i++)
681 for (
int j = 0; j < src.size[
_Y]; j++)
683 dst.mat[i][j] =
abs(src.mat[i][j]);
693 void angleMat(matrix<Complex<T>>& src, matrix<T>& dst) {
694 if (src.size != dst.size) {
695 dst.resize(src.size[
_X], src.size[
_Y]);
697 for (
int i = 0; i < src.size[
_X]; i++)
699 for (
int j = 0; j < src.size[
_Y]; j++)
701 angle(src(i, j), dst(i, j));
711 void conjMat(matrix<Complex<T>>& src, matrix<Complex<T>>& dst) {
712 if (src.size != dst.size) {
713 dst.resize(src.size[
_X], src.size[
_Y]);
715 for (
int i = 0; i < src.size[
_X]; i++)
717 for (
int j = 0; j < src.size[
_Y]; j++)
719 dst(i, j) = src(i, j).conj();
730 void expMat(matrix<Complex<T>>& src, matrix<Complex<T>>& dst) {
731 if (src.size != dst.size) {
732 dst.resize(src.size[
_X], src.size[
_Y]);
734 for (
int i = 0; i < src.size[
_X]; i++)
736 for (
int j = 0; j < src.size[
_Y]; j++)
738 dst.mat[i][j][
_RE] = exp(src.mat[i][j][
_RE]) * cos(src.mat[i][j][
_IM]);
739 dst.mat[i][j][
_IM] = exp(src.mat[i][j][
_RE]) * sin(src.mat[i][j][
_IM]);
749 void expMat(matrix<T>& src, matrix<T>& dst) {
750 if (src.size != dst.size) {
751 dst.resize(src.size[
_X], src.size[
_Y]);
753 for (
int i = 0; i < src.size[
_X]; i++)
755 for (
int j = 0; j < src.size[
_Y]; j++)
757 dst.mat[i][j] = exp(src.mat[i][j]);
769 for (
int i = 0; i < src.size[
_X]; i++)
771 for (
int j = 0; j < src.size[
_Y]; j++)
776 dst = dst / (src.size[
_X] * src.size[
_Y]);
785 for (
int i = 0; i < src.size[
_X]; i++)
787 for (
int j = 0; j < src.size[
_Y]; j++)
789 if (src(i, j) > max) max = src(i, j);
802 for (
int i = 0; i < src.size[
_X]; i++)
804 for (
int j = 0; j < src.size[
_Y]; j++)
806 if (src(i, j)[
_RE] > max) max = src(i, j)[
_RE];
819 for (
int i = 0; i < src.size[
_X]; i++)
821 for (
int j = 0; j < src.size[
_Y]; j++)
823 if (src(i, j) < min) min = src(i, j);
832 Complex<Real>
minOfMat(matrix<Complex<Real>>& src) {
834 for (
int i = 0; i < src.size[
_X]; i++)
836 for (
int j = 0; j < src.size[
_Y]; j++)
838 if (src(i, j)[
_RE] < min) min = src(i, j)[
_RE];
849 void fftShift(matrix<Complex<Real>> &src, matrix<Complex<Real>> &dst)
851 if (src.size != dst.size) {
852 dst.resize(src.size[
_X], src.size[
_Y]);
854 int xshift = src.size[
_X] / 2;
855 int yshift = src.size[
_Y] / 2;
856 for (
int i = 0; i < src.size[
_X]; i++)
858 int ii = (i + xshift) % src.size[
_X];
859 for (
int j = 0; j < src.size[
_Y]; j++)
861 int jj = (j + yshift) % src.size[
_Y];
862 dst.mat[ii][jj][
_RE] = src.mat[i][j].real();
863 dst.mat[ii][jj][
_IM] = src.mat[i][j].imag();
891 bool readConfig(
const char* fname);
892 void Parameter_Set(
int nx,
int ny,
double width,
double height ,
double NA );
893 void wavelength_Set(
double wavelength);
894 void focal_length_Set(
double red ,
double green,
double blue,
double rad);
895 void Data_output(
uchar *data,
int pos ,
int bitpixel);
896 void Wavenumber_output(
int &wavenumber);
905 bool sigConvertOffaxis(
Real angleX,
Real angleY);
906 bool cvtOffaxis_CPU(
Real angleX,
Real angleY);
907 void cvtOffaxis_GPU(
Real angleX,
Real angleY);
928 bool sigConvertCAC(
double red,
double green,
double blue);
935 bool propagationHolo(
float depth);
949 double sigGetParamAT();
960 double sigGetParamSF(
float zMax,
float zMin,
int sampN,
float th);
966 void setMode(
bool is_CPU);
974 void cField2Buffer(matrix<Complex<Real>>& src, Complex<Real> **dst,
int nx,
int ny);
983 void ColorField2Buffer(matrix<Complex<Real>>& src, Complex<Real> **dst,
int nx,
int ny);
992 bool getComplexHFromPSDH(
const char* fname0,
const char* fname90,
const char* fname180,
const char* fname270);
1003 bool getComplexHFrom3ArbStepPSDH(
const char* f0,
const char* f1,
const char* f2,
const char* fOI,
const char* fRI,
int nIter);
1007 #endif // !__ophSig_h Complex< Real > maxOfMat(matrix< Complex< Real >> &src)
Function for extracts maximum of matrix , where matrix is complex number.
oph::matrix< Complex< Real > > OphComplexField
void abs(const oph::Complex< T > &src, oph::Complex< T > &dst)
void angleMat(matrix< Complex< T >> &src, matrix< T > &dst)
Function for extracts Complex phase value.
void meanOfMat(matrix< T > &src, T &dst)
Function for extracts mean of matrix.
void conjMat(matrix< Complex< T >> &src, matrix< Complex< T >> &dst)
Function for extracts Complex conjugate value.
Complex< Real > minOfMat(matrix< Complex< Real >> &src)
Function for extracts minimum of matrix , where matrix is complex number.
void expMat(matrix< Complex< T >> &src, matrix< Complex< T >> &dst)
Function for extracts exponent e(x), where x is complex number.
OphComplexField * ComplexH
void fft2(ivec2 n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
Functions for performing fftw 2-dimension operations inside Openholo.
void absMat(matrix< T > &src, matrix< T > &dst)
Function for extracts real absolute value.
void fftShift(matrix< Complex< Real >> &src, matrix< Complex< Real >> &dst)
Shift zero-frequency component to center of spectrum.
void absMat(matrix< Complex< T >> &src, matrix< T > &dst)
Function for extracts Complex absolute value.
virtual bool loadAsOhc(const char *fname)
Function to read OHC file.
Real minOfMat(matrix< Real > &src)
Function for extracts minimum of matrix , where matrix is real number.
void expMat(matrix< T > &src, matrix< T > &dst)
Function for extracts exponent e(x), where x is real number.
void angle(const std::vector< Complex< T >> &src, std::vector< T > &dst)
virtual bool saveAsOhc(const char *fname)
Function to write OHC file
Real maxOfMat(matrix< Real > &src)
Function for extracts maximum of matrix , where matrix is real number.
void fft1(int n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE)
Functions for performing fftw 1-dimension operations inside Openholo.
vector< T > linspace(T first, T last, int len)
Generate linearly spaced vector.
virtual void ophFree(void)
Pure virtual function for override in child classes.