Index: trunk/stac/src/stacTransform.c
===================================================================
--- trunk/stac/src/stacTransform.c	(revision 3610)
+++ trunk/stac/src/stacTransform.c	(revision 3666)
@@ -7,9 +7,4 @@
 #define MIN(x,y) (((x) > (y)) ? (y) : (x))
 #define MAX(x,y) (((x) > (y)) ? (x) : (y))
-
-#define MAXCHAR 80
-
-static int numTransforms = 0;		// Number of transformations performed
-
 
 // Hacked the original ps_ImagePixelInterpolateBILINEAR_F32 to add variances
@@ -115,10 +110,8 @@
 		   const psVector *scales, // Relative scales
 		   const psVector *offsets, // Relative offsets
-		   const stacConfig *config // Configuration
+		   int outnx, int outny	// Size of output images
     )
 {
     int nImages = images->n;		// Number of images
-    int nx = config->outnx, ny = config->outny; // Size of output images
-    numTransforms++;
 
     // Check input sizes
@@ -134,7 +127,7 @@
     if (*outputs == NULL) {
 	*outputs = psArrayAlloc(nImages);
-	psTrace("stac.transform", 5, "Allocating space for transformed images, %dx%d\n", nx, ny);
+	psTrace("stac.transform", 5, "Allocating space for transformed images, %dx%d\n", outnx, outny);
 	for (int i = 0; i < nImages; i++) {
-	    (*outputs)->data[i] = psImageAlloc(nx, ny, PS_TYPE_F32);
+	    (*outputs)->data[i] = psImageAlloc(outnx, outny, PS_TYPE_F32);
 	}
     }
@@ -144,7 +137,7 @@
     if (errors && (*outErrors == NULL)) {
 	*outErrors = psArrayAlloc(errors->n);
-	psTrace("stac.transform", 5, "Allocating space for transformed error images, %dx%d\n", nx, ny);
+	psTrace("stac.transform", 5, "Allocating space for transformed error images, %dx%d\n", outnx, outny);
 	for (int i = 0; i < nImages; i++) {
-	    (*outErrors)->data[i] = psImageAlloc(nx, ny, PS_TYPE_F32);
+	    (*outErrors)->data[i] = psImageAlloc(outnx, outny, PS_TYPE_F32);
 	}
     }
@@ -187,6 +180,6 @@
 #if 0
 	// No need for initialisation, since we iterate over the entire output image.
-	for (int y = 0; y < ny; y++) {
-	    for (int x = 0; x < nx; x++) {
+	for (int y = 0; y < outny; y++) {
+	    for (int x = 0; x < outnx; x++) {
 		outImage->data.F32[y][x] = 0.0;
 		outError->data.F32[y][x] = 0.0;
@@ -202,6 +195,6 @@
 
 	// Iterate over the output image pixels
-	for (int y = 0; y < ny; y++) {
-	    for (int x = 0; x < nx; x++) {
+	for (int y = 0; y < outny; y++) {
+	    for (int x = 0; x < outnx; x++) {
 		// Only transform those pixels requested
 		if (!region || (region && region->data.U8[y][x])) {
@@ -229,27 +222,4 @@
 	} // Iterating over output pixels
 
-#ifdef TESTING
-	// Write error image out to check
-	char shiftName[MAXCHAR];	// Filename of shift image
-	char errName[MAXCHAR];		// Filename of error image
-	sprintf(shiftName,"%s.shift.%d",config->inputs->data[n],numTransforms);
-	sprintf(errName,"%s.shifterr.%d",config->inputs->data[n],numTransforms);
-	psTrace("stac.transform.test", 6,
-		"Output files have size: %dx%d\n",outImage->numCols,outImage->numRows);
-
-	psFits *shiftFile = psFitsAlloc(shiftName);
-	psFits *errFile = psFitsAlloc(errName);
-	if (!psFitsWriteImage(shiftFile, NULL, outImage, 0, NULL)) {
-	    psErrorStackPrint(stderr, "Unable to write image: %s\n", shiftName);
-	}
-	psTrace("stac", 1, "Shifted image written to %s\n", shiftName);
-	if (!psFitsWriteImage(errFile, NULL, outError, 0, NULL)) {
-	    psErrorStackPrint(stderr, "Unable to write image: %s\n", errName);
-	}
-	psTrace("stac", 1, "Shifted error image written to %s\n", errName);
-	psFree(shiftFile);
-	psFree(errFile);
-#endif
-
     } // Iterating over images
 
