Propagating WCS Information through Data Processing Steps

One of the purposes of AST is to make it feasible to propagate WCS information through successive stages of data processing, so that it remains consistent with the associated image data. As far as possible, this should happen regardless of the FITS encoding used to store the original WCS information.

If the data processing being performed does not change the relationship between image pixel and world coordinates (whatever these may be), then propagation of the WCS information is straightforward. You can simply copy the FITS header from input to output.

If this relationship changes, however, then the WCS information must be processed alongside the image data and a new FITS header generated to represent it. In this case, the sequence of operations within your program would probably be as follows:

  1. Read the image data and associated FITS header from the input dataset, putting the header cards into a FitsChanFitsChan (§17.3).

  2. Read an AST ObjectObject, a FrameSetFrameSet, from the FitsChan (typically using a foreign FITS encoding—§17.4).

  3. Process the image data and modify the FrameSet accordingly (e.g. §14.5).

  4. Write the FrameSet back into the FitsChan (§17.7).

  5. Perform any other modification of FITS header cards your program may require.

  6. Write the FitsChan contents (i.e. processed header cards) and image data to the output dataset.

In stage (2), the original WCS information will be removed from the FitsChan by a destructive read. Later, in stage (4), new WCS information is written to replace it. This is the process which we consider next (§17.7).