#include "mex.h" #include #include #include #include #define index(A,B,C,DIM) ((C)*DIM[0]*DIM[1] + (B)*DIM[0] + (A)) #ifndef PI #define PI 3.14159265358979 #endif #ifndef MIN #define MIN(A,B) ((A) > (B) ? (B) : (A)) #endif #ifndef MAX #define MAX(A,B) ((A) > (B) ? (A) : (B)) #endif void restore_ramps(double *mask, mwSize dim[3], double ramp[3], double *pm) { mwIndex i=0, j=0, k=0; mwIndex ii=0; for (i=0; i 3)) { mexErrMsgTxt("pm_restore_ramp: pm must be 2 or 3-dimensional"); } cdim = mxGetDimensions(prhs[0]); pm = mxGetPr(prhs[0]); /* Get mask. */ if (!mxIsNumeric(prhs[1]) || mxIsComplex(prhs[1]) || mxIsSparse(prhs[1]) || !mxIsDouble(prhs[1])) { mexErrMsgTxt("pm_restore_ramp: mask must be numeric, real, full and double"); } mask_ndim = mxGetNumberOfDimensions(prhs[1]); if (mask_ndim != ndim) { mexErrMsgTxt("pm_restore_ramp: pm and mask must have same dimensionality"); } mask_cdim = mxGetDimensions(prhs[1]); for (i=0; i