Index: trunk/psModules/src/pmSubtractBias.c
===================================================================
--- trunk/psModules/src/pmSubtractBias.c	(revision 1862)
+++ trunk/psModules/src/pmSubtractBias.c	(revision 1862)
@@ -0,0 +1,105 @@
+/** @file  psMinimize.c
+ *  \brief basic minimization functions
+ *  @ingroup Math
+ *
+ *  This file will contain a module which will subtract the detector bias
+ *  in place from an input image.
+ *
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-23 06:48:30 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ *  XXX: This is psuedo code.  It does not compile.
+ */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include<stdio.h>
+#include<math.h>
+#include "pslib.h"
+
+
+//#include "pmSubtractBias.h"
+//    PM_OVERSCAN_NONE,                         ///< No overscan subtraction
+//    PM_OVERSCAN_ROWS,                         ///< Subtract rows
+//    PM_OVERSCAN_COLUMNS,                      ///< Subtract columns
+//    PM_OVERSCAN_ALL                           ///< Subtract the statistic of all pixels in overscan region
+//} pmOverScanAxis;
+//typedef enum {
+//    PM_FIT_NONE,                              ///< No fit
+//    PM_FIT_POLYNOMIAL,                        ///< Fit polynomial
+//    PM_FIT_SPLINE                             ///< Fit cubic splines
+
+
+psReadout *psSubtractFrame(in, bias)
+{
+    if (bias == NULL) {
+        return(in);
+    }
+    // XXX: Check sizes
+    // XXX: use offsets
+
+    for (i=0;i<rows;i++)
+        for (j=0;j<cols;j++)
+            in[i][j]-=bias[i][j];
+}
+
+psReadout *pmSubtractBias(psReadout *in,
+                          void *fitSpec,
+                          const psList *overscans,
+                          pmOverscanAxis overScanAxis,
+                          const psStats *stat,
+                          int nBin,
+                          pmFit fit,
+                          const psReadout *bias)
+{
+    if ((overscans == NULL) &&
+            (overScanAxis != PM_OVERSCAN_NONE)) {
+        //XXX: psErrorMsg()
+    }
+    if ((overscans != NULL) &&
+            (overScanAxis == PM_OVERSCAN_NONE)) {
+        //XXX: psWarningMsg()
+        psSubtractFrame(in, bias);
+    }
+    if (overScanAxis == PM_OVERSCAN_ALL) {
+        psImageStats(in->image..., stat);
+        psSubtractScalarFromImage(...);
+        return()?
+          }
+          if (((overScanAxis == PM_OVERSCAN_NONE) ||
+                  (overScanAxis == PM_OVERSCAN_ALL)) &&
+                  (fit == PM_FIT_NONE)) {
+              //XXX: psWarningMsg()
+              //XXX: Then what?
+          }
+          if (overScanAxis == PM_OVERSCAN_ROW) {
+              myVec = reduce the overscan area to a vector
+                  }
+                  if (overScanAxis == PM_OVERSCAN_COL) {
+                      myVec = reduce the overscan area to a vector
+                          }
+                          if (nBin > 0) {
+                              psVector *myBin = psVectorAlloc(nBin, PS_TYPE_F32);
+                          }
+                          if (!((fitSpec == NULL) || (fit ==PM_FIT_NONE))) {
+                              fit the vector to a linear or cubic spline.
+                          }
+
+                          if (overScanAxis == PM_OVERSCAN_ROW) {
+                              for (i=0;i<rows;i++)
+                                  for (j=0;j<cols;j++)
+                                      image[i][j]-= myBin[i];
+                          }
+                          if (overScanAxis == PM_OVERSCAN_COLUMN) {
+                              for (i=0;i<rows;i++)
+                                  for (j=0;j<cols;j++)
+                                      image[i][j]-= myBin[j];
+                          }
+                          return(in);
+}
+
Index: trunk/psModules/src/pmSubtractBias.h
===================================================================
--- trunk/psModules/src/pmSubtractBias.h	(revision 1862)
+++ trunk/psModules/src/pmSubtractBias.h	(revision 1862)
@@ -0,0 +1,50 @@
+/** @file  pmSubtractBias.h
+ *  \brief basic minimization functions
+ *  @ingroup Math
+ *
+ *  This file will contain a module which will subtract the detector bias
+ *  in place from an input image.
+ *
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-23 06:48:30 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#if !defined(PM_SUBTRACT_BIAS_H)
+#define PM_SUBTRACT_BIAS_H
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include<stdio.h>
+#include<math.h>
+#include "pslib.h"
+
+typedef enum {
+    PM_OVERSCAN_NONE,                         ///< No overscan subtraction
+    PM_OVERSCAN_ROWS,                         ///< Subtract rows
+    PM_OVERSCAN_COLUMNS,                      ///< Subtract columns
+    PM_OVERSCAN_ALL                           ///< Subtract the statistic of all pixels in overscan region
+} pmOverScanAxis;
+
+typedef enum {
+    PM_FIT_NONE,                              ///< No fit
+    PM_FIT_POLYNOMIAL,                        ///< Fit polynomial
+    PM_FIT_SPLINE                             ///< Fit cubic splines
+} pmFit;
+
+psReadout *pmSubtractBias(psReadout *in,
+                          void *fitSpec,
+                          const psList *overscans,
+                          pmOverscanAxis overScanAxis,
+                          const psStats *stat,
+                          int nBin,
+                          pmFit fit,
+                          const psReadout *bias);
+
+#endif
