include "register.h" procedure expixv (input, dim, rcentr, rwidth,x, y, status) # expixv -- Extracts locations and values of good pixels from data window # # Description: # ------------ # This subroutine accepts the input vector and window mask, # and will, for a specified subvector size, return the locations # and the values of pixels within the data window. This version # does not handle data windows. # # 27-JAN-1993 R. Williamson Converted to SPP # 5 22-FEB-1984 Pat Murphy Bug removed: wrong indices in loop! # 4 9-JAN-1984 Pat Murphy Eliminate un-necessary loop # 3 30-AUG-1983 PAT MURPHY Cleverer way of scanning mask # 2 22-AUG-1983 PAT MURPHY add PDL and fortran # 1 22-AUG-1983 PAT MURPHY Prolog Generation # # # int dim # (I) Size of input vector int rwidth # (I) Size of output vectors int x[rwidth] # (O) Output positions vector int i, j, first, last, nn # (L) Local variables int status # (O) Returned status real input[dim] # (I) Input vector real rcentr # (I) Location of center of range real y[rwidth] # (O) Output values vector begin # Assume all is ok status = OK # If width is larger than vector, if (rwidth > dim) { # then user is asking too much of this # poor under-rated subroutine, so # quit now on the unscrupulous cretin status = FATAL return } # Get the nearest neighbor pixel nn = int (rcentr + .5) # Figure where to start first = max (1, nn - rwidth/2) # and where we would like to finish last = first + rwidth - 1 # If finish point is beyond bounds then if (last > dim) { # move range down until last point is first = first - (last - dim) # just within the array bounds last = dim } # For each pixel in range of input do i = first, last { # Get position in sub-vectors j = i + 1 - first #Store the position of the pixel x [j] = float [i] #and its value in the sub-vectors y [j] = input [i] } end