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/utilities/nttools/threed/tiimage/tmscan.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/utilities/nttools/threed/tiimage/tmscan.x')
-rw-r--r-- | pkg/utilities/nttools/threed/tiimage/tmscan.x | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/threed/tiimage/tmscan.x b/pkg/utilities/nttools/threed/tiimage/tmscan.x new file mode 100644 index 00000000..31af8c02 --- /dev/null +++ b/pkg/utilities/nttools/threed/tiimage/tmscan.x @@ -0,0 +1,96 @@ +include <error.h> +include <imhdr.h> +include <tbset.h> + +# TM_SCAN -- Scan input image list and create column pointer array +# and table from information stored in image headers. +# +# +# +# +# Revision history: +# ---------------- +# 30-Jan-97 - Task created (I.Busko) +# 21-May-97 - Changes from code review (IB) + + +procedure tm_scan (otp, ocp, ocpsize, nocp, imlist) + +pointer otp # i: output table pointer +pointer ocp # io: output table column pointer array +int ocpsize # i: size of above array +int nocp # o: actual number of columns in array +char imlist[ARB] # i: input image list +#-- +pointer sp, im, list +pointer imname, cn, cn1, cu, cf, duma +int image, column, lendata, dumi, i +bool match + +errchk tm_header + +pointer imtopen(), immap() +int imtlen(), imtgetim() +bool streq() + +begin + call smark (sp) + call salloc (imname, SZ_PATHNAME, TY_CHAR) + call salloc (cn, SZ_COLNAME, TY_CHAR) + call salloc (cn1, SZ_COLNAME, TY_CHAR) + call salloc (cu, SZ_COLUNITS, TY_CHAR) + call salloc (cf, SZ_COLFMT, TY_CHAR) + call salloc (duma, max(SZ_COLUNITS,SZ_COLFMT),TY_CHAR) + + # Open input list and initialize number of columns. + list = imtopen (imlist) + nocp = 0 + + # Scan input list. + do image = 1, imtlen(list) { + + # Open image. + i = imtgetim (list, Memc[imname], SZ_PATHNAME) + iferr (im = immap (Memc[imname], READ_ONLY, 0)) { + call erract (EA_WARN) + next + } + + # Get column data from image header. + iferr (call tm_header (im, Memc[cn], Memc[cu], Memc[cf])) { + call erract (EA_WARN) + next + } + + # Array size is full image size. + lendata = 1 + do i = 1, IM_NDIM(im) + lendata = lendata * IM_LEN(im,i) + + + # See if column name from header matches any name + # already stored in column pointer array. + match = false + do column = 1, nocp { + call tbcinf (Memi[ocp+column-1], dumi, Memc[cn1], + Memc[duma], Memc[duma], dumi, dumi, dumi) + if (streq (Memc[cn1], Memc[cn])) { + match = true + break + } + } + if (!match) { + + # No names matched, define new column. + call tbcdef (otp, Memi[ocp+nocp], Memc[cn], Memc[cu], + Memc[cf], IM_PIXTYPE(im), lendata, 1) + nocp = nocp + 1 + } + } + + call imtclose (list) + call sfree (sp) + if (nocp == 0) + call error (1, "No images with column data in header.") + call tbtcre (otp) +end |