/** @file  psFitsImage.h
 *
 *  @brief Contains Fits I/O routines
 *
 *  @ingroup FileIO
 *
 *  @author Robert DeSonia, MHPCC
 *
 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
 *  @date $Date: 2005-11-14 22:18:30 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
 */

#ifndef PS_FITSIMAGE_H
#define PS_FITSIMAGE_H

#include "psFits.h"

#include "psType.h"
#include "psArray.h"
#include "psVector.h"
#include "psMetadata.h"
#include "psImage.h"

/// @addtogroup FileIO
/// @{

/** Reads an image, given the desired region and z-plane.
 *
 *  @return psImage*     the read image or NULL if there was an error.
 */
psImage* psFitsReadImage(
    psImage* out,                      ///< a psImage to recycle.
    const psFits* fits,                ///< the psFits object
    psRegion region,                   ///< the region in the FITS image to read
    int z                              ///< the z-plane in the FITS image cube to read
);

/** Writes an image, given the desired region and z-plane.
 *
 *  @return bool        TRUE is the write was successful, otherwise FALSE.
 */
bool psFitsWriteImage(
    psFits* fits,                      ///< the psFits object
    psMetadata* header,                ///< header items for the new HDU.  Can be NULL.
    const psImage* input,              ///< the image to output
    int depth                          ///< the number of z-planes of the FITS image data cube
);

/** Updates the FITS file image, given the desired region and z-plane.
 *
 *  @return bool        TRUE is the write was successful, otherwise FALSE.
 */
bool psFitsUpdateImage(
    psFits* fits,                      ///< the psFits object
    const psImage* input,              ///< the image to output
    psRegion region,                   ///< the region in the FITS image to write
    int z                              ///< the z-planes of the FITS image data cube to write
);

/// @}

#endif // #ifndef PS_FITS_H
