# nnbimg -- Return the value of the nearest neighbor pixel # # Description: # ------------ # This module returns the value of the nearest neighbor pixel in the # input data window, given an x and y co-ordinate in the reference # frame of the input file. These co-ordinates should be in pixels. # This version handles both cases (with, without mask) assuming the # input has been "squished". # # Version Date Author Description # 27-JAN-1993 RAY WILLIAMSON Convert to SPP # 3 30-AUG-1983 PAT MURPHY Generalize code # 2 5-AUG-1983 PAT MURPHY Add PDL and FORTRAN code # 1 5-AUG-1983 PAT MURPHY Prolog Generation procedure nnbimg ( xcoord, ycoord, input, dim1,dim2, badpix, result) int dim1, dim2 # The size of the input image int i,j # Local temporary variables real input[dim1,dim2] # The input image real xcoord, ycoord # The location in the input image real badpix, result # Fill value and the result begin # Assume point is outside window result = badpix # Get nearest integers to coordinate i = int (.5 + xcoord) j = int (.5 + ycoord) # Check if the requested point is within the data window if (i > 0 && j > 0 && i <= dim1 && j <= dim2) { result = input[i,j] } end