This page contains a python implementation of an algorithm that computes the polygon outlines of regions of illuminated pixels (i.e. footprints) from FITS images.
Footprints are very valuable for display but is also required in order to be able to decide whether or not a given object indeed was observed on that image. However, the positions of the corners of a FITS image are more and more often only a very rough description of the actual footprint. For space observations, for example it is now often standard practice to store images "North up", independently of the orientation of the telescope. In addition, high-level data products are created where multiple, sometimes not or only partly overlapping exposures, are combined.
The algorithm we propose here, can deal with arbitrarily shaped pixel-regions (e.g. concave footprints), detects multiple chips, ignores bad pixels and returns the full hierarchy of footprints-in-footprints (i.e. holes and islands). In addition, it is fast, robust, has very low memory usage and needs no other input than the FITS file itself.
A detailed description and discussion of the algorithm has appeared in
Issue #45 of the
ST-ECF newsletter.
Download
The python implementation can be downloaded from here.
Usage example
Running
footprintfinder.py -d -p myimage.fitswill compute the footprints of myimage.fits and plot them using pylab (-p) as well as write out a simple ds9 region file (-d) in addition to writing the standard output file containing all the footprint information to myimage_footprint.txt.
Input: -e, --extension FITS file extension to use. Default=first extension with data. Processing: -t, --tolerance Maximum tolerated distance of a pixel from a polygon line. Default=5. -z, --zerovalue Value of the pixels that should be identified as 'border'. If a pixel value 'nan', it is replaced with the zerovalue, too. -m, --minlength Minimal length of a continous footprint border to be taken into account as a fraction of the total number of border pixels. Default=0.05. Output: -p, --plotting Plots the footprint. Default=off. -d, --ds9 Writes output file(s) in ds9 region format. One file in image coordinates and if possible (i.e. projection is RA--TAN, DEC-TAN) a second one in WCS coordinates are produced. Default=off. -w, --writepoints Writes the polygon coordinates on the screen. Default=off. -v, --verbose Increase verbosity. Help: -h, --help Print this help.WFPC2 B-association image in ds9 overlaying the footprint: