IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 3, 2007, 11:27:21 AM (19 years ago)
Author:
Paul Price
Message:

Merging branch with FITS compression development.

File:
1 edited

Legend:

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

    r14877 r15179  
    44 * @author Robert DeSonia, MHPCC
    55 *
    6  * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-09-18 02:56:36 $
     6 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-10-03 21:27:21 $
    88 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    99 */
     
    2121#include "psMetadata.h"
    2222#include "psImage.h"
     23
     24#include "psErrorCodes.h"
    2325
    2426/** FITS HDU type.
     
    4951 *
    5052 */
    51 typedef struct
    52 {
    53     fitsfile* fd;                       ///< the CFITSIO fits files handle.
    54     bool writable;                      ///< Is the file writable?
    55     char *extword;                      ///< user-specified word to name extensions (NULL implies EXTNAME)
    56 }
    57 psFits;
    58 
    59 /** FITS options object. */
    60 typedef struct
    61 {
     53typedef struct {
     54    fitsfile* fd;                       ///< the CFITSIO fits files handle.
     55    bool writable;                      ///< Is the file writable?
     56    char *extword;                      ///< user-specified word to name extensions (NULL implies EXTNAME)
     57    struct {
     58        bool compression;               ///< Honour compression convention, handling compressed images
     59    } conventions;                      ///< Conventions to honour
     60} psFits;
     61
     62/** FITS compression settings. */
     63typedef struct {
    6264    psFitsCompressionType type;         ///< type of compression
    6365    psVector *tilesize;                 ///< vector defining compression tile size
     
    6567    int scale;                          ///< hcompress scale
    6668    int smooth;                         ///< hcompress smothing
    67 }
    68 psFitsOptions;
     69} psFitsCompression;
    6970
    7071/** Opens a FITS file and allocates the associated psFits object.
     
    8485);
    8586
    86 /** Creates a new FITS options struct
     87
     88/// Generate an error including the cfitsio error string
     89#ifdef DOXYGEN
     90psErrorCode psFitsError(
     91    int status,                         ///< cfitsio status value
     92    bool new,                           ///< new error?
     93    const char *errorMsg,               ///< printf-style format of header line
     94    ...                                 ///< any parameters required in format
     95    );
     96#else // ifdef DOXYGEN
     97psErrorCode p_psFitsError(
     98    const char* filename,               ///< file name
     99    unsigned int lineno,                ///< line number in file
     100    const char* func,                   ///< function name
     101    int status,                         ///< cfitsio status value
     102    bool new,                           ///< new error?
     103    const char *errorMsg,               ///< printf-style format of header line
     104    ...                                 ///< any parameters required in format
     105    ) PS_ATTR_FORMAT(printf, 6, 7);
     106#ifndef SWIG
     107#define psFitsError(status,new,...) \
     108      p_psFitsError(__FILE__,__LINE__,__func__,status,new,__VA_ARGS__)
     109#endif // ifndef SWIG
     110#endif // ifdef DOXYGEN
     111
     112
     113/** Creates a new FITS options struct
    87114 *
    88115 *  @return psFitsOptions or NULL on failure
    89116 */
    90 psFitsOptions* psFitsOptionsAlloc(
     117psFitsCompression* psFitsCompressionAlloc(
    91118    psFitsCompressionType type,         ///< type of compression
    92119    psVector *tilesize,                 ///< vector defining compression tile size
     
    96123);
    97124
     125/// Return the FITS compression type specified by a string
     126psFitsCompressionType psFitsCompressionTypeFromString(
     127    const char *string                  ///< String with compression type
     128    );
     129
    98130/** Closes a FITS file.
    99131 *
     
    111143 */
    112144bool psFitsSetCompression(
    113     psFits* fits,                       ///< psFits object to close
     145    psFits* fits,                       ///< psFits object for which to set compression
    114146    psFitsCompressionType type,         ///< type of compression
    115147    psVector *tilesize,                 ///< vector defining compression tile size
     
    119151);
    120152
     153/// Get the compression options for a file handle
     154psFitsCompression *psFitsCompressionGet(
     155    psFits* fits                        ///< psFits object for which to get compression
     156);
     157
     158/// Get the compression type for a file handle
     159psFitsCompressionType psFitsCompressionGetType(
     160    psFits* fits                        ///< psFits object for which to get compression type
     161    );
     162
    121163/** Sets FITS write options
    122164 *
    123165 *  @return bool      TRUE if successfully configured, otherwise FALSE
    124166 */
    125 bool psFitsSetOptions(
    126     psFits* fits,                       ///< psFits object to close
    127     psFitsOptions *opt                  ///< options object
     167bool psFitsCompressionApply(
     168    psFits* fits,                       ///< psFits object for which to set compression
     169    psFitsCompression *compress         ///< options object
    128170);
    129171
     
    146188// a user-defined word in place of EXTNAME
    147189bool p_psFitsMoveExtName_UserKey(const psFits *fits,
    148                                 const char *extname,
    149                                 const char *extword);
     190                                const char *extname,
     191                                const char *extword);
    150192
    151193/** Moves the FITS HDU to the specified extension name.
     
    261303                          );
    262304
     305#define PS_ASSERT_FITS_NON_NULL(NAME, RVAL) \
     306if (!(NAME) || !(NAME)->fd) { \
     307    psError(PS_ERR_UNEXPECTED_NULL, true, "Error: FITS file pointer %s is NULL", #NAME); \
     308    return RVAL; \
     309}
     310
    263311/// @}
    264312#endif // #ifndef PS_FITS_H
Note: See TracChangeset for help on using the changeset viewer.