Index: trunk/psModules/src/camera/pmFPACopy.c
===================================================================
--- trunk/psModules/src/camera/pmFPACopy.c	(revision 7278)
+++ trunk/psModules/src/camera/pmFPACopy.c	(revision 7382)
@@ -2,7 +2,5 @@
 #include <assert.h>
 
-#include "pslib.h"
-#include "psImageFlip.h"
-#include "psRegionIsBad.h"
+#include <pslib.h>
 
 #include "pmFPA.h"
@@ -17,34 +15,4 @@
 // File-static functions
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-// Copy pixels from a target image to a source image, with flips
-static psImage *copyPixels(psImage *source, // Source image (from source cell)
-                           bool xFlip,      // Flip in x?
-                           bool yFlip       // Flip in y?
-                          )
-{
-    assert(source);
-
-    psImage *copy = psMemIncrRefCounter(source);
-    bool copied = false;                // Have the pixels been copied?
-    if (xFlip) {
-        psImage *temp = psImageFlipX(copy); // Flipped version
-        psFree(copy);
-        copy = temp;
-        copied = true;
-    }
-    if (yFlip) {
-        psImage *temp = psImageFlipY(copy); // Flipped version
-        psFree(copy);
-        copy = temp;
-        copied = true;
-    }
-    if (!copied) {
-        psFree(copy);
-        copy = psImageCopy(NULL, source, source->type.type);
-    }
-
-    return copy;
-}
 
 // Bin a region down by specified factors in x and y
@@ -154,5 +122,5 @@
                     psFree(targetReadout->image);
                 }
-                targetReadout->image = copyPixels(sourceReadout->image, xFlip, yFlip);
+                targetReadout->image = psImageFlip(NULL, sourceReadout->image, xFlip, yFlip);
             }
 
@@ -162,5 +130,5 @@
                     psFree(targetReadout->mask);
                 }
-                targetReadout->mask = copyPixels(sourceReadout->mask, xFlip, yFlip);
+                targetReadout->mask = psImageFlip(NULL, sourceReadout->mask, xFlip, yFlip);
             }
 
@@ -170,5 +138,5 @@
                     psFree(targetReadout->weight);
                 }
-                targetReadout->weight = copyPixels(sourceReadout->weight, xFlip, yFlip);
+                targetReadout->weight = psImageFlip(NULL, sourceReadout->weight, xFlip, yFlip);
             }
 
@@ -181,5 +149,5 @@
             psImage *bias = NULL;           // Bias image from iteration
             while ((bias = psListGetAndIncrement(biasIter))) {
-                psImage *biasCopy = copyPixels(bias, xFlip, yFlip);
+                psImage *biasCopy = psImageFlip(NULL, bias, xFlip, yFlip);
                 psListAdd(targetReadout->bias, PS_LIST_TAIL, biasCopy);
                 psFree(biasCopy);           // Drop reference
@@ -209,5 +177,5 @@
     if (xBin != 1 || yBin != 1) {
         psRegion *trimsec = psMetadataLookupPtr(&mdok, target->concepts, "CELL.TRIMSEC"); // The trim section
-        if (mdok && trimsec && !psRegionIsBad(*trimsec)) {
+        if (mdok && trimsec && !psRegionIsNaN(*trimsec)) {
             binRegion(trimsec, xBin, yBin);
         }
@@ -217,5 +185,5 @@
             psRegion *biassec = NULL;   // Bias section, from iteration
             while ((biassec = psListGetAndIncrement(biassecsIter))) {
-                if (!psRegionIsBad(*biassec)) {
+                if (!psRegionIsNaN(*biassec)) {
                     binRegion(biassec, xBin, yBin);
                 }
