IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15111


Ignore:
Timestamp:
Sep 29, 2007, 11:55:41 AM (19 years ago)
Author:
Paul Price
Message:

Renaming psFitsOptions --> psFitsCompression

Location:
branches/pap_branch_070920/psLib/src/fits
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_070920/psLib/src/fits/psFits.c

    r14984 r15111  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.71.2.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-09-22 03:06:16 $
     9 *  @version $Revision: 1.71.2.2 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-09-29 21:55:41 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    144144         &status);
    145145        if (fptr == NULL || status != 0) {
    146             char fitsErr[MAX_STRING_LENGTH]
    147             ;
     146            char fitsErr[MAX_STRING_LENGTH];
    148147            fits_get_errstatus(status, fitsErr);
    149148            psError(PS_ERR_IO, true,
     
    163162         &status);
    164163        if (fptr == NULL || status != 0) {
    165             char fitsErr[MAX_STRING_LENGTH]
    166             ;
     164            char fitsErr[MAX_STRING_LENGTH];
    167165            fits_get_errstatus(status, fitsErr);
    168166            psError(PS_ERR_IO, true,
     
    211209}
    212210
    213 static void psFitsOptionsFree(psFitsOptions *opt)
    214 {
    215     psFree(opt->tilesize);
    216 }
    217 
    218 psFitsOptions* psFitsOptionsAlloc(
     211static void psFitsCompressionFree(psFitsCompression *comp)
     212{
     213    psFree(comp->tilesize);
     214}
     215
     216psFitsCompression* psFitsCompressionAlloc(
    219217    psFitsCompressionType type,         ///< type of compression
    220218    psVector *tilesize,                 ///< vector defining compression tile size
     
    224222)
    225223{
    226     psFitsOptions *opt = psAlloc(sizeof(psFitsOptions));
    227 
    228     opt->type = type;
    229     opt->tilesize = psVectorCopy(NULL, tilesize, PS_DATA_S64);
    230     opt->noisebits = noisebits;
    231     opt->scale = scale;
    232     opt->smooth = smooth;
    233 
    234     psMemSetDeallocator(opt, (psFreeFunc) psFitsOptionsFree);
    235 
    236     return opt;
     224    psFitsCompression *comp = psAlloc(sizeof(psFitsCompression));
     225    psMemSetDeallocator(comp, (psFreeFunc) psFitsCompressionFree);
     226
     227    comp->type = type;
     228    comp->tilesize = psVectorCopy(NULL, tilesize, PS_DATA_S64);
     229    comp->noisebits = noisebits;
     230    comp->scale = scale;
     231    comp->smooth = smooth;
     232
     233    return comp;
    237234}
    238235
     
    669666        psAbort("can't map (long) type to a psLib type");
    670667    }
     668    psFree(dim);
    671669    // status check belongs to fits_set_tile_dim() call
    672670    if (status) {
     
    711709
    712710
    713 bool psFitsSetOptions(
     711bool psFitsCompressionApply(
    714712    psFits* fits,                       ///< psFits object to close
    715     psFitsOptions *opt                  ///< options object
     713    psFitsCompression *comp             ///< options object
    716714)
    717715{
    718     return psFitsSetCompression(
    719             fits,
    720             opt->type,
    721             opt->tilesize,
    722             opt->noisebits,
    723             opt->scale,
    724             opt->smooth);
     716    return psFitsSetCompression(fits, comp->type, comp->tilesize, comp->noisebits, comp->scale, comp->smooth);
    725717}
    726718
     
    855847
    856848
     849psFitsCompressionType psFitsCompressionTypeFromString(const char *string)
     850{
     851    if (!string || strlen(string) == 0) {
     852        psWarning("Unable to identify compression type --- none set.");
     853        return PS_FITS_COMPRESS_NONE;
     854    }
     855
     856    if (strcmp(string, "GZIP") == 0) return PS_FITS_COMPRESS_GZIP;
     857    if (strcmp(string, "RICE") == 0) return PS_FITS_COMPRESS_RICE;
     858    if (strcmp(string, "HCOMPRESS") == 0) return PS_FITS_COMPRESS_HCOMPRESS;
     859    if (strcmp(string, "PLIO") == 0) return PS_FITS_COMPRESS_PLIO;
     860
     861    psWarning("Unable to identify compression type (%s) --- none set.", string);
     862    return PS_FITS_COMPRESS_NONE;
     863}
  • branches/pap_branch_070920/psLib/src/fits/psFits.h

    r14984 r15111  
    44 * @author Robert DeSonia, MHPCC
    55 *
    6  * @version $Revision: 1.31.2.1 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-09-22 03:06:16 $
     6 * @version $Revision: 1.31.2.2 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-09-29 21:55:41 $
    88 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    99 */
     
    5151 *
    5252 */
    53 typedef struct
    54 {
     53typedef struct {
    5554    fitsfile* fd;                       ///< the CFITSIO fits files handle.
    5655    bool writable;                      ///< Is the file writable?
    5756    char *extword;                      ///< user-specified word to name extensions (NULL implies EXTNAME)
    58 }
    59 psFits;
    60 
    61 /** FITS options object. */
    62 typedef struct
    63 {
     57} psFits;
     58
     59/** FITS compression settings. */
     60typedef struct {
    6461    psFitsCompressionType type;         ///< type of compression
    6562    psVector *tilesize;                 ///< vector defining compression tile size
     
    6764    int scale;                          ///< hcompress scale
    6865    int smooth;                         ///< hcompress smothing
    69 }
    70 psFitsOptions;
     66} psFitsCompression;
    7167
    7268/** Opens a FITS file and allocates the associated psFits object.
     
    116112 *  @return psFitsOptions or NULL on failure
    117113 */
    118 psFitsOptions* psFitsOptionsAlloc(
     114psFitsCompression* psFitsCompressionAlloc(
    119115    psFitsCompressionType type,         ///< type of compression
    120116    psVector *tilesize,                 ///< vector defining compression tile size
     
    123119    int smooth                          ///< hcompress smothing
    124120);
     121
     122/// Return the FITS compression type specified by a string
     123psFitsCompressionType psFitsCompressionTypeFromString(
     124    const char *string                  ///< String with compression type
     125    );
    125126
    126127/** Closes a FITS file.
     
    151152 *  @return bool      TRUE if successfully configured, otherwise FALSE
    152153 */
    153 bool psFitsSetOptions(
     154bool psFitsCompressionApply(
    154155    psFits* fits,                       ///< psFits object to close
    155     psFitsOptions *opt                  ///< options object
     156    psFitsCompression *compress         ///< options object
    156157);
    157158
Note: See TracChangeset for help on using the changeset viewer.