Index: trunk/stac/src/stacRejection.c
===================================================================
--- trunk/stac/src/stacRejection.c	(revision 3387)
+++ trunk/stac/src/stacRejection.c	(revision 3666)
@@ -48,5 +48,7 @@
 		       psArray *maps,	// Maps from input to transformed image
 		       psArray *inverseMaps, // Maps from transformed to input image
-		       stacConfig *config // Configuration
+		       float frac,	// Fraction of pixel rejected before looking more carefully
+		       float grad,	// Gradient limit for rejection
+		       psArray *names	// Names of original images (only for writing out when TESTING)
     )
 {
@@ -58,4 +60,5 @@
     assert(inputs->n == maps->n);
     assert(inputs->n == inverseMaps->n);
+    assert(!names || names->n == inputs->n);
 
     for (int i = 0; i < nImages; i++) {
@@ -93,5 +96,5 @@
 	FILE *crs = NULL;		// File for outputting details of rejected pixels
 	char crfile[MAXCHAR];	// Filename
-	sprintf(crfile,"%s.cr",config->inputs->data[i]);
+	sprintf(crfile,"%s.cr",names->data[i]);
 	if ((crs = fopen(crfile, "w")) == NULL) {
 	    fprintf(stderr, "Unable to open file for detailed output, %s\n");
@@ -119,5 +122,5 @@
 #endif
 
-		    if (maskVal > config->frac) {
+		    if (maskVal > frac) {
 			// Calculate mean gradient on other images
 			float meanGrads = 0.0;
@@ -147,5 +150,5 @@
 #endif
 
-			if (stacGradient(inputs->data[i], x, y) < config->grad * meanGrads) {
+			if (stacGradient(inputs->data[i], x, y) < grad * meanGrads) {
 			    mask->data.U8[y][x] = 1;
 			    nBad++;
@@ -182,7 +185,7 @@
 	char rejmapName[MAXCHAR]; 	// Filename of rejection image
 	char gradName[MAXCHAR];		// Filename of gradient image
-	sprintf(maskName,"%s.mask",config->inputs->data[i]);
-	sprintf(rejmapName,"%s.rejmap",config->inputs->data[i]);
-	sprintf(gradName,"%s.grad",config->inputs->data[i]);
+	sprintf(maskName, "%s.mask", names->data[i]);
+	sprintf(rejmapName, "%s.rejmap", names->data[i]);
+	sprintf(gradName, "%s.grad", names->data[i]);
 
 	psFits *maskFile = psFitsAlloc(maskName);
