IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 18, 2008, 3:04:13 PM (19 years ago)
Author:
Paul Price
Message:

Moving all options on FITS I/O into an additional structure, psFitsOptions. The idea is that this can be carried around independently of the FITS structure, which is only created when opening a file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_080117/psLib/src/fits/psFitsImage.c

    r16127 r16141  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.23.2.3 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2008-01-18 02:41:43 $
     9 *  @version $Revision: 1.23.2.4 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-01-19 01:04:13 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    263263    *floatType = PS_FITS_FLOAT_NONE;
    264264
     265    psFitsOptions *options = fits->options;
     266    if (!options) {
     267        return psMemIncrRefCounter((psImage*)image); // Casting away const
     268    }
     269
    265270    // Custom floating-point
    266     if (PS_IS_PSELEMTYPE_REAL(image->type.type) && fits->conventions.psBitpix &&
    267         fits->floatType != PS_FITS_FLOAT_NONE) {
    268         *floatType = fits->floatType;
    269         return psFitsFloatImageToDisk(image, fits->floatType);
     271    if (PS_IS_PSELEMTYPE_REAL(image->type.type) && options->conventions.psBitpix &&
     272        options->floatType != PS_FITS_FLOAT_NONE) {
     273        *floatType = options->floatType;
     274        return psFitsFloatImageToDisk(image, options->floatType);
    270275    }
    271276
    272277    // Automatically select what we're given
    273     if (fits->bitpix == 0) {
     278    if (options->bitpix == 0) {
    274279        return psMemIncrRefCounter((psImage*)image); // Casting away const
    275280    }
    276281
    277282    // Quantise floating-point images
    278     if (PS_IS_PSELEMTYPE_REAL(image->type.type) && fits->bitpix > 0) {
     283    if (PS_IS_PSELEMTYPE_REAL(image->type.type) && options->bitpix > 0) {
    279284        if (newScaleZero) {
    280285            // Choose an appropriate BSCALE and BZERO
     
    303308        }
    304309
    305         return psFitsScaleForDisk(image, fits->bitpix, *bscale, *bzero, fits->fuzz, rng);
     310        return psFitsScaleForDisk(image, fits, *bscale, *bzero, rng);
    306311    }
    307312
     
    320325    psElemType inType = image->type.type; // Type for input image
    321326    psElemType outType;                 // Type for output image
    322     switch (fits->bitpix) {
     327    switch (options->bitpix) {
    323328        CONVERT_TYPE_INT_CASE(outType, inType, 8);
    324329        CONVERT_TYPE_INT_CASE(outType, inType, 16);
     
    329334      default:
    330335        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Target bitpix (%d) is not one of 8,16,32,64",
    331                 fits->bitpix);
     336                options->bitpix);
    332337        return NULL;
    333338    }
     
    514519        bzero = cfitsioBzero;
    515520    }
    516     assert(bitPix == fits->bitpix || fits->bitpix == 0);
     521    psFitsOptions *options = fits->options; // FITS I/O options
     522    assert(!options || bitPix == options->bitpix || options->bitpix == 0);
    517523
    518524    int naxis = 3;                      // Number of axes
     
    644650        bzero = cfitsioBzero;
    645651    }
    646     assert(bitPix == fits->bitpix || fits->bitpix == 0);
     652    psFitsOptions *options = fits->options; // FITS I/O options
     653    assert(!options || bitPix == options->bitpix || options->bitpix == 0);
    647654
    648655    //check to see if the HDU has the same datatype
Note: See TracChangeset for help on using the changeset viewer.