/* @file  pmFPAview.h
 * @brief Tools to manipulate the FPA structure elements.
 *
 * @author EAM, IfA
 * @author PAP, IfA
 *
 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
 * @date $Date: 2007-01-27 03:33:37 $
 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
 */

#ifndef PM_FPA_FILE_FITS_IO_H
#define PM_FPA_FILE_FITS_IO_H

/// @addtogroup Camera Camera Layout
/// @{

/// Read an image into the current view
bool pmFPAviewReadFitsImage(const pmFPAview *view, ///< View specifying level of interest
                            pmFPAfile *file ///< FPA file into which to read
                           );

/// Read a mask into the current view
bool pmFPAviewReadFitsMask(const pmFPAview *view, ///< View specifying level of interest
                           pmFPAfile *file ///< FPA file into which to read
                          );
/// Read a weight map into the current view
bool pmFPAviewReadFitsWeight(const pmFPAview *view,  ///< View specifying level of interest
                             pmFPAfile *file ///< FPA file into which to read
                            );

/// Write the image for the specified view
bool pmFPAviewWriteFitsImage(const pmFPAview *view, ///< View specifying level of interest
                             pmFPAfile *file, ///< FPA file to write
                             pmConfig *config ///< Configuration
                            );

/// Write the mask for the specified view
bool pmFPAviewWriteFitsMask(const pmFPAview *view, ///< View specifying level of interest
                            pmFPAfile *file, ///< FPA file to write
                            pmConfig *config ///< Configuration
                           );

/// Write the weight map for the specified view
bool pmFPAviewWriteFitsWeight(const pmFPAview *view, ///< View specifying level of interest
                              pmFPAfile *file, ///< FPA file to write
                              pmConfig *config ///< Configuration
                             );

/// Free the data for the specified view
bool pmFPAviewFreeData(const pmFPAview *view, ///< View specifying level of interest
                       pmFPAfile *file  ///< FPA file to free data
                      );

/// Read a table into the current view
bool pmFPAviewReadFitsTable(const pmFPAview *view, ///<  View specifying level of interest
                            pmFPAfile *file, ///< FPA file into which to read
                            const char *name ///< Name of table
                           );

/// Write the table for the specified view
bool pmFPAviewWriteFitsTable(const pmFPAview *view, ///<  View specifying level of interest
                             pmFPAfile *file, ///< FPA file to write
                             const char *name ///< Name of table
                            );

/// Produce a suitable FPA for writing, on the basis of the input FPAfile
///
/// A new FPA with a changed format is generated if required (file->format is set and file->camera is equal to
/// the default, indicating a change in the format without changing the camera --- changes to the camera are
/// handled using other systems --- see pmFPAfileDefineChipMosaic, pmFPAfileDefineFPAMosaic).  Otherwise the
/// file->fpa is returned (incremented).
pmFPA *pmFPAfileSuitableFPA(const pmFPAfile *file,///< File containing the fpa
                            const pmFPAview *view, ///< View at which to produce the fpa
                            const pmConfig *config ///< Configuration
                           );

/// @}

# endif
