Index: /branches/pap_branch_070920/psLib/src/fits/psFits.c
===================================================================
--- /branches/pap_branch_070920/psLib/src/fits/psFits.c	(revision 15110)
+++ /branches/pap_branch_070920/psLib/src/fits/psFits.c	(revision 15111)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.71.2.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-09-22 03:06:16 $
+ *  @version $Revision: 1.71.2.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-09-29 21:55:41 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -144,6 +144,5 @@
          &status);
         if (fptr == NULL || status != 0) {
-            char fitsErr[MAX_STRING_LENGTH]
-            ;
+            char fitsErr[MAX_STRING_LENGTH];
             fits_get_errstatus(status, fitsErr);
             psError(PS_ERR_IO, true,
@@ -163,6 +162,5 @@
          &status);
         if (fptr == NULL || status != 0) {
-            char fitsErr[MAX_STRING_LENGTH]
-            ;
+            char fitsErr[MAX_STRING_LENGTH];
             fits_get_errstatus(status, fitsErr);
             psError(PS_ERR_IO, true,
@@ -211,10 +209,10 @@
 }
 
-static void psFitsOptionsFree(psFitsOptions *opt)
-{
-    psFree(opt->tilesize);
-}
-
-psFitsOptions* psFitsOptionsAlloc(
+static void psFitsCompressionFree(psFitsCompression *comp)
+{
+    psFree(comp->tilesize);
+}
+
+psFitsCompression* psFitsCompressionAlloc(
     psFitsCompressionType type,         ///< type of compression
     psVector *tilesize,                 ///< vector defining compression tile size
@@ -224,15 +222,14 @@
 )
 {
-    psFitsOptions *opt = psAlloc(sizeof(psFitsOptions));
-
-    opt->type = type;
-    opt->tilesize = psVectorCopy(NULL, tilesize, PS_DATA_S64);
-    opt->noisebits = noisebits;
-    opt->scale = scale;
-    opt->smooth = smooth;
-
-    psMemSetDeallocator(opt, (psFreeFunc) psFitsOptionsFree);
-
-    return opt;
+    psFitsCompression *comp = psAlloc(sizeof(psFitsCompression));
+    psMemSetDeallocator(comp, (psFreeFunc) psFitsCompressionFree);
+
+    comp->type = type;
+    comp->tilesize = psVectorCopy(NULL, tilesize, PS_DATA_S64);
+    comp->noisebits = noisebits;
+    comp->scale = scale;
+    comp->smooth = smooth;
+
+    return comp;
 }
 
@@ -669,4 +666,5 @@
         psAbort("can't map (long) type to a psLib type");
     }
+    psFree(dim);
     // status check belongs to fits_set_tile_dim() call
     if (status) {
@@ -711,16 +709,10 @@
 
 
-bool psFitsSetOptions(
+bool psFitsCompressionApply(
     psFits* fits,                       ///< psFits object to close
-    psFitsOptions *opt                  ///< options object
+    psFitsCompression *comp             ///< options object
 )
 {
-    return psFitsSetCompression(
-            fits,
-            opt->type,
-            opt->tilesize,
-            opt->noisebits,
-            opt->scale,
-            opt->smooth);
+    return psFitsSetCompression(fits, comp->type, comp->tilesize, comp->noisebits, comp->scale, comp->smooth);
 }
 
@@ -855,2 +847,17 @@
 
 
+psFitsCompressionType psFitsCompressionTypeFromString(const char *string)
+{
+    if (!string || strlen(string) == 0) {
+        psWarning("Unable to identify compression type --- none set.");
+        return PS_FITS_COMPRESS_NONE;
+    }
+
+    if (strcmp(string, "GZIP") == 0) return PS_FITS_COMPRESS_GZIP;
+    if (strcmp(string, "RICE") == 0) return PS_FITS_COMPRESS_RICE;
+    if (strcmp(string, "HCOMPRESS") == 0) return PS_FITS_COMPRESS_HCOMPRESS;
+    if (strcmp(string, "PLIO") == 0) return PS_FITS_COMPRESS_PLIO;
+
+    psWarning("Unable to identify compression type (%s) --- none set.", string);
+    return PS_FITS_COMPRESS_NONE;
+}
Index: /branches/pap_branch_070920/psLib/src/fits/psFits.h
===================================================================
--- /branches/pap_branch_070920/psLib/src/fits/psFits.h	(revision 15110)
+++ /branches/pap_branch_070920/psLib/src/fits/psFits.h	(revision 15111)
@@ -4,6 +4,6 @@
  * @author Robert DeSonia, MHPCC
  *
- * @version $Revision: 1.31.2.1 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-09-22 03:06:16 $
+ * @version $Revision: 1.31.2.2 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-09-29 21:55:41 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -51,15 +51,12 @@
  *
  */
-typedef struct
-{
+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)
-}
-psFits;
-
-/** FITS options object. */
-typedef struct
-{
+} psFits;
+
+/** FITS compression settings. */
+typedef struct {
     psFitsCompressionType type;         ///< type of compression
     psVector *tilesize;                 ///< vector defining compression tile size
@@ -67,6 +64,5 @@
     int scale;                          ///< hcompress scale
     int smooth;                         ///< hcompress smothing
-}
-psFitsOptions;
+} psFitsCompression;
 
 /** Opens a FITS file and allocates the associated psFits object.
@@ -116,5 +112,5 @@
  *  @return psFitsOptions or NULL on failure
  */
-psFitsOptions* psFitsOptionsAlloc(
+psFitsCompression* psFitsCompressionAlloc(
     psFitsCompressionType type,         ///< type of compression
     psVector *tilesize,                 ///< vector defining compression tile size
@@ -123,4 +119,9 @@
     int smooth                          ///< hcompress smothing
 );
+
+/// Return the FITS compression type specified by a string
+psFitsCompressionType psFitsCompressionTypeFromString(
+    const char *string                  ///< String with compression type
+    );
 
 /** Closes a FITS file.
@@ -151,7 +152,7 @@
  *  @return bool      TRUE if successfully configured, otherwise FALSE
  */
-bool psFitsSetOptions(
+bool psFitsCompressionApply(
     psFits* fits,                       ///< psFits object to close
-    psFitsOptions *opt                  ///< options object
+    psFitsCompression *compress         ///< options object
 );
 
