Index: /trunk/psLib/src/dataManip/Makefile
===================================================================
--- /trunk/psLib/src/dataManip/Makefile	(revision 632)
+++ /trunk/psLib/src/dataManip/Makefile	(revision 633)
@@ -3,5 +3,5 @@
 endif
 
-TARGET = psStats.o libpsDataManip.a
+TARGET = psImage.o psStats.o libpsDataManip.a
 
 all: $(TARGET)
@@ -9,5 +9,5 @@
 include ../Makefile.Globals
 
-SRC_OBJS =  
+SRC_OBJS =
 
 %.o: %.c
Index: /trunk/psLib/src/image/psImage.c
===================================================================
--- /trunk/psLib/src/image/psImage.c	(revision 632)
+++ /trunk/psLib/src/image/psImage.c	(revision 633)
@@ -7,6 +7,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-07 02:56:52 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-10 20:20:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +17,7 @@
 /******************************************************************************/
 #include "psMemory.h"
+#include "psError.h"
 #include "psArray.h"
+#include "psImage.h"
 
 /******************************************************************************/
@@ -53,53 +55,103 @@
 /*****************************************************************************/
 
-psImage *psImageAlloc(int nx, int ny, psType type)
+psImage *psImageAlloc(int nCols, int nRows, psType type)
 {
     psImage *image = NULL;
 
-    psImage = psAlloc(psImage);
-    psImage->type = type;
-    psImage->nx = nx;
-    psImage->ny = ny;
-    psImage->x0 = 0;
-    psImage->y0 = 0;
-    psImage->parent = NULL;
-    psImage->nChildren = 0;
-    psImage->children = NULL;
+    image = psAlloc(sizeof(psImage));
+    image->type = type;
+    image->nCols = nCols;
+    image->nRows = nRows;
+    image->col0 = 0;
+    image->row0 = 0;
+    image->parent = NULL;
+    image->nChildren = 0;
+    image->children = NULL;
 
     switch(type.type) {
     case PS_TYPE_SHORT:
-        image->rows.rows_si = psAlloc(nx*ny*sizeof(short));
+        image->rows.rows_s = psAlloc(nCols*nRows*sizeof(short));
         break;
     case PS_TYPE_INT:
-        image->rows.rows_i = psAlloc(nx*ny*sizeof(int));
+        image->rows.rows_i = psAlloc(nCols*nRows*sizeof(int));
         break;
     case PS_TYPE_LONG:
-        image->rows.rows_li = psAlloc(nx*ny*sizeof(long));
+        image->rows.rows_l = psAlloc(nCols*nRows*sizeof(long));
         break;
     case PS_TYPE_USHORT:
-        image->rows.rows_us = psAlloc(nx*ny*sizeof(unsigned short));
+        image->rows.rows_us = psAlloc(nCols*nRows*sizeof(unsigned short));
         break;
     case PS_TYPE_UINT:
-        image->rows.rows_ui = psAlloc(nx*ny*sizeof(unsigned int));
+        image->rows.rows_ui = psAlloc(nCols*nRows*sizeof(unsigned int));
         break;
     case PS_TYPE_ULONG:
-        image->rows.rows_ul = psAlloc(nx*ny*sizeof(unsigned long));
+        image->rows.rows_ul = psAlloc(nCols*nRows*sizeof(unsigned long));
         break;
     case PS_TYPE_FLOAT:
-        image->rows.rows_f = psAlloc(nx*ny*sizeof(float));
+        image->rows.rows_f = psAlloc(nCols*nRows*sizeof(float));
         break;
     case PS_TYPE_DOUBLE:
-        image->rows.rows_d = psAlloc(nx*ny*sizeof(double));
+        image->rows.rows_d = psAlloc(nCols*nRows*sizeof(double));
         break;
     case PS_TYPE_COMPLEX:
-        image->rows.rows_cf = psAlloc(nx*ny*sizeof(complex float));
-        break;
-    case PS_TYPE_OTHER:
-        psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s\n", __LINE__);
+        image->rows.rows_cf = psAlloc(nCols*nRows*sizeof(complex float));
         break;
     default:
-        psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s\n", __LINE__);
+        psError(__func__, " : Line %d - Invalid psImage type: %d\n", __LINE__, type.type);
     }
 
+    return image;
+}
 
+void psImageFree(psImage *image)
+{
+    int i = 0;
+    int nChildren = 0;
+    psElemType imageType = 0;
+    psImage *children = NULL;
+
+    if(image != NULL) {
+        imageType = image->type.type;
+        nChildren = image->nChildren;
+        children = image->children;
+
+        switch(imageType) {
+        case PS_TYPE_SHORT:
+            psFree(image->rows.rows_s);
+            break;
+        case PS_TYPE_INT:
+            psFree(image->rows.rows_i);
+            break;
+        case PS_TYPE_LONG:
+            psFree(image->rows.rows_l);
+            break;
+        case PS_TYPE_USHORT:
+            psFree(image->rows.rows_us);
+            break;
+        case PS_TYPE_UINT:
+            psFree(image->rows.rows_ui);
+            break;
+        case PS_TYPE_ULONG:
+            psFree(image->rows.rows_ul);
+            break;
+        case PS_TYPE_FLOAT:
+            psFree(image->rows.rows_f);
+            break;
+        case PS_TYPE_DOUBLE:
+            psFree(image->rows.rows_d);
+            break;
+        case PS_TYPE_COMPLEX:
+            psFree(image->rows.rows_cf);
+            break;
+        case PS_TYPE_OTHER:
+            psError(__func__, " : Line %d - Can't delete images of type PS_TYPE_OTHER\n", __LINE__);
+            break;
+        default:
+            psError(__func__, " : Line %d - Invalid psImage type: %d\n", __LINE__, imageType);
+        }
+
+        for(i=0; i<nChildren; i++) {
+            psImageFree(children);
+        }
+    }
 }
Index: /trunk/psLib/src/image/psImage.h
===================================================================
--- /trunk/psLib/src/image/psImage.h	(revision 632)
+++ /trunk/psLib/src/image/psImage.h	(revision 633)
@@ -7,6 +7,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-07 02:56:52 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-10 20:20:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -36,8 +36,9 @@
 {
     psType type;                    ///< Image data type and dimension.
-    int nx, ny;                     ///< Size of image.
-    int x0, y0;                     ///< Data region relative to parent.
+    int nCols;                      ///< Number of rows in image
+    int nRows;                      ///< Number of columns in image.
+    int col0;                       ///< Row position relative to parent.
+    int row0;                       ///< Column position relative to parent.
     union {
-        float **rows                ///< Pointers to floating point data (default).
         short **rows_s;             ///< Pointers to short integer data.
         int **rows_i;               ///< Pointers to integer data.
@@ -46,7 +47,7 @@
         unsigned int **rows_ui;     ///< Pointers to unsigned integer data.
         unsigned long **rows_ul;    ///< Pointers to unsigned long integer data.
-        float **rows_f              ///< Pointers to floating point data.
-        double **rows_d             ///< Pointers to double precision data.
-        complex float **rows_cf     ///< Pointers to complex floating point data.
+        float **rows_f;             ///< Pointers to floating point data.
+        double **rows_d;            ///< Pointers to double precision data.
+        complex float **rows_cf;    ///< Pointers to complex floating point data.
     } rows;                         ///< Union for data types.
     struct psImage *parent;         ///< Parent, if a subimage.
@@ -69,7 +70,7 @@
  */
 psImage *psImageAlloc(
-    int nx,     ///< Image width.
-    int ny,     ///< Image height.
-    psType type ///< Image data type.
+    int nCols,  ///< Number of rows in image.
+    int nRows,  ///< Number of columns in image.
+    psType type ///< Type of data for image.
 );
 
@@ -84,8 +85,8 @@
     psImage *out,           ///< Subimage to return, or NULL.
     const psImage *image,   ///< Parent image.
-    int nx,                 ///< Subimage width (<= image.nx - x0).
-    int ny,                 ///< Subimage width (<= image.ny - y0).
-    int x0,                 ///< Subimage x-offset (0 <= x0 < nx).
-    int y0                  ///< Subimage y-offset (0 <= y0 < ny).
+    int nCols,              ///< Subimage width (<= image.nCols - col0).
+    int nRows,              ///< Subimage height (<= image.nRows - row0).
+    int col0,               ///< Subimage col-offset (0 <= col0 < nCol).
+    int row0                ///< Subimage row-offset (0 <= row0 < nCol).
 );
 
@@ -98,234 +99,6 @@
  */
 void psImageFree(
-    psImage *restrict image ///< free this image
+    psImage *restrict image ///< Free psImage
 );
 
-
-
-// DOXYGEN COMMENTING FORMAT NOT YET FULLY IMPLEMENTED BEYOND THIS POINT
-
-
-
-/** Destroy the pixels of the specified image */
-psImage *
-psImageFreePixels(psImage *restrict image ///< Image whose pixels are to be freed
-                 );
-
-/// Destroy the children of the specified image.  Returns number of children freed.
-int
-psImageFreeChildren(const psImage *image ///< free children of this image
-                   );
-
-/// Create a copy of the specified image.
-psImage *
-psImageCopy(psImage *output,   ///< target structure for output image data
-            const psImage *input ///< copy this image
-           );
-
-/*** various image pixel extractions ***/
-
-/// Extract pixels from rectlinear region to a vector.
-psFloatArray *
-psImageSlice(psFloatArray *out,  ///< Vector to output, or NULL
-             const psImage *input, ///< extract slice from this image
-             int x,    ///< starting x coord of region to slice
-             int y,    ///< starting y coord of region to slice
-             int nx,    ///< width of region in x
-             int ny,    ///< width of region in y
-             int direction,  ///< direction of vector along slice
-             const psStats *stats ///< defines statistics used to find output values
-            );
-
-/// Extract pixels along a line to a vector.
-psFloatArray *
-psImageCut(psFloatArray *out,  ///< Vector to output, or NULL
-           const psImage *input, ///< extract cut from this image
-           float xs,    ///< starting x coord of cut
-           float ys,    ///< starting y coord of cut
-           float xe,    ///< ending x coord of cut
-           float ye,    ///< ending y coord of cut
-           float dw,    ///< width of cut
-           const psStats *stats  ///< defines statistics used to find output values
-          );
-
-/// Extract radial annulii data to a vector.
-psFloatArray *
-psImageRadialCut(psFloatArray *out, ///< Vector to output, or NULL
-                 const psImage *input, ///< extract profile from this image
-                 float x,   ///< center x coord of annulii
-                 float y,   ///< center y coord of annulii
-                 float radius,  ///< outer radius of annulii
-                 float dr,  ///< radial step size of annulii
-                 const psStats *stats ///< defines statistics used to find output values
-                );
-
-/* Contour is a high-level function */
-#if 0
-/// Extract a 2-d contour from an image at the given threshold.
-psFloatArray *
-psImageContour(psFloatArray *out, ///< Vector to output, or NULL
-               const psImage *input,  ///< create contour for this image
-               float threshold, ///< contour image at this threshold
-               int binning  ///< bin image by this value for contour calculation
-              );
 #endif
-
-/*** various image geometry manipulation ***/
-/// Rebin image to new scale.
-psImage *
-psImageRebin(psImage *out,  ///< Image to output, or NULL
-             const psImage *input, ///< rebin this image
-             float scale,   ///< rebinning scale: doutput = scale*dinput
-             const psStats *stats ///< defines statistics used to find output values
-            );
-
-/// Rotate image by given angle.
-psImage *
-psImageRotate(psImage *out,  ///< Image to output, or NULL
-              const psImage *input, ///< rotate this image
-              float angle  ///< rotate by this amount anti-clockwise (degrees)
-             );
-
-/// Shift image by an arbitrary number of pixels in either direction.
-/// Drop edge pixels, and set newly exposed pixels to 'exposed'.
-psImage *
-psImageShift(psImage *out,  ///< Image to output, or NULL
-             const psImage *input, ///< shift this image
-             float dx,   ///< shift by this amount in x
-             float dy,   ///< shift by this amount in y
-             float exposed  ///< set exposed pixels to this value
-            );
-
-/// Roll image by an integer number of pixels in either direction.
-/// Edge pixels wrap to the other side (no values are lost).
-psImage *
-psImageRoll(psImage *out,  ///< Image to output, or NULL
-            const psImage *input, ///< roll this image
-            int dx,    ///< roll this amount in x
-            int dy   ///< roll this amount in y
-           );
-
-/// Determine statistics for image (or subimage).
-psStats *
-psImageGetStats(const psImage *input,  ///< image (or subimage) to calculate stats
-                psStats *stats  ///< defines statistics to be calculated & target
-               );
-
-/// Construct a histogram from an image (or subimage).
-psHistogram *
-psImageHistogram(psHistogram *hist, ///< input histogram description & target
-                 const psImage *input ///< determine histogram of this image
-                );
-
-/// Fit a 2-D polynomial surface to an image.
-psPolynomial2D *
-psImageFitPolynomial(const psImage *input, ///< image to fit
-                     psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
-                    );
-
-/// Evaluate a 2-D polynomial surface to image pixels.
-int
-psImageEvalPolynomial(const psImage *input, ///< image to fit
-                      const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
-                     );
-
-/*** image input/output routines ***/
-/// Read an image or subimage from a named file.
-psImage *
-psImageReadSection(psImage *output,  ///< place data in this structure for output
-                   int x,   ///< starting x coord of region
-                   int y,   ///< starting y coord of region
-                   int nx,   ///< x size of region (-1 for full range)
-                   int ny,   ///< y size of region (-1 for full range)
-                   int z,   ///< plane of interest
-                   const char *extname, ///< MEF extension name ("PHU" for primary header)
-                   int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                   const char *filename ///< file to read data from
-                  );
-
-/// Read an image or subimage from file descriptor.
-psImage *
-psImageFReadSection(psImage *output, ///< place data in this structure for output
-                    int x,  ///< starting x coord of region
-                    int y,  ///< starting y coord of region
-                    int nx,  ///< x size of region (-1 for full range)
-                    int ny,  ///< y size of region (-1 for full range)
-                    int z,  ///< plane of interest
-                    const char *extname, ///< MEF extension name ("PHU" for primary header)
-                    int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                    FILE *f  ///< file descriptor to read data from
-                   );
-
-/// Write an image section to named file (which may exist).
-psImage *
-psImageWriteSection(psImage *input,    ///< image to write out
-                    int x,   ///< starting x coord of region
-                    int y,   ///< starting y coord of region
-                    int z,   ///< plane of interest
-                    const char *extname, ///< MEF extension name ("PHU" for primary header)
-                    int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                    const char *filename ///< file to write data to
-                   );
-
-/// Write an image section to named file (which may exist).
-psImage *
-psImageFWriteSection(psImage *input, ///< image to write out
-                     int x,   ///< starting x coord of region
-                     int y,   ///< starting y coord of region
-                     int z,   ///< plane of interest
-                     const char *extname, ///< MEF extension name
-                     int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                     FILE *f  ///< file descriptor to write data to
-                    );
-
-/// Read only header from image file.
-psMetadata *
-psImageReadHeader(psMetadata *output, ///< read data to this structure
-                  const char *extname,  ///< MEF extension name ("PHU" for primary header)
-                  int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                  const char *filename ///< file to read from
-                 );
-
-/// Read only header from image file descriptor.
-psMetadata *
-psImageFReadHeader(psMetadata *output, ///< read data to this structure
-                   const char *extname, ///< MEF extension name ("PHU" for primary header)
-                   int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                   FILE *f  ///< file descriptor to read from
-                  );
-
-/*** basic pixel manipulations ***/
-/// Clip image values outside of range to given values.  Return number of clipped pixels.
-int
-psImageClip(psImage *input,   ///< clip this image
-            float min,   ///< clip pixels with values < min
-            float vmin,   ///< set min-clipped pixels to vmin
-            float max,   ///< clip pixels with values > max
-            float vmax   ///< set max-clipped pixels to vmax
-           );
-
-/// Clip NaN image pixels to given value.  Return number of clipped pixels.
-int
-psImageClipNaN(psImage *input,  ///< clip this image & target
-               float value  ///< set nan pixels to this value
-              );
-
-/// Overlay subregion of image with another image.  Return number of pixels replaced.
-int
-psImageOverlaySection(psImage *image, ///< input image & target
-                      const psImage *overlay, ///< image to overlay
-                      int x0,  ///< x offset of overlay subimage
-                      int y0,  ///< y offset of overlay subimage
-                      const char *op ///< overlay operation
-                     );
-
-/* \} */ // End of AstroGroup Functions
-
-# endif
-/* image overlay operations
-    PS_OVERLAY_EQUALS   = '=', 
-    PS_OVERLAY_ADD      = '+', 
-    PS_OVERLAY_SUBTRACT = '-', 
-    PS_OVERLAY_MULTIPLY = '*', 
-    PS_OVERLAY_DIVIDE   = '/', 
-*/
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 632)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 633)
@@ -7,6 +7,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-07 02:56:52 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-10 20:20:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +17,7 @@
 /******************************************************************************/
 #include "psMemory.h"
+#include "psError.h"
 #include "psArray.h"
+#include "psImage.h"
 
 /******************************************************************************/
@@ -53,53 +55,103 @@
 /*****************************************************************************/
 
-psImage *psImageAlloc(int nx, int ny, psType type)
+psImage *psImageAlloc(int nCols, int nRows, psType type)
 {
     psImage *image = NULL;
 
-    psImage = psAlloc(psImage);
-    psImage->type = type;
-    psImage->nx = nx;
-    psImage->ny = ny;
-    psImage->x0 = 0;
-    psImage->y0 = 0;
-    psImage->parent = NULL;
-    psImage->nChildren = 0;
-    psImage->children = NULL;
+    image = psAlloc(sizeof(psImage));
+    image->type = type;
+    image->nCols = nCols;
+    image->nRows = nRows;
+    image->col0 = 0;
+    image->row0 = 0;
+    image->parent = NULL;
+    image->nChildren = 0;
+    image->children = NULL;
 
     switch(type.type) {
     case PS_TYPE_SHORT:
-        image->rows.rows_si = psAlloc(nx*ny*sizeof(short));
+        image->rows.rows_s = psAlloc(nCols*nRows*sizeof(short));
         break;
     case PS_TYPE_INT:
-        image->rows.rows_i = psAlloc(nx*ny*sizeof(int));
+        image->rows.rows_i = psAlloc(nCols*nRows*sizeof(int));
         break;
     case PS_TYPE_LONG:
-        image->rows.rows_li = psAlloc(nx*ny*sizeof(long));
+        image->rows.rows_l = psAlloc(nCols*nRows*sizeof(long));
         break;
     case PS_TYPE_USHORT:
-        image->rows.rows_us = psAlloc(nx*ny*sizeof(unsigned short));
+        image->rows.rows_us = psAlloc(nCols*nRows*sizeof(unsigned short));
         break;
     case PS_TYPE_UINT:
-        image->rows.rows_ui = psAlloc(nx*ny*sizeof(unsigned int));
+        image->rows.rows_ui = psAlloc(nCols*nRows*sizeof(unsigned int));
         break;
     case PS_TYPE_ULONG:
-        image->rows.rows_ul = psAlloc(nx*ny*sizeof(unsigned long));
+        image->rows.rows_ul = psAlloc(nCols*nRows*sizeof(unsigned long));
         break;
     case PS_TYPE_FLOAT:
-        image->rows.rows_f = psAlloc(nx*ny*sizeof(float));
+        image->rows.rows_f = psAlloc(nCols*nRows*sizeof(float));
         break;
     case PS_TYPE_DOUBLE:
-        image->rows.rows_d = psAlloc(nx*ny*sizeof(double));
+        image->rows.rows_d = psAlloc(nCols*nRows*sizeof(double));
         break;
     case PS_TYPE_COMPLEX:
-        image->rows.rows_cf = psAlloc(nx*ny*sizeof(complex float));
-        break;
-    case PS_TYPE_OTHER:
-        psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s\n", __LINE__);
+        image->rows.rows_cf = psAlloc(nCols*nRows*sizeof(complex float));
         break;
     default:
-        psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s\n", __LINE__);
+        psError(__func__, " : Line %d - Invalid psImage type: %d\n", __LINE__, type.type);
     }
 
+    return image;
+}
 
+void psImageFree(psImage *image)
+{
+    int i = 0;
+    int nChildren = 0;
+    psElemType imageType = 0;
+    psImage *children = NULL;
+
+    if(image != NULL) {
+        imageType = image->type.type;
+        nChildren = image->nChildren;
+        children = image->children;
+
+        switch(imageType) {
+        case PS_TYPE_SHORT:
+            psFree(image->rows.rows_s);
+            break;
+        case PS_TYPE_INT:
+            psFree(image->rows.rows_i);
+            break;
+        case PS_TYPE_LONG:
+            psFree(image->rows.rows_l);
+            break;
+        case PS_TYPE_USHORT:
+            psFree(image->rows.rows_us);
+            break;
+        case PS_TYPE_UINT:
+            psFree(image->rows.rows_ui);
+            break;
+        case PS_TYPE_ULONG:
+            psFree(image->rows.rows_ul);
+            break;
+        case PS_TYPE_FLOAT:
+            psFree(image->rows.rows_f);
+            break;
+        case PS_TYPE_DOUBLE:
+            psFree(image->rows.rows_d);
+            break;
+        case PS_TYPE_COMPLEX:
+            psFree(image->rows.rows_cf);
+            break;
+        case PS_TYPE_OTHER:
+            psError(__func__, " : Line %d - Can't delete images of type PS_TYPE_OTHER\n", __LINE__);
+            break;
+        default:
+            psError(__func__, " : Line %d - Invalid psImage type: %d\n", __LINE__, imageType);
+        }
+
+        for(i=0; i<nChildren; i++) {
+            psImageFree(children);
+        }
+    }
 }
Index: /trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.h	(revision 632)
+++ /trunk/psLib/src/mathtypes/psImage.h	(revision 633)
@@ -7,6 +7,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-07 02:56:52 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-10 20:20:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -36,8 +36,9 @@
 {
     psType type;                    ///< Image data type and dimension.
-    int nx, ny;                     ///< Size of image.
-    int x0, y0;                     ///< Data region relative to parent.
+    int nCols;                      ///< Number of rows in image
+    int nRows;                      ///< Number of columns in image.
+    int col0;                       ///< Row position relative to parent.
+    int row0;                       ///< Column position relative to parent.
     union {
-        float **rows                ///< Pointers to floating point data (default).
         short **rows_s;             ///< Pointers to short integer data.
         int **rows_i;               ///< Pointers to integer data.
@@ -46,7 +47,7 @@
         unsigned int **rows_ui;     ///< Pointers to unsigned integer data.
         unsigned long **rows_ul;    ///< Pointers to unsigned long integer data.
-        float **rows_f              ///< Pointers to floating point data.
-        double **rows_d             ///< Pointers to double precision data.
-        complex float **rows_cf     ///< Pointers to complex floating point data.
+        float **rows_f;             ///< Pointers to floating point data.
+        double **rows_d;            ///< Pointers to double precision data.
+        complex float **rows_cf;    ///< Pointers to complex floating point data.
     } rows;                         ///< Union for data types.
     struct psImage *parent;         ///< Parent, if a subimage.
@@ -69,7 +70,7 @@
  */
 psImage *psImageAlloc(
-    int nx,     ///< Image width.
-    int ny,     ///< Image height.
-    psType type ///< Image data type.
+    int nCols,  ///< Number of rows in image.
+    int nRows,  ///< Number of columns in image.
+    psType type ///< Type of data for image.
 );
 
@@ -84,8 +85,8 @@
     psImage *out,           ///< Subimage to return, or NULL.
     const psImage *image,   ///< Parent image.
-    int nx,                 ///< Subimage width (<= image.nx - x0).
-    int ny,                 ///< Subimage width (<= image.ny - y0).
-    int x0,                 ///< Subimage x-offset (0 <= x0 < nx).
-    int y0                  ///< Subimage y-offset (0 <= y0 < ny).
+    int nCols,              ///< Subimage width (<= image.nCols - col0).
+    int nRows,              ///< Subimage height (<= image.nRows - row0).
+    int col0,               ///< Subimage col-offset (0 <= col0 < nCol).
+    int row0                ///< Subimage row-offset (0 <= row0 < nCol).
 );
 
@@ -98,234 +99,6 @@
  */
 void psImageFree(
-    psImage *restrict image ///< free this image
+    psImage *restrict image ///< Free psImage
 );
 
-
-
-// DOXYGEN COMMENTING FORMAT NOT YET FULLY IMPLEMENTED BEYOND THIS POINT
-
-
-
-/** Destroy the pixels of the specified image */
-psImage *
-psImageFreePixels(psImage *restrict image ///< Image whose pixels are to be freed
-                 );
-
-/// Destroy the children of the specified image.  Returns number of children freed.
-int
-psImageFreeChildren(const psImage *image ///< free children of this image
-                   );
-
-/// Create a copy of the specified image.
-psImage *
-psImageCopy(psImage *output,   ///< target structure for output image data
-            const psImage *input ///< copy this image
-           );
-
-/*** various image pixel extractions ***/
-
-/// Extract pixels from rectlinear region to a vector.
-psFloatArray *
-psImageSlice(psFloatArray *out,  ///< Vector to output, or NULL
-             const psImage *input, ///< extract slice from this image
-             int x,    ///< starting x coord of region to slice
-             int y,    ///< starting y coord of region to slice
-             int nx,    ///< width of region in x
-             int ny,    ///< width of region in y
-             int direction,  ///< direction of vector along slice
-             const psStats *stats ///< defines statistics used to find output values
-            );
-
-/// Extract pixels along a line to a vector.
-psFloatArray *
-psImageCut(psFloatArray *out,  ///< Vector to output, or NULL
-           const psImage *input, ///< extract cut from this image
-           float xs,    ///< starting x coord of cut
-           float ys,    ///< starting y coord of cut
-           float xe,    ///< ending x coord of cut
-           float ye,    ///< ending y coord of cut
-           float dw,    ///< width of cut
-           const psStats *stats  ///< defines statistics used to find output values
-          );
-
-/// Extract radial annulii data to a vector.
-psFloatArray *
-psImageRadialCut(psFloatArray *out, ///< Vector to output, or NULL
-                 const psImage *input, ///< extract profile from this image
-                 float x,   ///< center x coord of annulii
-                 float y,   ///< center y coord of annulii
-                 float radius,  ///< outer radius of annulii
-                 float dr,  ///< radial step size of annulii
-                 const psStats *stats ///< defines statistics used to find output values
-                );
-
-/* Contour is a high-level function */
-#if 0
-/// Extract a 2-d contour from an image at the given threshold.
-psFloatArray *
-psImageContour(psFloatArray *out, ///< Vector to output, or NULL
-               const psImage *input,  ///< create contour for this image
-               float threshold, ///< contour image at this threshold
-               int binning  ///< bin image by this value for contour calculation
-              );
 #endif
-
-/*** various image geometry manipulation ***/
-/// Rebin image to new scale.
-psImage *
-psImageRebin(psImage *out,  ///< Image to output, or NULL
-             const psImage *input, ///< rebin this image
-             float scale,   ///< rebinning scale: doutput = scale*dinput
-             const psStats *stats ///< defines statistics used to find output values
-            );
-
-/// Rotate image by given angle.
-psImage *
-psImageRotate(psImage *out,  ///< Image to output, or NULL
-              const psImage *input, ///< rotate this image
-              float angle  ///< rotate by this amount anti-clockwise (degrees)
-             );
-
-/// Shift image by an arbitrary number of pixels in either direction.
-/// Drop edge pixels, and set newly exposed pixels to 'exposed'.
-psImage *
-psImageShift(psImage *out,  ///< Image to output, or NULL
-             const psImage *input, ///< shift this image
-             float dx,   ///< shift by this amount in x
-             float dy,   ///< shift by this amount in y
-             float exposed  ///< set exposed pixels to this value
-            );
-
-/// Roll image by an integer number of pixels in either direction.
-/// Edge pixels wrap to the other side (no values are lost).
-psImage *
-psImageRoll(psImage *out,  ///< Image to output, or NULL
-            const psImage *input, ///< roll this image
-            int dx,    ///< roll this amount in x
-            int dy   ///< roll this amount in y
-           );
-
-/// Determine statistics for image (or subimage).
-psStats *
-psImageGetStats(const psImage *input,  ///< image (or subimage) to calculate stats
-                psStats *stats  ///< defines statistics to be calculated & target
-               );
-
-/// Construct a histogram from an image (or subimage).
-psHistogram *
-psImageHistogram(psHistogram *hist, ///< input histogram description & target
-                 const psImage *input ///< determine histogram of this image
-                );
-
-/// Fit a 2-D polynomial surface to an image.
-psPolynomial2D *
-psImageFitPolynomial(const psImage *input, ///< image to fit
-                     psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
-                    );
-
-/// Evaluate a 2-D polynomial surface to image pixels.
-int
-psImageEvalPolynomial(const psImage *input, ///< image to fit
-                      const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
-                     );
-
-/*** image input/output routines ***/
-/// Read an image or subimage from a named file.
-psImage *
-psImageReadSection(psImage *output,  ///< place data in this structure for output
-                   int x,   ///< starting x coord of region
-                   int y,   ///< starting y coord of region
-                   int nx,   ///< x size of region (-1 for full range)
-                   int ny,   ///< y size of region (-1 for full range)
-                   int z,   ///< plane of interest
-                   const char *extname, ///< MEF extension name ("PHU" for primary header)
-                   int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                   const char *filename ///< file to read data from
-                  );
-
-/// Read an image or subimage from file descriptor.
-psImage *
-psImageFReadSection(psImage *output, ///< place data in this structure for output
-                    int x,  ///< starting x coord of region
-                    int y,  ///< starting y coord of region
-                    int nx,  ///< x size of region (-1 for full range)
-                    int ny,  ///< y size of region (-1 for full range)
-                    int z,  ///< plane of interest
-                    const char *extname, ///< MEF extension name ("PHU" for primary header)
-                    int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                    FILE *f  ///< file descriptor to read data from
-                   );
-
-/// Write an image section to named file (which may exist).
-psImage *
-psImageWriteSection(psImage *input,    ///< image to write out
-                    int x,   ///< starting x coord of region
-                    int y,   ///< starting y coord of region
-                    int z,   ///< plane of interest
-                    const char *extname, ///< MEF extension name ("PHU" for primary header)
-                    int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                    const char *filename ///< file to write data to
-                   );
-
-/// Write an image section to named file (which may exist).
-psImage *
-psImageFWriteSection(psImage *input, ///< image to write out
-                     int x,   ///< starting x coord of region
-                     int y,   ///< starting y coord of region
-                     int z,   ///< plane of interest
-                     const char *extname, ///< MEF extension name
-                     int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                     FILE *f  ///< file descriptor to write data to
-                    );
-
-/// Read only header from image file.
-psMetadata *
-psImageReadHeader(psMetadata *output, ///< read data to this structure
-                  const char *extname,  ///< MEF extension name ("PHU" for primary header)
-                  int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                  const char *filename ///< file to read from
-                 );
-
-/// Read only header from image file descriptor.
-psMetadata *
-psImageFReadHeader(psMetadata *output, ///< read data to this structure
-                   const char *extname, ///< MEF extension name ("PHU" for primary header)
-                   int extnum,  ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-                   FILE *f  ///< file descriptor to read from
-                  );
-
-/*** basic pixel manipulations ***/
-/// Clip image values outside of range to given values.  Return number of clipped pixels.
-int
-psImageClip(psImage *input,   ///< clip this image
-            float min,   ///< clip pixels with values < min
-            float vmin,   ///< set min-clipped pixels to vmin
-            float max,   ///< clip pixels with values > max
-            float vmax   ///< set max-clipped pixels to vmax
-           );
-
-/// Clip NaN image pixels to given value.  Return number of clipped pixels.
-int
-psImageClipNaN(psImage *input,  ///< clip this image & target
-               float value  ///< set nan pixels to this value
-              );
-
-/// Overlay subregion of image with another image.  Return number of pixels replaced.
-int
-psImageOverlaySection(psImage *image, ///< input image & target
-                      const psImage *overlay, ///< image to overlay
-                      int x0,  ///< x offset of overlay subimage
-                      int y0,  ///< y offset of overlay subimage
-                      const char *op ///< overlay operation
-                     );
-
-/* \} */ // End of AstroGroup Functions
-
-# endif
-/* image overlay operations
-    PS_OVERLAY_EQUALS   = '=', 
-    PS_OVERLAY_ADD      = '+', 
-    PS_OVERLAY_SUBTRACT = '-', 
-    PS_OVERLAY_MULTIPLY = '*', 
-    PS_OVERLAY_DIVIDE   = '/', 
-*/
