Index: /trunk/pois/src/poisReadStamps.c
===================================================================
--- /trunk/pois/src/poisReadStamps.c	(revision 4557)
+++ /trunk/pois/src/poisReadStamps.c	(revision 4557)
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include "pslib.h"
+#include "pois.h"
+
+psArray *poisReadStamps(psArray *stamps,// Stamps
+			FILE **stampFP, // File pointer for stamps file
+			const poisConfig *config // Configuration
+    )
+{
+    FILE *fp = *stampFP;		// File pointer
+
+    int num = 0;			// Number of stamps
+
+    if (stamps == NULL) {
+	stamps = psArrayAlloc(config->nsx * config->nsy);
+	// Initialise
+	for (int i = 0; i < config->nsx * config->nsy; i++) {
+	    stamps->data[i] = poisStampAlloc();
+	}
+    }
+
+    for (int i = 0; i < stamps->n; i++) {
+	poisStamp *stamp = stamps->data[i];
+
+	if (stamp->status == POIS_STAMP_RESET) {
+	    if (fp) {
+		float x, y;		// Position of stamp
+		int xPixel, yPixel;	// Integer position
+		int result = 0;		// Result of fscanf
+		do {
+		    result = fscanf(fp, "%f %f", &x, &y);
+		    // Add 0.5 for rounding, and subtract 1.0 for unit-offset to zero-offset
+		    xPixel = (int)(x - 0.5);
+		    yPixel = (int)(y - 0.5);
+		} while ((xPixel < config->footprint + config->xKernel ||
+			  yPixel < config->footprint + config->yKernel ||
+			  xPixel > config->xImage - config->footprint - config->xKernel ||
+			  yPixel > config->yImage - config->footprint - config->yKernel) &&
+			 result == 2);
+		if (result == 2) {
+		    stamp->x = xPixel;
+		    stamp->y = yPixel;
+		    stamp->status = POIS_STAMP_RECALC;
+		    psTrace("pois.readStamps", 7, "Stamp %d: %d,%d\n", i, stamp->x, stamp->y);
+		} else {
+		    stamp->status = POIS_STAMP_BAD;
+		}
+	    } else {
+		stamp->status = POIS_STAMP_BAD;
+	    }
+	}
+    }
+
+    return stamps;
+}
+
