IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 14, 2005, 12:18:38 PM (21 years ago)
Author:
desonia
Message:

Overhauled the Fits functions to match latest SDRS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFits.h

    r5057 r5511  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-09-15 21:22:21 $
     9 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-11-14 22:18:30 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1616#define PS_FITS_H
    1717
    18 #include<fitsio.h>
     18#include <fitsio.h>
    1919
    2020#include "psType.h"
     
    4949{
    5050    fitsfile* fd;                      ///< the CFITSIO fits files handle.
    51     const char* filename;              ///< the filename of the fits file
    52     bool writable;                     ///< Is the file writable?
    5351}
    5452psFits;
     
    5957 *                     NULL if the open of the FITS file failed
    6058 */
    61 psFits* psFitsAlloc(
    62     const char* name                   ///< the FITS file name
     59psFits* psFitsOpen(
     60    const char* filename,              ///< the FITS file name
     61    const char* mode
     62    /**< File open mode. Could be one of the following:
     63     *       'r' (read only),
     64     *       'r+' (read & write),
     65     *       'rw' (same as 'r+'), or
     66     *       'w' (create new file for writing)
     67     */
     68);
     69
     70/** Closes a FITS file.
     71 *
     72 *  @return bool      TRUE if FITS file was successfully closed, otherwise FALSE
     73 */
     74bool psFitsClose(
     75    psFits* fits                       ///< psFits object to close
    6376);
    6477
    6578/** Checks the type of a particular pointer.
    6679 *
    67  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     80 *  Uses the appropriate deallocation function in psMemBlock to check the ptr
     81 *  datatype.
    6882 *
    69  *  @return bool:       True if the pointer matches a psFits structure, false otherwise.
     83 *  @return bool:       True if the pointer matches a psFits structure, false
     84 *                      otherwise.
    7085 */
    7186bool psMemCheckFits(
     
    7691/** Moves the FITS HDU to the specified extension name.
    7792 *
    78  *  @return psFitsType    The HDU type, or PS_FITS_TYPE_NONE if move failed.
     93 *  @return bool        TRUE if the extension name was found and move was
     94 *                      successful, otherwise FALSE
    7995 */
    8096bool psFitsMoveExtName(
     
    85101/** Moves the FITS HDU to the specified extension number
    86102 *
    87  *  @return psFitsType    The HDU type, or PS_FITS_TYPE_NONE if move failed.
     103 *  @return bool        TRUE if the extension number was found and move was
     104 *                      successful, otherwise FALSE
    88105 */
    89106bool psFitsMoveExtNum(
     
    91108    int extnum,                        ///< the extension number to move to (zero is primary HDU)
    92109    bool relative                      ///< if true, extnum is a relative number to the current position
     110);
     111
     112/** Moves the FITS HDU to the end of the file
     113 *
     114 *  @return bool        TRUE if the move was successful, otherwise FALSE
     115*/
     116bool psFitsMoveLast(
     117    const psFits* fits                 ///< the psFits object to move
    93118);
    94119
     
    129154);
    130155
     156/** Remove the an HDU as specified by number
     157 *
     158 *  @return bool        TRUE if the specified HDU was removed, otherwise FALSE
     159 */
     160bool psFitsDeleteExtNum(
     161    psFits* fits,                      ///< the psFits object
     162    int extnum,                        ///< the extension number to delete (zero is primary HDU)
     163    bool relative                      ///< if true, extnum is a relative number to the current position
     164);
     165
     166/** Remove the an HDU as specified by extension name
     167 *
     168 *  @return bool        TRUE if the specified HDU was removed, otherwise FALSE
     169 */
     170bool psFitsDeleteExtName(
     171    psFits* fits,                      ///< the psFits object
     172    const char* extname                ///< the extension name to delete
     173);
     174
    131175/** Get the extension type of the current HDU.
    132176 *
     
    138182);
    139183
    140 /** Reads the header of the current HDU.
     184/** Delete all extensions after the current position
    141185 *
    142  *  @return psMetadata*   the header data
     186 *  @return bool        TRUE if the operation was successful, otherwise FALSE
    143187 */
    144 psMetadata* psFitsReadHeader(
    145     psMetadata* out,
    146     ///< The psMetadata to add the header data.  If null, a new psMetadata is created.
    147 
    148     const psFits* fits                 ///< the psFits object
    149 );
    150 
    151 /** Reads the header of all HDUs.  The current HDU is not changed.
    152  *
    153  *  @return psMetadata*      the header data set as a number of metadata entries
    154  */
    155 psMetadata* psFitsReadHeaderSet(
    156     psMetadata* out,
    157     ///< The psMetadata to add the header data via psMetadata items.  If null, a
    158     ///< new psMetadata is created.  The keys of the psMetadata are the extension names
    159     ///< of the cooresponding HDUs.
    160 
    161     const psFits* fits                       ///< the psFits object
    162 );
    163 
    164 /** Writes the values of the metadata to the current HDU header.
    165  *
    166  *  @return bool        if TRUE, the write was successful, otherwise FALSE.
    167  */
    168 bool psFitsWriteHeader(
    169     const psMetadata* output,          ///< the psMetadata data in which to write
     188bool psFitsTruncate(
    170189    psFits* fits                       ///< the psFits object
    171 );
    172 
    173 /** Reads an image, given the desired region and z-plane.
    174  *
    175  *  @return psImage*     the read image or NULL if there was an error.
    176  */
    177 psImage* psFitsReadImage(
    178     psImage* out,                      ///< a psImage to recycle.
    179     const psFits* fits,                ///< the psFits object
    180     psRegion region,                   ///< the region in the FITS image to read
    181     int z                              ///< the z-plane in the FITS image cube to read
    182 );
    183 
    184 /** Writes an image, given the desired region and z-plane.
    185  *
    186  *  @return bool        TRUE is the write was successful, otherwise FALSE.
    187  */
    188 bool psFitsWriteImage(
    189     psFits* fits,                      ///< the psFits object
    190     psMetadata* header,                ///< header items for the new HDU.  Can be NULL.
    191     const psImage* input,              ///< the image to output
    192     int depth                          ///< the number of z-planes of the FITS image data cube
    193 );
    194 
    195 /** Updates the FITS file image, given the desired region and z-plane.
    196  *
    197  *  @return bool        TRUE is the write was successful, otherwise FALSE.
    198  */
    199 bool psFitsUpdateImage(
    200     psFits* fits,                      ///< the psFits object
    201     const psImage* input,              ///< the image to output
    202     psRegion region,                   ///< the region in the FITS image to write
    203     int z                              ///< the z-planes of the FITS image data cube to write
    204 );
    205 
    206 /** Reads a table row.  The current HDU type must be either
    207  *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
    208  *
    209  *  @return psMetadata*    The table row's data.  The keys are the column names.
    210  */
    211 psMetadata* psFitsReadTableRow(
    212     const psFits* fits,                ///< the psFits object
    213     int row                            ///< row number to read
    214 );
    215 
    216 /** Reads a table column.  The current HDU type must be either
    217  *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
    218  *
    219  *  @return psArray*    Array of data items for the specified column or NULL
    220  *                      if an error occurred.
    221  */
    222 psArray* psFitsReadTableColumn(
    223     const psFits* fits,                ///< the psFits object
    224     const char* colname                ///< the column name
    225 );
    226 
    227 /** Reads a table column of numbers.  The current HDU type must be either
    228  *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
    229  *
    230  *  @return psVector*    Vector of data for the specified column or NULL
    231  *                       if an error occurred.
    232  */
    233 psVector* psFitsReadTableColumnNum(
    234     const psFits* fits,                ///< the psFits object
    235     const char* colname                ///< the column name
    236 );
    237 
    238 
    239 /** Reads a whole FITS table.  The current HDU type must be either
    240  *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
    241  *
    242  *  @return psArray*     Array of psMetadata items, which contains the output
    243  *                       data items of each row.
    244  *
    245  *  @see psFitsReadTableRow
    246  */
    247 psArray* psFitsReadTable(
    248     psFits* fits                       ///< the psFits object
    249 );
    250 
    251 /** Writes a whole FITS table.  The current HDU type must be either
    252  *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
    253  *
    254  *  @return bool        TRUE if the write was successful, otherwise FALSE
    255  *
    256  *  @see psFitsReadTableRow
    257  */
    258 bool psFitsWriteTable(
    259     psFits* fits,                      ///< the psFits object
    260     const psMetadata* header,          ///< header items for the new HDU.  Can be NULL.
    261     const psArray* table
    262     ///< Array of psMetadata items, which contains the output data items of each row.
    263 );
    264 
    265 /** Updates a FITS table.  The current HDU type must be either
    266  *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
    267  *
    268  *  @return bool        TRUE if the write was successful, otherwise FALSE
    269  *
    270  *  @see psFitsWriteTable
    271  */
    272 bool psFitsUpdateTable(
    273     psFits* fits,                ///< the psFits object
    274     const psMetadata* data,
    275     ///< Array of psMetadata items, which contains the output data items of each row.
    276     int row                            ///< the row number to update.
    277190);
    278191
Note: See TracChangeset for help on using the changeset viewer.