IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 15, 2007, 3:04:56 PM (18 years ago)
Author:
Paul Price
Message:

Integrating the code to choose the output BITPIX (and quantising floating-point images if necessary) and custom floating-point schemes with the functions to read and write images. More detailed description, from my e-mail: psLib has always read any of the (legal) FITS types, and written a FITS image with the appropriate BITPIX for the image->type.type. Now the output BITPIX can be forced by setting psFits.bitpix to the desired BITPIX. Floating point images being quantised to integer types have BSCALE and BZERO set in such a fashion as to maintain the dynamic range of the image; quantisation after applying the scale and zero includes adding a random number [0,1) to preserve the expectation of the floating-point value. On reading, the BSCALE and BZERO are applied by cfitsio without any assistance by psLib. I've also added Gene's custom 16-bit floats (1S 5E 10M). In anticipation of further flavours down the road and to maintain compatibility, I've labelled this as FLOAT_16_0. An F32 image may be written out with this scheme by setting psFits.floatType = PS_FITS_FLOAT_16_0. The image is converted and written out with BITPIX=16, and the header keyword PSBITPIX added with the custom floating-point scheme name. Such images are automatically converted to F32 on reading (if psFits.conventions.psBitpix is true, which it is by default). One thing to keep in mind is that I'm not sure how NANs and INFs are handled in these processes. These additions are made on the top of the compression feature --- quantised or custom floating-point images may also be compressed (though the custom floating-point images don't gain much from it).

File:
1 edited

Legend:

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

    r15335 r15630  
    22#define PS_FITS_FLOAT_H
    33
    4 
     4#include <psFits.h>
     5#include <psType.h>
    56#include <psImage.h>
    6 #include <psMetadata.h>
    77
    88/// Type of custom floating point
    99typedef enum {
     10    PS_FITS_FLOAT_NONE,                 ///< No conversion to be performed
    1011    PS_FITS_FLOAT_16_0,                 ///< Original F16 proposal: 1S 5E 10M
    1112} psFitsFloat;
    1213
    1314/// Convert an image to custom floating-point in preparation for writing as FITS
    14 psImage *psFitsConvertFloatImage(const psImage *image, ///< Image to convert
    15                                  psMetadata *header, ///< Header to update
    16                                  psFitsFloat type ///< Custom floating point type
     15psImage *psFitsFloatImageWrite(const psImage *image, ///< Image to convert
     16                               psFitsFloat type ///< Custom floating point type
    1717    );
    1818
     19/// Convert the custom floating-point image to a floating-point image
     20psImage *psFitsFloatImageRead(psImage *out, ///< Output image, or NULL
     21                              const psImage *in, ///< Image to convert
     22                              psFitsFloat type ///< Custom floating point type
     23    );
     24
     25/// Return the appropriate element type for a custom floating-point
     26psElemType psFitsFloatImageType(psFitsFloat type ///< Custom floating-point type
     27    );
     28
     29/// Return the custom floating-point type from a string description
     30psFitsFloat psFitsFloatTypeFromString(const char *string ///< String with name of type
     31    );
    1932
    2033#endif
Note: See TracChangeset for help on using the changeset viewer.