Index: trunk/psLib/src/imageops/psImageInterpolate.c
===================================================================
--- trunk/psLib/src/imageops/psImageInterpolate.c	(revision 13470)
+++ trunk/psLib/src/imageops/psImageInterpolate.c	(revision 13483)
@@ -7,6 +7,6 @@
  *  @author Paul Price, IfA
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-04-11 19:54:47 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-05-23 02:55:01 $
  *
  *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
@@ -65,6 +65,7 @@
 
 // Interpolation engine for flat mode (nearest pixel)
-static inline bool interpolateFlat(double *imageValue, double *varianceValue, psMaskType *maskValue,
-                                   float x, float y, const psImageInterpolateOptions *options)
+static inline psImageInterpolateStatus interpolateFlat(double *imageValue, double *varianceValue,
+                                                       psMaskType *maskValue, float x, float y,
+                                                       const psImageInterpolateOptions *options)
 {
     // Parameters have been checked by psImageInterpolate()
@@ -87,4 +88,6 @@
             *maskValue = options->badMask;
         }
+
+        return PS_INTERPOLATE_STATUS_OFF;
     } else {
 
@@ -115,5 +118,5 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     options->image->type.type);
-            return false;
+            return PS_INTERPOLATE_STATUS_ERROR;
         }
 
@@ -122,10 +125,11 @@
         }
     }
-    return true;
+    return PS_INTERPOLATE_STATUS_GOOD;
 }
 
 // Interpolation engine using interpolation kernel
-static bool interpolateKernel(double *imageValue, double *varianceValue, psMaskType *maskValue,
-                               float x, float y, const psImageInterpolateOptions *options)
+static psImageInterpolateStatus interpolateKernel(double *imageValue, double *varianceValue,
+                                                  psMaskType *maskValue, float x, float y,
+                                                  const psImageInterpolateOptions *options)
 {
     // Parameters have been checked by psImageInterpolate()
@@ -171,5 +175,5 @@
             *maskValue = options->badMask;
         }
-        return true;
+        return PS_INTERPOLATE_STATUS_OFF;
     }
     double kernel[yNum][xNum];          // Interpolation kernel for straight interpolation
@@ -259,5 +263,5 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     image->type.type);
-            return false;
+            return PS_INTERPOLATE_STATUS_ERROR;
         }
     }
@@ -265,4 +269,5 @@
     // Check the mask value
     const psImage *mask = options->mask; // Image mask
+    psImageInterpolateStatus status = PS_INTERPOLATE_STATUS_GOOD; // Status of interpolation
     if (maskValue && mask) {
         *maskValue = 0;
@@ -285,6 +290,8 @@
             if (badContrib / totContrib >= options->poorFrac) {
                 *maskValue |= options->badMask;
+                status = PS_INTERPOLATE_STATUS_BAD;
             } else {
                 *maskValue |= options->poorMask;
+            status = PS_INTERPOLATE_STATUS_POOR;
             }
         }
@@ -321,9 +328,9 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     image->type.type);
-            return false;
-        }
-    }
-
-    return true;
+            return PS_INTERPOLATE_STATUS_ERROR;
+        }
+    }
+
+    return status;
 }
 
@@ -364,6 +371,7 @@
 
 // Interpolation engine for separable interpolation kernels (either for good reasons or for practical reasons)
-static bool interpolateSeparate(double *imageValue, double *varianceValue, psMaskType *maskValue,
-                               float x, float y, const psImageInterpolateOptions *options)
+static psImageInterpolateStatus interpolateSeparate(double *imageValue, double *varianceValue,
+                                               psMaskType *maskValue, float x, float y,
+                                               const psImageInterpolateOptions *options)
 {
     // Parameters have been checked by psImageInterpolate()
@@ -406,5 +414,5 @@
             *maskValue = options->badMask;
         }
-        return true;
+        return PS_INTERPOLATE_STATUS_OFF;
     }
 
@@ -477,5 +485,5 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     image->type.type);
-            return false;
+            return PS_INTERPOLATE_STATUS_ERROR;
         }
     }
@@ -483,4 +491,5 @@
     // Check the mask value
     const psImage *mask = options->mask; // Image mask
+    psImageInterpolateStatus status = PS_INTERPOLATE_STATUS_GOOD; // Status of interpolation
     if (maskValue && mask) {
         psMaskType maskVal = options->maskVal; // Mask value
@@ -509,6 +518,8 @@
             if (badContrib / totContrib >= options->poorFrac) {
                 *maskValue |= options->badMask;
+                status = PS_INTERPOLATE_STATUS_BAD;
             } else {
                 *maskValue |= options->poorMask;
+                status = PS_INTERPOLATE_STATUS_POOR;
             }
         }
@@ -547,17 +558,17 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     variance->type.type);
-            return false;
-        }
-    }
-
-    return true;
-}
-
-
-
-bool psImageInterpolate(double *imageValue, double *varianceValue, psMaskType *maskValue,
+            return PS_INTERPOLATE_STATUS_ERROR;
+        }
+    }
+
+    return status;
+}
+
+
+
+psImageInterpolateStatus psImageInterpolate(double *imageValue, double *varianceValue, psMaskType *maskValue,
                         float x, float y, const psImageInterpolateOptions *options)
 {
-    PS_ASSERT_PTR_NON_NULL(options, false);
+    PS_ASSERT_PTR_NON_NULL(options, PS_INTERPOLATE_STATUS_ERROR);
 
     const psImage *image = options->image; // Image to interpolate
@@ -565,17 +576,17 @@
     const psImage *variance = options->variance; // Variance to interpolate
 
-    PS_ASSERT_IMAGE_NON_NULL(image, false);
+    PS_ASSERT_IMAGE_NON_NULL(image, PS_INTERPOLATE_STATUS_ERROR);
     if (varianceValue && variance) {
-        PS_ASSERT_IMAGE_NON_NULL(variance, false);
-        PS_ASSERT_IMAGE_TYPE(variance, image->type.type, false);
-        PS_ASSERT_IMAGES_SIZE_EQUAL(variance, image, false);
+        PS_ASSERT_IMAGE_NON_NULL(variance, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGE_TYPE(variance, image->type.type, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGES_SIZE_EQUAL(variance, image, PS_INTERPOLATE_STATUS_ERROR);
     }
     if (maskValue && mask) {
-        PS_ASSERT_IMAGE_NON_NULL(mask, false);
-        PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_MASK, false);
-        PS_ASSERT_IMAGES_SIZE_EQUAL(mask, image, false);
-    }
-
-    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(options->poorFrac, 0.0, false);
+        PS_ASSERT_IMAGE_NON_NULL(mask, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_MASK, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGES_SIZE_EQUAL(mask, image, PS_INTERPOLATE_STATUS_ERROR);
+    }
+
+    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(options->poorFrac, 0.0, PS_INTERPOLATE_STATUS_ERROR);
 
     switch (options->mode) {
@@ -594,9 +605,9 @@
                 _("Specified interpolation method (%d) is not supported."),
                 options->mode);
-        return false;
+        return PS_INTERPOLATE_STATUS_ERROR;
     }
 
     psAbort("Should never reach here.");
-    return false;
+    return PS_INTERPOLATE_STATUS_ERROR;
 }
 
Index: trunk/psLib/src/imageops/psImageInterpolate.h
===================================================================
--- trunk/psLib/src/imageops/psImageInterpolate.h	(revision 13470)
+++ trunk/psLib/src/imageops/psImageInterpolate.h	(revision 13483)
@@ -7,11 +7,11 @@
  * @author Paul Price, Institute for Astronomy
  *
- * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-04-04 22:42:02 $
+ * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-05-23 02:55:01 $
  * Copyright 2004-2007 Institute for Astronomy, University of Hawaii
  */
 
-#ifndef PS_IMAGE_PIXEL_INTERPOLATE_H
-#define PS_IMAGE_PIXEL_INTERPOLATE_H
+#ifndef PS_IMAGE_INTERPOLATE_H
+#define PS_IMAGE_INTERPOLATE_H
 
 
@@ -28,4 +28,12 @@
 } psImageInterpolateMode;
 
+/// Status of interpolation
+typedef enum {
+    PS_INTERPOLATE_STATUS_ERROR = 0,    ///< There was an error
+    PS_INTERPOLATE_STATUS_OFF,          ///< The pixel fell completely off the image or in the border
+    PS_INTERPOLATE_STATUS_BAD,          ///< The pixel is bad
+    PS_INTERPOLATE_STATUS_POOR,         ///< The pixel is poor
+    PS_INTERPOLATE_STATUS_GOOD,         ///< The pixel is good
+} psImageInterpolateStatus;
 
 /// Options for general interpolation.
@@ -35,14 +43,14 @@
 /// included.
 typedef struct {
-    psImageInterpolateMode mode;        // Interpolation mode
-    const psImage *image;               // Input image for interpolation
-    const psImage *variance;            // Variance image for interpolation
-    const psImage *mask;                // Mask image for interpolation
-    psMaskType maskVal;                 // Value to mask
-    double badImage;                    // Image value if x,y location is not good
-    double badVariance;                 // Variance value if x,y location is not good
-    psMaskType badMask;                 // Mask value to give bad pixels
-    psMaskType poorMask;                // Mask value to give poor pixels
-    float poorFrac;                     // Fraction of flux in bad pixels before output is marked bad
+    psImageInterpolateMode mode;        ///< Interpolation mode
+    const psImage *image;               ///< Input image for interpolation
+    const psImage *variance;            ///< Variance image for interpolation
+    const psImage *mask;                ///< Mask image for interpolation
+    psMaskType maskVal;                 ///< Value to mask
+    double badImage;                    ///< Image value if x,y location is not good
+    double badVariance;                 ///< Variance value if x,y location is not good
+    psMaskType badMask;                 ///< Mask value to give bad pixels
+    psMaskType poorMask;                ///< Mask value to give poor pixels
+    float poorFrac;                     ///< Fraction of flux in bad pixels before output is marked bad
 } psImageInterpolateOptions;
 
@@ -64,9 +72,9 @@
 
 /// Interpolate image pixel value given floating point coordinates.
-bool psImageInterpolate(double *imageValue, ///< Return value for image
-                        double *varianceValue, ///< Return value for variance
-                        psMaskType *maskValue, ///< Return value for mask
-                        float x, float y, ///< Location to which to interpolate
-                        const psImageInterpolateOptions *options ///< Options for interpolation
+psImageInterpolateStatus psImageInterpolate(double *imageValue, ///< Return value for image
+                                            double *varianceValue, ///< Return value for variance
+                                            psMaskType *maskValue, ///< Return value for mask
+                                            float x, float y, ///< Location to which to interpolate
+                                            const psImageInterpolateOptions *options ///< Options
     );
 
