- 37 -
# Prompt for the other query parameters
intcpt = intercept
slp = slope
# Read the image headers and compute the scalar sums
ilist = ifile; xlist = xfile
while (fscan (ilist, img) != EOF) {
# Temporary images, 1 per input image
print (mktemp ("tmp$imf"), >> tfile)
hselect (img, keyword, yes, >> xfile)
if (fscan (xlist, x) != 1)
error (1, "Keyword ‘" // keyword // "’ not found in " // img)
sumx += x
sumx2 += x ∗ x
nimg += 1
}
ilist = ""; xlist = ""
delta = nimg ∗ sumx2 - sumx ∗ sumx
# Calculate SUMY
imcombine ("@" // ifile, sumy, option="sum", outtype="real",
logfile="", exposure-, scale-, offset-, weight-)
# Calculate SUMXY
imarith ("@" // ifile, "∗", "@" // xfile, "@" // tfile,
pixtype="real", calctype="real", verbose-, noact-)
imcombine ("@" // tfile, sumxy, option="sum", outtype="real",
logfile="", exposure-, scale-, offset-, weight-)
imdelete ("@" // tfile, ver-, >& "dev$null")
# Calculate the intercept
imarith (sumy, "∗", sumx2, tmp1, pix="r", calc="r", verb-, noact-)
imarith (sumxy, "∗", sumx, tmp2, pix="r", calc="r", verb-, noact-)
imarith (tmp1, "-", tmp2, intcpt, pix="r", calc="r", verb-, noact-)
imarith (intcpt, "/", delta, intcpt, pix="r", calc="r", verb-, noact-)
imdelete (tmp1//","//tmp2, ver-, >& "dev$null")
# Calculate the slope
imarith (sumxy, "∗", nimg, tmp1, pix="r", calc="r", verb-, noact-)
imarith (sumy, "∗", sumx, tmp2, pix="r", calc="r", verb-, noact-)
imarith (tmp1, "-", tmp2, slp, pix="r", calc="r", verb-, noact-)
imarith (slp, "/", delta, slp, pix="r", calc="r", verb-, noact-)
imdelete (tmp1//","//tmp2, ver-, >& "dev$null")
# Clean up
imdelete (sumy//","//sumxy, ver-, >& "dev$null")
delete (ifile//","//tfile//","//xfile, ver-, >& "dev$null")
end
September 22, 1989