Index: trunk/psLib/src/fits/psFitsImage.h
===================================================================
--- trunk/psLib/src/fits/psFitsImage.h	(revision 15630)
+++ trunk/psLib/src/fits/psFitsImage.h	(revision 19383)
@@ -4,6 +4,6 @@
  * @author Robert DeSonia, MHPCC
  *
- * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-11-16 01:04:56 $
+ * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2008-09-05 07:51:09 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -23,8 +23,9 @@
 
 /// Return the dimensions and type of the FITS image
-bool psFitsImageSize(int *numCols, int *numRows, ///< Size of image
-                     psElemType *type,  ///< Type of image
-                     const psFits *fits, ///< FITS file pointer
-                     psRegion region    ///< Region in the FITS image to read
+bool psFitsImageSize(
+    int *numCols, int *numRows,         ///< Size of image
+    psElemType *type,                   ///< Type of image
+    const psFits *fits,                 ///< FITS file pointer
+    psRegion region                     ///< Region in the FITS image to read
     );
 
@@ -33,59 +34,108 @@
  *  @return psImage*     the read image or NULL if there was an error.
  */
-psImage* psFitsReadImage(
-    const psFits* fits,                ///< the psFits object
-    psRegion region,                   ///< the region in the FITS image to read
-    int z                              ///< the z-plane in the FITS image cube to read
+psImage *psFitsReadImage(
+    const psFits *fits,                 ///< the psFits object
+    psRegion region,                    ///< the region in the FITS image to read
+    int z                               ///< the z-plane in the FITS image cube to read
 );
 
-// Read an image into an extant buffer
-psImage* psFitsReadImageBuffer(psImage *output, // Output image buffer
-                               const psFits *fits,    // the psFits object
-                               psRegion region, // the region in the FITS image to read
-                               int z           // the z-plane in the FITS image cube to read
-                              );
+/** Read an image into an extant buffer
+ */
+psImage *psFitsReadImageBuffer(
+    psImage *output,                    ///< Output image buffer
+    const psFits *fits,                 ///< the psFits object
+    psRegion region,                    ///< the region in the FITS image to read
+    int z                               ///< the z-plane in the FITS image cube to read
+    );
 
-/** Writes an image, given the desired region and z-plane.
+/** Writes an image to a FITS file
+ *
+ * A new IMAGE HDU is appended to the end of the FITS file.
  *
  *  @return bool        TRUE is the write was successful, otherwise FALSE.
  */
 bool psFitsWriteImage(
-    psFits* fits,                      ///< the psFits object
-    psMetadata* header,                 ///< header items for the new HDU.  Can be NULL.
-    const psImage* input,              ///< the image to output
-    int depth,                         ///< the number of z-planes of the FITS image data cube
-    const char* extname                ///< FITS extension name
+    psFits *fits,                       ///< the psFits object
+    psMetadata *header,                 ///< header items for the new HDU.  Can be NULL.
+    const psImage *input,               ///< the image to output
+    int depth,                          ///< the number of z-planes of the FITS image data cube
+    const char *extname                 ///< FITS extension name
 );
 
-/** Writes an image, given the desired region and z-plane.  A new IMAGE HDU is
- *  appended to the end of the FITS file.
+/** Writes an image to a FITS file, optionally using the supplied mask image to do statistics when compressing
+ *
+ * A new IMAGE HDU is appended to the end of the FITS file.
+ *
+ *  @return bool        TRUE is the write was successful, otherwise FALSE.
+ */
+bool psFitsWriteImageWithMask(
+    psFits *fits,                       ///< the psFits object
+    psMetadata *header,                 ///< header items for the new HDU.  Can be NULL.
+    const psImage *input,               ///< the image to output
+    const psImage *mask,                ///< the mask image
+    psMaskType maskVal,                 ///< value to mask
+    int depth,                          ///< the number of z-planes of the FITS image data cube
+    const char *extname                 ///< FITS extension name
+);
+
+/** Insert an image in a FITS file
  *
  *  @return bool        TRUE is the write was successful, otherwise FALSE.
  */
 bool psFitsInsertImage(
-    psFits* fits,                      ///< the psFits object
-    psMetadata* header,                 ///< header items for the new HDU.  Can be NULL.
-    const psImage* input,              ///< the image to output
-    int depth,                         ///< the number of z-planes of the FITS image data cube
-    const char* extname,               ///< FITS extension name
-    bool after                         ///< if TRUE, inserts HDU after current HDU, otherwise before
+    psFits *fits,                       ///< the psFits object
+    psMetadata *header,                 ///< header items for the new HDU.  Can be NULL.
+    const psImage *input,               ///< the image to output
+    int depth,                          ///< the number of z-planes of the FITS image data cube
+    const char *extname,                ///< FITS extension name
+    bool after                          ///< if TRUE, inserts HDU after current HDU, otherwise before
 );
 
-/** Updates the FITS file image, given the desired region and z-plane. a new
- *  IMAGE HDU is inserted before or after, depending on the AFTER parameter,
- *  the current HDU.
+/** Insert an image in a FITS file, optionally using the supplied mask image to do statistics when compressing
+ *
+ *  @return bool        TRUE is the write was successful, otherwise FALSE.
+ */
+bool psFitsInsertImageWithMask(
+    psFits *fits,                       ///< the psFits object
+    psMetadata *header,                 ///< header items for the new HDU.  Can be NULL.
+    const psImage *input,               ///< the image to output
+    const psImage *mask,                ///< the mask image
+    psMaskType maskVal,                 ///< value to mask
+    int depth,                          ///< the number of z-planes of the FITS image data cube
+    const char *extname,                ///< FITS extension name
+    bool after                          ///< if TRUE, inserts HDU after current HDU, otherwise before
+);
+
+/** Updates an existing FITS file image
  *
  *  @return bool        TRUE is the write was successful, otherwise FALSE.
  */
 bool psFitsUpdateImage(
-    psFits* fits,                      ///< the psFits object
-    const psImage* input,              ///< the image to output
-    int x0,                            ///< psImage's x-axis origin in FITS image coordinates
-    int y0,                            ///< psImage's y-axis origin in FITS image coordinates
-    int z                              ///< the z-planes of the FITS image data cube to write
+    psFits *fits,                       ///< the psFits object
+    const psImage *input,               ///< the image to output
+    int x0,                             ///< psImage's x-axis origin in FITS image coordinates
+    int y0,                             ///< psImage's y-axis origin in FITS image coordinates
+    int z                               ///< the z-planes of the FITS image data cube to write
+);
+
+/** Updates an existing FITS file image, optionally using the supplied mask image to do statistics when
+ ** compressing
+ *
+ *  @return bool        TRUE is the write was successful, otherwise FALSE.
+ */
+bool psFitsUpdateImageWithMask(
+    psFits *fits,                       ///< the psFits object
+    const psImage *input,               ///< the image to output
+    const psImage *mask,                ///< the mask image
+    psMaskType maskVal,                 ///< value to mask
+    int x0,                             ///< psImage's x-axis origin in FITS image coordinates
+    int y0,                             ///< psImage's y-axis origin in FITS image coordinates
+    int z                               ///< the z-planes of the FITS image data cube to write
 );
 
 psArray *psFitsReadImageCube(const psFits *fits, psRegion region);
+
 bool psFitsWriteImageCube(psFits *fits, psMetadata *header, const psArray *input, const char *extname);
+
 bool psFitsUpdateImageCube(psFits *fits, const psArray *input, int x0, int y0);
 
