diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /noao/digiphot/daophot/daolib/dpgsubrast.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/digiphot/daophot/daolib/dpgsubrast.x')
-rw-r--r-- | noao/digiphot/daophot/daolib/dpgsubrast.x | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/noao/digiphot/daophot/daolib/dpgsubrast.x b/noao/digiphot/daophot/daolib/dpgsubrast.x new file mode 100644 index 00000000..6794824b --- /dev/null +++ b/noao/digiphot/daophot/daolib/dpgsubrast.x @@ -0,0 +1,32 @@ +include <imhdr.h> + +# DP_GSUBRAST -- Extract a sub-raster around a specified position such that +# all pixels within the specified radius are included. + +pointer procedure dp_gsubrast (im, x, y, radius, lowx, lowy, nxpix, nypix) + +pointer im # image descriptor +real x,y # position +real radius # radius +int lowx, lowy # lower boundaries of subraster +int nxpix, nypix # number of pixels in subraster + +pointer imgs2r() + +begin + # Determine the boundaries of the area. + lowx = int (x - radius) + 1 + lowy = int (y - radius) + 1 + lowx = max (1, lowx) + lowy = max (1, lowy) + + # Compute the size of the area. + nxpix = min (int (x + radius), IM_LEN(im, 1)) - lowx + 1 + nypix = min (int (y + radius), IM_LEN(im, 2)) - lowy + 1 + + # Return a pointer to the pixel buffer. + if ((nxpix < 1) || (nypix < 1)) + return (NULL) + else + return (imgs2r (im, lowx, lowx + nxpix - 1, lowy, lowy + nypix - 1)) +end |