IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 17, 2007, 11:35:35 AM (19 years ago)
Author:
jhoblitt
Message:

add psFitsSetCompression()

File:
1 edited

Legend:

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

    r12801 r14868  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-04-11 17:01:50 $
     9 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-09-17 21:35:35 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    562562
    563563
     564bool psFitsSetCompression(
     565    psFits* fits,                       ///< psFits object to close
     566    psFitsCompressionType type,         ///< type of compression
     567    int ndim,                           ///< number of dim in tile size array
     568    long *tilesize,                     ///< pointer to an array defining compression tile size
     569    int noisebits,                      ///< noise bits
     570    int scale,                          ///< hcompress scale
     571    int smooth                          ///< hcompress smothing
     572)
     573{
     574    // convert psFitsCompressionType to cfitsio compression types
     575    int comptype;
     576    switch (type) {
     577        case PS_FITS_COMPRESS_NONE:
     578            comptype = 0x0;
     579            break;
     580        case PS_FITS_COMPRESS_GZIP:
     581            comptype = GZIP_1;
     582            break;
     583        case PS_FITS_COMPRESS_RICE:
     584            comptype = RICE_1;
     585            break;
     586        case PS_FITS_COMPRESS_HCOMPRESS:
     587            comptype = HCOMPRESS_1;
     588            break;
     589        case PS_FITS_COMPRESS_PLIO:
     590            comptype = PLIO_1;
     591            break;
     592        default:
     593            psError(PS_ERR_UNKNOWN, true, "invalid psFitsCompressionType");
     594            return false;
     595    }
     596
     597    int status = false;
     598    fits_set_compression_type(fits->fd, comptype, &status);
     599    if (!status) {
     600        goto ERROR;
     601    }
     602    fits_set_tile_dim(fits->fd, ndim, tilesize, &status);
     603    if (!status) {
     604        goto ERROR;
     605    }
     606    fits_set_noise_bits(fits->fd, noisebits, &status);
     607    if (!status) {
     608        goto ERROR;
     609    }
     610#if FITS_HCOMP
     611    fits_set_hcomp_scale(fits->fd, scale, &status);
     612    if (!status) {
     613        goto ERROR;
     614    }
     615    fits_set_hcomp_smooth(fits->fd, smooth, &status);
     616    if (!status) {
     617        goto ERROR;
     618    }
     619#endif // FITS_HCOMP
     620
     621ERROR:
     622    fits_set_compression_type(fits->fd, 0x0, &status);
     623    psError(PS_ERR_UNKNOWN, true, "failed to configure compression - disabling");
     624    return false;
     625}
     626
     627
    564628psDataType p_psFitsTypeFromCfitsio(int datatype)
    565629{
Note: See TracChangeset for help on using the changeset viewer.