/* MEXRECON.C Cmex function to do the Keller Reconstraction. The calling syntax is: R = mexrecon(Image, Tip, WaitbarFlag) - Image is the image matrix. - Tip is the matrix conteining the tip z-values. - WaitbarFlag 0 or 1. - R is the reconstracted image. Claudio March 21, 1995 */ #include #include #include "mex.h" #include "matrix.h" /* Input Arguments */ #define M_IN prhs[0] #define M_TIP prhs[1] #define WF prhs[2] /* Output Arguments */ #define M_OUT plhs[0] scan(double *pin, double *ptip, double *pout, int row, int col, int rowtip, int coltip, int flag) { int i, j, rt, ct; Matrix *R, *Ti, *Tr, *D; double *Rpr, *Tipr, *Trpr, *Dpr; char str[48]; R=mxCreateFull((row+rowtip), (col+coltip), REAL); Ti=mxCreateFull(rowtip, coltip, REAL); Tr=mxCreateFull(rowtip, coltip, REAL); D=mxCreateFull(rowtip, coltip, REAL); Rpr =(double *)mxGetPr(R); Tipr=(double *)mxGetPr(Ti); Trpr=(double *)mxGetPr(Tr); Dpr =(double *)mxGetPr(D); for(i=0; i 1) mexErrMsgTxt("MEXRECON requires one output argument."); /* Check the dimensions of M_IN */ row = mxGetM(M_IN); col = mxGetN(M_IN); rowtip = mxGetM(M_TIP); coltip = mxGetN(M_TIP); /* Create a matrix for the return argument */ M_OUT = mxCreateFull(row, col, REAL); /* Assign pointers to the various parameters */ pout = (double *)mxGetPr(M_OUT); pin = (double *)mxGetPr(M_IN); ptip = (double *)mxGetPr(M_TIP); wf = (double *)mxGetPr(WF); wflag=(unsigned int)*wf; /* Do the actual computations in a subroutine */ scan(pin, ptip, pout, row, col, rowtip, coltip, wflag); return; }