Index: trunk/psModules/src/pmImageCombine.c
===================================================================
--- trunk/psModules/src/pmImageCombine.c	(revision 4227)
+++ trunk/psModules/src/pmImageCombine.c	(revision 4290)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-13 20:27:06 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-16 23:11:41 $
  *
  *  XXX: pmRejectPixels() has a known bug with the pmImageTransform() call.
@@ -207,5 +207,4 @@
                                 (fabs(sigmaClip * stdev) + fabs(combinedPixel))) {
                             numRejects++;
-                            //printf("Rejecting pixel.  Image %d.  (row, col) (%d, %d)\n", im, row, col);
                             pixelMask->data.U8[im] = maskVal;
                             //
@@ -225,4 +224,5 @@
                             ((psPixels *) ((*questionablePixels)->data[im]))->data[ptr].y = row;
                             (qpPtr->data.S32[im])++;
+                            // XXX: this pixel ->n increment is wierd
                             ((psPixels *) ((*questionablePixels)->data[im]))->n = qpPtr->data.S32[im];
                         }
@@ -341,5 +341,4 @@
     return median / image->data.F32[y][x];
 }
-
 
 /******************************************************************************
@@ -361,5 +360,4 @@
     myRegion.y0 = PS_MAX_F32;
     myRegion.y1 = PS_MIN_F32;
-
     psPlane in;
     psPlane out;
@@ -465,5 +463,4 @@
      I think they mean syncs with PWP.
 XXX: Must add mask parameter, use it in gradient calculation.
-XXX: This function does not work.
  *****************************************************************************/
 psArray *pmRejectPixels(const psArray *images,          ///< Array of input images
@@ -475,5 +472,4 @@
                        )
 {
-    psLogMsg(__func__, PS_LOG_WARN, "WARNING: pmRejectPixels() has known bugs.  Specifically, in the psImageTransform() call.\n");
     PS_ASSERT_PTR_NON_NULL(images, NULL);
     PS_ASSERT_PTR_NON_NULL(errors, NULL);
@@ -534,17 +530,8 @@
         // Transform that mask image into detector coordinate space
         //
-        psRegion myRegion = DetermineRegion(maskImageF32, myOutToIn);
+        psRegion myRegionXForm = DetermineRegion(maskImageF32, myOutToIn);
         psImage *transformedImage = psImageTransform(NULL, NULL, maskImageF32, NULL,
-                                    0, myOutToIn, myRegion, NULL,
+                                    0, myOutToIn, myRegionXForm, NULL,
                                     PS_INTERPOLATE_BILINEAR, 0);
-        //
-        // XXX: Currently, a possibly buggy psImageTransform() corrupts the data in
-        // in outToIn, and possibly other places.  The following printf() demonstrates
-        // this in conjunction with the test code.
-        //
-        //
-        // psPlaneTransform *tmpOutToIn2 = (psPlaneTransform *) outToIn->data[0];
-        // printf("tmpOutToIn2: (%d, %d) (%d %d)\n", tmpOutToIn2->x->nX, tmpOutToIn2->x->nY, tmpOutToIn2->y->nX, tmpOutToIn2->y->nY);
-        //
 
         //
@@ -566,5 +553,4 @@
                 psF32 meanGrads = 0.0;
                 psS32 numGrads = 0;
-
                 //
                 // Loop through all other images, calculate their mean gradient.
@@ -599,5 +585,4 @@
                     // pixelList is large enough; if not, we realloc()
                     //
-
                     psS32 ptr = rPtr->data.S32[im];
                     psPixels *pixelListPtr = (psPixels *) rejects->data[im];
@@ -611,9 +596,10 @@
                     ((psPixels *) rejects->data[im])->data[ptr].y = (pixelList->data[p]).y;
                     (rPtr->data.S32[im])++;
+                    // XXX: this pixel ->n increment is wierd
+                    (((psPixels *) rejects->data[im])->n)++;
                 }
             }
         }
-        psFree(myInToOut);
-        psFree(myOutToIn);
+
         psFree(maskImage);
         psFree(maskImageF32);
@@ -625,3 +611,2 @@
     return(rejects);
 }
-
