IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2007, 5:01:45 PM (19 years ago)
Author:
Paul Price
Message:

Cleaning up some code, using PS_ASSERT_FITS_NON_NULL instead of custom code in each function. Adding function to determine if the FITS file pointer is on a PHU that should truly be a FITS image (but it's compressed so it's a FITS table, which can't be the PHU). Putting hooks to this function into the header and image read functions, so that they read what the user Really Wants. This behaviour (which some may not want if they want the unadulterated FITS file) can be turned off by setting psFits.compression=false (default is true). This works for reading uncompressed data, data we've compressed ourselves, and data compressed with fpack-0.93. It doesn't yet work with data compressed with cfitsio's imcopy program (due to multiple EXTNAME keywords; about to put in a fix for this).

File:
1 edited

Legend:

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

    r15111 r15168  
    44 * @author Robert DeSonia, MHPCC
    55 *
    6  * @version $Revision: 1.31.2.2 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-09-29 21:55:41 $
     6 * @version $Revision: 1.31.2.3 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-10-03 03:01:45 $
    88 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    99 */
     
    5555    bool writable;                      ///< Is the file writable?
    5656    char *extword;                      ///< user-specified word to name extensions (NULL implies EXTNAME)
     57    bool compression;                   ///< Treat compressed images automatically?
    5758} psFits;
    5859
     
    140141 */
    141142bool psFitsSetCompression(
    142     psFits* fits,                       ///< psFits object to close
     143    psFits* fits,                       ///< psFits object for which to set compression
    143144    psFitsCompressionType type,         ///< type of compression
    144145    psVector *tilesize,                 ///< vector defining compression tile size
     
    148149);
    149150
     151/// Get the compression options for a file handle
     152psFitsCompression *psFitsCompressionGet(
     153    psFits* fits                        ///< psFits object for which to get compression
     154);
     155
     156/// Get the compression type for a file handle
     157psFitsCompressionType psFitsCompressionGetType(
     158    psFits* fits                        ///< psFits object for which to get compression type
     159    );
     160
    150161/** Sets FITS write options
    151162 *
     
    153164 */
    154165bool psFitsCompressionApply(
    155     psFits* fits,                       ///< psFits object to close
     166    psFits* fits,                       ///< psFits object for which to set compression
    156167    psFitsCompression *compress         ///< options object
    157168);
     
    290301                          );
    291302
     303#define PS_ASSERT_FITS_NON_NULL(NAME, RVAL) \
     304if (!(NAME) || !(NAME)->fd) { \
     305    psError(PS_ERR_UNEXPECTED_NULL, true, "Error: FITS file pointer %s is NULL", #NAME); \
     306    return RVAL; \
     307}
     308
    292309/// @}
    293310#endif // #ifndef PS_FITS_H
Note: See TracChangeset for help on using the changeset viewer.