Function: CONVOLVE Purpose: Convolves data with two dimensional convolution function. Takes care of BLANKs. Category: MATH File: convolve.c Author: K.G. Begeman Use: INTEGER CONVOLVE( CONFIE , Input REAL ARRAY NCONX , Input INTEGER NCONY , Input INTEGER DATIN , Input REAL ARRAY DATOUT , Output REAL ARRAY NDATX , Input INTEGER NDATY ) Input INTEGER CONVOLVE Returns: 0 : succesfull convolution 1 : NDATX < NCONX 2 : NDATY < NCONY 3 : NCONX not an odd number 4 : NCONY not an odd number CONFIE Array containing the convolution function. For a convolution function c(x,y), the function values are stored as follows: CONFIE(K) = c(x,y) where K = (y+(NCONY-1)/2)*NCONX+x+(NCONX-1)/2+1 So the centre of the convolution function is at (NCONY-1)/2 * NCONX + (NCONX-1)/2 + 1, and NCONX and NCONY must be odd. When ever a value in CONFIE is equal to zero it will not be used i.e. BLANKs will not propagate. NCONX Number of pixels along the X axis of the convolution function. NCONY Number of pixels along the Y axis of the convolution function. DATIN Array containing the data to be convolved. The size of DATIN is equalt to NDATX * NDATY. DATOUT Array containing the convolved data. The size of the array is equal to the size of DATIN. DATOUT will contain BLANKs where the convolution is not valid. This can be because of BLANKs in DATIN, or because the distance from the edge is less than (NCONX-1)/2 or (NCONY-1)/2. NDATX Number of pixels along the X axis of the data to be convolved. NDATY Number of pixels along the Y axis of the data to be convolved. Update: Apr 8, 1990: KGB, Document created.