/************************ * This routine provides interpolation for VIS images * Interpolation is done as nearest neighbour averagubg. * This is written in C for efficiency issues and should * be loaded as an IDL DLM * * IDL interface: * result = DICal_VISInterp(imgIn, toInterp, badPixs) * * INPUTS: * imgIn - Image array to work on * toInterp - An array of indicies of pixels to be interpolated over. Must be * ordered * badPixs - An array of indicies of invalid pixels. Must be ordered * * RETURNS: * A double array with the pixels interpolated over * * MODIFICATIONS: * Feb 13, 2005 Mark Desnoyer - Created * *************************/ #include "dical_visinterpolate.h" // Actual Interpolation routine IDL_VPTR DICal_VISInterp(int argc, IDL_VPTR argv[]) { IDL_VPTR imgIn, imgOut, toInterp, badPixs; double *in, *out; IDL_INT *toDo, *bad; int imgWid, doCnt, badCnt; int i,j,n,m; // Allocate the input variables imgIn = imgOut = argv[0]; toInterp = argv[1]; badPixs = argv[2]; if(interpCheckParams(imgIn, &imgOut, toInterp, badPixs, &in, &out, &imgWid, &toDo, &doCnt, &bad, &badCnt)) return imgIn; // Create the output image m = imgOut->value.arr->n_elts; for (i=0;i<m;i++){ // If we need to interpolate if (*toDo == i){ toDo++; out[i] = 0; // Find the distance to each pixel // Max out the distance for bad pixels // Find the least distance pixels and average them } else // Copy the value out[i] = in[i]; } return imgOut; }