Index: trunk/psLib/src/fits/psFits.h
===================================================================
--- trunk/psLib/src/fits/psFits.h	(revision 15630)
+++ trunk/psLib/src/fits/psFits.h	(revision 16185)
@@ -4,6 +4,6 @@
  * @author Robert DeSonia, MHPCC
  *
- * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-11-16 01:04:56 $
+ * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2008-01-23 03:08:03 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -25,9 +25,5 @@
 #include "psErrorCodes.h"
 
-/** FITS HDU type.
- *
- *  Enumeration for FITS HDU type.
- *
- */
+/// FITS HDU type.
 typedef enum {
     PS_FITS_TYPE_NONE = -1,            ///< Unknown HDU type
@@ -38,21 +34,25 @@
 } psFitsType;
 
+/// FITS compression type
 typedef enum {
-    PS_FITS_COMPRESS_NONE = 0,
-    PS_FITS_COMPRESS_GZIP,
-    PS_FITS_COMPRESS_RICE,
-    PS_FITS_COMPRESS_HCOMPRESS,
-    PS_FITS_COMPRESS_PLIO
+    PS_FITS_COMPRESS_NONE = 0,          ///< No compression
+    PS_FITS_COMPRESS_GZIP,              ///< GZIP compression (of the pixels only)
+    PS_FITS_COMPRESS_RICE,              ///< RICE compression (of the pixels only)
+    PS_FITS_COMPRESS_HCOMPRESS,         ///< HCOMPRESS compression (of the pixels only)
+    PS_FITS_COMPRESS_PLIO               ///< PLIO compression (of the pixels only; appropriate for masks)
 } psFitsCompressionType;
 
-/** FITS file object.
- *
- *  This object should be considered opaque to the user; no item in this
- *  struct should be accessed directly.
- *
- */
+/// FITS scaling method: how to set BSCALE and BZERO
+typedef enum {
+    PS_FITS_SCALE_NONE,                 ///< No auto-scaling to be applied (BSCALE = 1, BZERO = 0)
+    PS_FITS_SCALE_RANGE,                ///< Auto-scale to preserve dynamic range
+    PS_FITS_SCALE_STDEV_POSITIVE,       ///< Auto-scale to sample stdev, place mean at lower limit
+    PS_FITS_SCALE_STDEV_NEGATIVE,       ///< Auto-scale to sample stdev, place mean at upper limit
+    PS_FITS_SCALE_STDEV_BOTH,           ///< Auto-scale to sample stdev, place mean at middle
+    PS_FITS_SCALE_MANUAL                ///< Manual scaling (use specified BSCALE and BZERO)
+} psFitsScaling;
+
+/// Options for FITS I/O
 typedef struct {
-    fitsfile* fd;                       ///< the CFITSIO fits files handle.
-    bool writable;                      ///< Is the file writable?
     char *extword;                      ///< user-specified word to name extensions (NULL implies EXTNAME)
     struct {
@@ -60,7 +60,23 @@
         bool psBitpix;                  ///< Custom floating-point image
     } conventions;                      ///< Conventions to honour
+    // The following options are particular to writing images; they needn't be set for anything else.
+    psFitsFloat floatType;              ///< Desired custom floating-point for output images
     int bitpix;                         ///< Desired BITPIX for output images; 0 to use as provided
-    psFitsFloat floatType;              ///< Desired custom floating-point for output images
+    psFitsScaling scaling;              ///< Scaling scheme to use when quantising floating-point values
+    bool fuzz;                          ///< Fuzz the values when quantising floating-point values?
+    double bscale, bzero;               ///< Manually specified BSCALE and BZERO (for SCALE_MANUAL)
+    double mean, stdev;                 ///< Mean and standard deviation of image
+    int stdevBits;                      ///< Number of bits to sample a standard deviation (for SCALE_STDEV_*)
+    float stdevNum;                     ///< Number of standard deviations to pad off the edge
+} psFitsOptions;
+
+
+/// FITS file
+typedef struct {
+    fitsfile* fd;                       ///< the CFITSIO fits files handle.
+    bool writable;                      ///< Is the file writable?
+    psFitsOptions *options;             ///< Options for FITS I/O, or NULL
 } psFits;
+
 
 /** FITS compression settings. */
@@ -140,4 +156,7 @@
 );
 
+/// Allocator for options
+psFitsOptions *psFitsOptionsAlloc(void);
+
 /** Enables/configures FITS compression.
  *
