/*--------------------------------------------------------------------------- File name : flipx.c Author : N. Devillard Created on : July 2001 Description : flip x axis in a FITS image. This is an example use of the qfits library. This program expects a list of FITS file names in input. For each input file, it will flip the image contained in the main data section in the X direction, i.e. pixel (i,j) is swapped with pixel (lx-i, j). The pixel loading mechanism is independent from endian-ness of the local host or FITS pixel type. This program offers a good overview of how to use qfits for pixel-level operations. Notice that this program does not support cubes or image extensions, but could be easily extended to support that case. *--------------------------------------------------------------------------*/ /* $Id: flipx.c,v 1.1 2001/12/14 09:53:21 ndevilla Exp $ $Author: ndevilla $ $Date: 2001/12/14 09:53:21 $ $Revision: 1.1 $ */ /*--------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include "qfits.h" /*--------------------------------------------------------------------------- Macros ---------------------------------------------------------------------------*/ #define ERRMSG(s) fprintf(stderr, "\tflipx error: %s\n", s) /*--------------------------------------------------------------------------- Private functions ---------------------------------------------------------------------------*/ /* * Swap pixels between position p1 and p2, regardless of the pixel * type and endian-ness of the local host. */ static void swap_pix(char * buf, int p1, int p2, int psize) { int i ; char c ; for (i=0 ; i\n", argv[0]); return 1 ; } err=0 ; for (i=1 ; i0) { fprintf(stderr, "%s: %d error(s) occurred\n", argv[0], err); return -1 ; } return 0 ; }