IM_MAXDIM and other constants used for image I/O are defined in <imhdr.h>. Other constants such as ARB and SZ_FNAME are defined in iraf.h which needs not be included explicitly.
imgsection() returns only the image section from an image file name. If image2 = mosaic.imh[100:200,150:350], then the image section is [100:200,150:350] and we want to overwrite this space with the same space from the input image, i.e., pixels 100 to 200 inclusive in the first axis, and rows 150 to 350 in the second axis. If the output image already exists, the access mode is READ_WRITE. If it does not exist open it as a NEW_COPY of an existing image, passing the open image descriptor, im1, to immap(). All necessary header information will be copied.
The array v1 keeps track of the current line to read from image1 by imgnl() and v2 keeps track of the line written to image2 using impnl(). amovkl() initializes the vectors with the long integer constant 1.
The macro defined constant IM_LEN contains the size of the image. It is defined in <imhdr.h>. It is a vector storing the size of each dimension up to the maximum number of dimensions supported by imio (seven). There is a case for each data type to preserve the precision of the pixels.
The pixel type unsigned short (TY_USHORT) will be copied to a buffer of type long. The routine imgnll() (the last letter denote the pixel type) returns a pointer in buf1 that points to the beginning of the current line in the input image. The routine impnll() returns a pointer buf2 that points to the beginning of the next line in the output image. amovl() copies npix pixel values from the input buffer to the output one. The input and output buffers in Meml have already been allocated in memory by imgnll() and impnll(). The loops will be repeated until all the lines have been copied, in which case an EOF is returned.
Generated with CERN WebMaker