Index: trunk/psModules/src/astrom/pmFPARead.c
===================================================================
--- trunk/psModules/src/astrom/pmFPARead.c	(revision 6894)
+++ trunk/psModules/src/astrom/pmFPARead.c	(revision 6896)
@@ -34,6 +34,9 @@
         return NULL;
     }
-    psRegion region = psRegionSet(trimsec->x0, trimsec->x1, MAX(trimsec->y0 - readout->row0, 0),
-                                  MIN(trimsec->y1 - readout->row0, image->numRows));
+    psRegion region = psRegionSet(MAX(trimsec->x0 - readout->col0, 0), // x0
+                                  MIN(trimsec->x1 - readout->col0, image->numCols), // x1
+                                  MAX(trimsec->y0 - readout->row0, 0), // y0
+                                  MIN(trimsec->y1 - readout->row0, image->numRows) // y1
+                                 );
     if (readout->image) {
         psFree(readout->image);         // Make way!
@@ -57,6 +60,9 @@
             return NULL;
         }
-        psRegion region = psRegionSet(biassec->x0, biassec->x1, MAX(biassec->y0 - readout->row0, 0),
-                                      MIN(biassec->y1 - readout->row0, image->numRows));
+        psRegion region = psRegionSet(MAX(biassec->x0 - readout->col0, 0), // x0
+                                      MIN(biassec->x1 - readout->col0, image->numCols), // x1
+                                      MAX(biassec->y0 - readout->row0, 0), // y0
+                                      MIN(biassec->y1 - readout->row0, image->numRows) // y1
+                                     );
         psImage *overscan = psMemIncrRefCounter(psImageSubset(image, region));
         psListAdd(readout->bias, PS_LIST_TAIL, overscan);
@@ -76,5 +82,5 @@
                        psFits *fits,    // FITS file from which to read
                        int z,           // Readout number/plane; zero-offset indexing
-                       int numRows      // The number of rows to read
+                       int numScans     // The number of scans to read
                       )
 {
@@ -96,12 +102,17 @@
     // Get the trim and bias sections
     bool mdok = true;                   // Status of MD lookup
-    psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC");
+    psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim sections
     if (!mdok || !trimsec || psRegionIsBad(*trimsec)) {
         psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set.\n");
         return false;
     }
-    psList *biassecs = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.BIASSEC");
+    psList *biassecs = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.BIASSEC"); // Bias sections
     if (!mdok || !biassecs) {
         psError(PS_ERR_IO, true, "CELL.BIASSEC is not set.\n");
+        return false;
+    }
+    int readdir = psMetadataLookupS32(&mdok, cell->concepts, "CELL.READDIR"); // Read direction
+    if (!mdok || readdir == 0 || (readdir != -1 && readdir != 1)) {
+        psError(PS_ERR_IO, true, "CELL.READDIR is not set to -1 or +1.\n");
         return false;
     }
@@ -150,15 +161,28 @@
     int offset = readout->row0;         // The row number to read
     if (readout->image) {
-        offset += readout->image->numRows;
-    }
-    if (offset >= naxis2) {
+        if (readdir > 0) {
+            // Reading rows
+            offset += readout->image->numRows;
+        } else {
+            // Reading columns
+            offset += readout->image->numCols;
+        }
+    }
+    if ((readdir > 0 && offset >= naxis2) || (readdir < 0 && offset > naxis1)) {
         // We've read everything there is
         return false;
     }
-    int upper = offset + numRows;       // The upper limit for the pixel read
-    if (upper > naxis2) {
+    int upper = offset + numScans;      // The upper limit for the pixel read
+    if (readdir > 0 && upper > naxis2) {
         upper = naxis2;
-    }
-    psRegion region = psRegionSet(0, naxis1, offset, upper); // Region to be read
+    } else if (readdir < 0 && upper > naxis1) {
+        upper = naxis1;
+    }
+    psRegion region = {0, 0, 0, 0};     // Region to be read
+    if (readdir > 0) {
+        region = psRegionSet(0, naxis1, offset, upper); // Read rows
+    } else {
+        region = psRegionSet(offset, upper, 0, naxis2); // Read columns
+    }
     psImage *image = psFitsReadImage(fits, region, z); // The image
 
@@ -177,4 +201,5 @@
     hdu->images->data[z] = image;
     readout->row0 = region.y0;
+    readout->col0 = region.x0;
     readoutCarve(readout, image, trimsec, biassecs);
 
