Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psFits.h

Go to the documentation of this file.
00001 /** @file  psFits.h
00002  *
00003  *  @brief Contains Fits I/O routines
00004  *
00005  *  @ingroup FileIO
00006  *
00007  *  @author Robert DeSonia, MHPCC
00008  *
00009  *  @version $Revision: 1.22 $ $Name: rel9_0 $
00010  *  @date $Date: 2005/11/14 22:18:30 $
00011  *
00012  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00013  */
00014 
00015 #ifndef PS_FITS_H
00016 #define PS_FITS_H
00017 
00018 #include <fitsio.h>
00019 
00020 #include "psType.h"
00021 #include "psArray.h"
00022 #include "psVector.h"
00023 #include "psMetadata.h"
00024 #include "psImage.h"
00025 
00026 /// @addtogroup FileIO
00027 /// @{
00028 
00029 /** FITS HDU type.
00030  *
00031  *  Enumeration for FITS HDU type.
00032  *
00033  */
00034 typedef enum {
00035     PS_FITS_TYPE_NONE = -1,            ///< Unknown HDU type
00036     PS_FITS_TYPE_IMAGE = IMAGE_HDU,    ///< Image HDU type
00037     PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL, ///< Binary table HDU type
00038     PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL,   ///< ASCII table HDU type
00039     PS_FITS_TYPE_ANY = ANY_HDU         ///< Any HDU type
00040 } psFitsType;
00041 
00042 /** FITS file object.
00043  *
00044  *  This object should be considered opaque to the user; no item in this
00045  *  struct should be accessed directly.
00046  *
00047  */
00048 typedef struct
00049 {
00050     fitsfile* fd;                      ///< the CFITSIO fits files handle.
00051 }
00052 psFits;
00053 
00054 /** Opens a FITS file and allocates the associated psFits object.
00055  *
00056  *  @return psFits*    new psFits object for the FITS files specified or
00057  *                     NULL if the open of the FITS file failed
00058  */
00059 psFits* psFitsOpen(
00060     const char* filename,              ///< the FITS file name
00061     const char* mode
00062     /**< File open mode. Could be one of the following:
00063      *       'r' (read only),
00064      *       'r+' (read & write),
00065      *       'rw' (same as 'r+'), or
00066      *       'w' (create new file for writing)
00067      */
00068 );
00069 
00070 /** Closes a FITS file.
00071  *
00072  *  @return bool      TRUE if FITS file was successfully closed, otherwise FALSE
00073  */
00074 bool psFitsClose(
00075     psFits* fits                       ///< psFits object to close
00076 );
00077 
00078 /** Checks the type of a particular pointer.
00079  *
00080  *  Uses the appropriate deallocation function in psMemBlock to check the ptr
00081  *  datatype.
00082  *
00083  *  @return bool:       True if the pointer matches a psFits structure, false
00084  *                      otherwise.
00085  */
00086 bool psMemCheckFits(
00087     psPtr ptr                          ///< the pointer whose type to check
00088 );
00089 
00090 
00091 /** Moves the FITS HDU to the specified extension name.
00092  *
00093  *  @return bool        TRUE if the extension name was found and move was
00094  *                      successful, otherwise FALSE
00095  */
00096 bool psFitsMoveExtName(
00097     const psFits* fits,                ///< the psFits object to move
00098     const char* extname                ///< the extension name
00099 );
00100 
00101 /** Moves the FITS HDU to the specified extension number
00102  *
00103  *  @return bool        TRUE if the extension number was found and move was
00104  *                      successful, otherwise FALSE
00105  */
00106 bool psFitsMoveExtNum(
00107     const psFits* fits,                ///< the psFits object to move
00108     int extnum,                        ///< the extension number to move to (zero is primary HDU)
00109     bool relative                      ///< if true, extnum is a relative number to the current position
00110 );
00111 
00112 /** Moves the FITS HDU to the end of the file
00113  *
00114  *  @return bool        TRUE if the move was successful, otherwise FALSE
00115 */
00116 bool psFitsMoveLast(
00117     const psFits* fits                 ///< the psFits object to move
00118 );
00119 
00120 /** Get the current extension number, where 0 is the primary HDU.
00121  *
00122  *  @return int        Current HDU number of the psFits file or < 0 if an error
00123  *                     occurred.
00124  */
00125 int psFitsGetExtNum(
00126     const psFits* fits                 ///< the psFits object
00127 );
00128 
00129 /** Get the current extension name.
00130  *
00131  *  @return int        Current HDU name of the psFits file or NULL if an
00132  *                     error occurred.
00133  */
00134 psString psFitsGetExtName(
00135     const psFits* fits                 ///< the psFits object
00136 );
00137 
00138 /** Set the current extension's name
00139  *
00140  *  @return bool       TRUE if the extension was successfully set, otherwise FALSE.
00141  */
00142 bool psFitsSetExtName(
00143     psFits* fits,                      ///< the psFits object
00144     const char* name                   ///< the extension name
00145 );
00146 
00147 /** Get the total number of HDUs in the FITS file.
00148  *
00149  *  @return int        The total number of HDUs in the FITS file or < 0 if an
00150  *                     error occurred.
00151  */
00152 int psFitsGetSize(
00153     const psFits* fits                 ///< the psFits object
00154 );
00155 
00156 /** Remove the an HDU as specified by number
00157  *
00158  *  @return bool        TRUE if the specified HDU was removed, otherwise FALSE
00159  */
00160 bool psFitsDeleteExtNum(
00161     psFits* fits,                      ///< the psFits object
00162     int extnum,                        ///< the extension number to delete (zero is primary HDU)
00163     bool relative                      ///< if true, extnum is a relative number to the current position
00164 );
00165 
00166 /** Remove the an HDU as specified by extension name
00167  *
00168  *  @return bool        TRUE if the specified HDU was removed, otherwise FALSE
00169  */
00170 bool psFitsDeleteExtName(
00171     psFits* fits,                      ///< the psFits object
00172     const char* extname                ///< the extension name to delete
00173 );
00174 
00175 /** Get the extension type of the current HDU.
00176  *
00177  *  @return psFitsType The type of the current HDU.  If PS_FITS_TYPE_UNKNOWN,
00178  *                     the type could not be determined.
00179  */
00180 psFitsType psFitsGetExtType(
00181     const psFits* fits                 ///< the psFits object
00182 );
00183 
00184 /** Delete all extensions after the current position
00185  *
00186  *  @return bool        TRUE if the operation was successful, otherwise FALSE
00187  */
00188 bool psFitsTruncate(
00189     psFits* fits                       ///< the psFits object
00190 );
00191 
00192 /// @}
00193 
00194 #endif // #ifndef PS_FITS_H

Generated on Tue Dec 6 17:18:42 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2