mHdrtbl operates in a fashion similar to mImgtbl, but is used on a set of header template files instead of FITS images.
mHdrtbl [-rcdb] [-s statusfile] [-t imglist] directory images.tbl


mHdrtbl can also be used as a standalone program to gather image metadata for other purposes (to populate a database, as a basis for spatial coverage searches, etc.) In this case it is often desirable to collect information on all the files in a directory tree recursively. The "-r" (recursive) flag instructs mHdrtbl to search the given directory and all its subdirectories recursively.
The "-c" (corners) option in mHdrtbl will cause eight extra columns to be added to the output metadata table containing the RA, Dec coordinates (ra1, dec1, ... ra4, dec4) of the image corners. The output is always Equatorial J2000, even if the input is some other system. This has been done to make the metadata uniform so that it can easily be used for coverage searches, etc. The "-c" option is not needed for normal Montage processing.
Turn on debugging
When this switch is set, mHdrtbl will explicitly output each header file it finds that does not appear to be valid, along with information on the error.
-s statusfile
Output and errors are written to statusfile instead of being written to stdout.
-t imglist
mHdrtbl will only process files with names specified in table imglist, ignoring any other files in the directory. Example: example.imglist.


Path to directory containing set of input header templates.
Path of output metadata table.
Output table contains metadata information from all readable header templates in the directory specified by directory. count is the number of records in the table, and badhdrs is the number of files for which FITS/WCS metadata could not be extracted.


The following example runs mHdrtbl on a directory containing header templates stripped from 14 2MASS images:

$ mHdrtbl input/2mass headers.tbl
[struct stat="OK", count=14, badfits=0]

Output: headers.tbl.

Column Names:

A unique counter (row number)
Image position in decimal degree format
Right ascension in HHMMSS.SS format. Declination in DDMMSS.S format
naxis1, naxis2
The size of the image in pixels for dimensions 1 and 2
ctype1, ctype2
The coordinate system (the first four characters) and WCS map projection (last three characters) for dimensions 1 and 2
crpix1, crpix2
The pixel coordinates of the reference location (can be fractional and can be off the image) for dimensions 1 and 2
crval1, crval2
The coordinates of a reference location on the sky (often at the center of the image) for dimensions 1 and 2
cdelt1, cdelt2
The pixel scale (in degrees on the sky per pixel) at the reference location for dimensions 1 and 2
The rotation angle from the "up" direction to the celestial pole
Precessional year associated with the coordinate system
Numerical identifier for the FITS extension that the image info is extracted from, for FITS files with multiple HDUs.
Filesize (in bytes) of the input FITS file
The path to the input FITS file

Return Codes:

  • [struct stat="OK", count=count, badfits=badfits]
  • [struct stat="ERROR", msg="Usage: mHdrtbl [-rcdb][-s statusfile][-f fieldlistfile][-t imglist] directory images.tbl"]
  • [struct stat="ERROR", msg="Illegal argument: -arg"]
  • [struct stat="ERROR", msg="Cannot open status file: statusfile"]
  • [struct stat="ERROR", msg="Cannot open field list file: fieldlistfile"]
  • [struct stat="ERROR", msg="Cannot open image list file: imgfile"]
  • [struct stat="ERROR", msg="Image table needs column fname/file"]
  • [struct stat="ERROR", msg="Illegal field name: string]
  • [struct stat="ERROR", msg="Illegal field type: string]
  • [struct stat="ERROR", msg="Cannot access directory"]
  • [struct stat="ERROR", msg="directory is not a directory"]
  • [struct stat="ERROR", msg="Can't open output table."]
  • [struct stat="ERROR", msg="Can't open copy table."]
  • [struct stat="ERROR", msg="Can't open tmp (in) table."]
  • [struct stat="ERROR", msg="Can't open tmp (out) table."]
  • [struct stat="ERROR", msg="Can't open final table."]
  • [struct stat="ERROR", flag=n, msg="FITS library error"]