# vecres -- Performs Resampling on one-dimensional data # # Description: # ------------ # This subroutine accepts the resampling parameters and interpolation # options requested, and does the appropriate resampling. The parameters # are assumed to have been set by the calling routine to suitable # default values if the associated resampling option is not requested. # Note that the order of applying the operations is (as far as the user is # concerned) first translation, then magnification, or reflection. # # # Version Date Author Description # 28-JAN-1993 R. Williamson Converted to SPP # 3 12-APR-1985 D.L.BALL Update due to tester comments # 2 25-AUG-83 PAT MURPHY Code revision - no WNDLOC array # 1 31-JUL-1983 PAT MURPHY Prolog, PDL, FORTRAN code generation procedure vecres ( input, dim, resopt, rflopt, d, deg, badpix, output, outdim) int dim[2], outdim[2], deg # Sizes of input & output images int i, rsign, npts, numerr # Local variables real input[1] # The input vector real output[1] # The output array real badpix # Replacement value for bad pixels real x, size # Local variables double d[2] # (I) Coordinate transform coefficients int resopt # Resampling (interp) option int rflopt # Reflection option string nnb "Warning! Neighbor interpolation used on %d points\n" begin # Initialize # of poly -> NN errors numerr = 0 npts = outdim[1] if (rflopt != 1) { # rflopt options # 1=none # 2=vertical # Set the sign to negative rsign = -1 # and add the size of the array size = float(npts + 1) do i = 1, npts { x = rsign * (float(i) - size) call nnbvec (input, dim[1], x, badpix, output[i]) } # Not simple reflection } else { #Start the calculation. See which interpolation option is wanted. # Polynomial interpolation if (resopt == 2) { # For each element in vector do i = 1, npts { # find equiv position in input x = d[1] + d[2] * float(i) # Input parameters call plyvec (input, dim[1], x, deg, badpix, numerr, output[i]) } # } elseif (resopt == 3) { # cubic spline interp. # # do i = 1, npts { # For each element in vector # # find equiv position in input # x = d[1] + d[2] * float(i) # # call splvec (input, dim[1], x, deg, # Input parameters # badpix, # numerr, output[i]) # and result # # } # # Nearest Neighbor is default } else { # For each element in the row do i = 1, npts { # ! find equiv position in input x = d[1] + d[2] * float(i) # Input parameters call nnbvec (input, dim[1], x, badpix, output[i]) } } } if (numerr != 0) { call eprintf(nnb) call pargi (numerr) } end