diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/images/tv/imedit/epinput.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/images/tv/imedit/epinput.x')
-rw-r--r-- | pkg/images/tv/imedit/epinput.x | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/pkg/images/tv/imedit/epinput.x b/pkg/images/tv/imedit/epinput.x new file mode 100644 index 00000000..8b8e9c4d --- /dev/null +++ b/pkg/images/tv/imedit/epinput.x @@ -0,0 +1,55 @@ +include "epix.h" + +# EP_INPUT -- Replace aperture by data from original input image. +# The aperture is first centered. + +procedure ep_input (ep, ap, xa, ya, xb, yb) + +pointer ep # EPIX pointer +int ap # Aperture type +int xa, ya, xb, yb # Aperture coordinates + +int i, x1, x2, y1, y2 +pointer mask, indata, im, immap(), imgs2r() + +begin + i = max (5., abs (EP_SEARCH(ep)) + 1) + x1 = min (xa, xb) - i + x2 = max (xa, xb) + i + y1 = min (ya, yb) - i + y2 = max (ya, yb) + i + call ep_gdata (ep, x1, x2, y1, y2) + if (EP_OUTDATA(ep) != NULL) { + call malloc (mask, EP_NPTS(ep), TY_INT) + + call ep_search (ep, Memr[EP_OUTDATA(ep)], EP_NX(ep), + EP_NY(ep), ap, xa, ya, xb, yb) + call ep_mask (ep, mask, ap, xa, ya, xb, yb) + + im = immap (EP_INPUT(ep), READ_ONLY, 0) + indata = imgs2r (im, EP_X1(ep), EP_X2(ep), EP_Y1(ep), EP_Y2(ep)) + call ep_input1 (Memr[indata], Memi[mask], Memr[EP_OUTDATA(ep)], + EP_NPTS(ep)) + call imunmap (im) + + call mfree (mask, TY_INT) + } +end + + +# EP_INPUT1 -- Replace aperture by input data. + +procedure ep_input1 (indata, mask, outdata, npts) + +real indata[npts] # Data subraster +int mask[npts] # Mask subraster +real outdata[npts] # Input buffer data +int npts # Number of points + +int i + +begin + do i = 1, npts + if (mask[i] == 1) + outdata[i] = indata[i] +end |