Index: branches/simmosaic_branches/ppImage/src/ppImageOptions.c
===================================================================
--- branches/simmosaic_branches/ppImage/src/ppImageOptions.c	(revision 24860)
+++ branches/simmosaic_branches/ppImage/src/ppImageOptions.c	(revision 27839)
@@ -21,4 +21,5 @@
     options->doMaskSat       = false;   // mask saturated pixels
     options->doMaskLow       = false;   // mask low pixels
+    options->doMaskBurntool  = false;   // mask potential burntool trails
     options->doVarianceBuild = false;   // Build internal variance
     options->doMask          = false;   // Mask bad pixels
@@ -31,4 +32,6 @@
     options->doShutter       = false;   // Shutter correction
     options->doFlat          = false;   // Flat-field normalisation
+    options->doPatternRow    = false;   // Row pattern correction
+    options->doPatternCell   = false;   // Cell pattern correction
     options->doFringe        = false;   // Fringe subtraction
     options->doPhotom        = false;   // Source identification and photometry
@@ -63,5 +66,6 @@
     options->blankMask       = 0x00;    // Blank (no data, cell gap) pixels (supplied to pmChipMosaic, pmFPAMosaic)
     options->markValue       = 0x00;    // A safe bit for internal marking
-
+    options->burntoolMask    = 0x00;    // Suspect pixels that fall where a burntool trail is expected.
+    options->burntoolTrails  = 0x07;    // Which types of burntool areas to mask.
     // crosstalk options
     options->doCrosstalkMeasure = false;   // measure crosstalk
@@ -86,4 +90,15 @@
     options->fringeIter      = 0;       // Fringe iterations
     options->fringeKeep      = 1.0;     // Fringe keep fraction
+
+    // Pattern correction values
+
+    options->patternRowOrder    = 0;       // Polynomial order
+    options->patternRowIter     = 0;       // Clipping iterations
+    options->patternRowRej      = NAN;     // Clipping rejection threshold
+    options->patternRowThresh   = NAN;     // Threshold for ignoring pixels
+    options->patternRowMean     = PS_STAT_NONE; // Statistic for mean
+    options->patternRowStdev    = PS_STAT_NONE; // Statistic for standard deviation
+    options->patternCellBG      = PS_STAT_NONE; // Statistic for background
+    options->patternCellMean    = PS_STAT_NONE; // Statistic for mean
 
     // Remnance values
@@ -209,4 +224,5 @@
     options->doMaskSat   = psMetadataLookupBool(NULL, recipe, "MASK.SATURATED");
     options->doMaskLow   = psMetadataLookupBool(NULL, recipe, "MASK.LOW");
+    options->doMaskBurntool = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");
     options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
 
@@ -225,4 +241,6 @@
     options->doFringe = psMetadataLookupBool(NULL, recipe, "FRINGE");
     options->doShutter = psMetadataLookupBool(NULL, recipe, "SHUTTER");
+    options->doPatternRow = psMetadataLookupBool(NULL, recipe, "PATTERN.ROW");
+    options->doPatternCell = psMetadataLookupBool(NULL, recipe, "PATTERN.CELL");
 
     options->doStats = false;
@@ -234,13 +252,21 @@
     options->applyParity = psMetadataLookupBool(NULL, recipe, "APPLY.CELL.PARITY");
 
+    options->burntoolTrails = psMetadataLookupS32(&status, recipe, "BURNTOOL.TRAILS");
+    psTrace("psModules.detrend", 7, "burntoolTrails: %d BURNTOOL.TRAILS: %d Status: %d\n",
+            options->burntoolTrails,psMetadataLookupS32(&status,recipe,"BURNTOOL.TRAILS"),status);
+    if (!status) {
+      psWarning("BURNTOOL.TRAILS not found in recipe: setting to default value.\n");
+    }
+
     // binned image options
     options->xBin1 = psMetadataLookupS32(&status, recipe, "BIN1.XBIN");
     if (!status) {
         psWarning("BIN1.XBIN not found in recipe: setting to default value.\n");
+        options->xBin1 = 4;
     }
     options->yBin1 = psMetadataLookupS32(&status, recipe, "BIN1.YBIN");
     if (!status) {
         psWarning("BIN1.YBIN not found in recipe: setting to default value.\n");
-        options->yBin1 = 16;
+        options->yBin1 = 4;
     }
 
@@ -298,4 +324,14 @@
     options->fringeKeep = psMetadataLookupF32(NULL, recipe, "FRINGE.KEEP");
 
+    // Pattern correction
+    options->patternRowOrder = psMetadataLookupS32(NULL, recipe, "PATTERN.ROW.ORDER");
+    options->patternRowIter = psMetadataLookupS32(NULL, recipe, "PATTERN.ROW.ITER");
+    options->patternRowRej = psMetadataLookupF32(NULL, recipe, "PATTERN.ROW.REJ");
+    options->patternRowThresh = psMetadataLookupF32(NULL, recipe, "PATTERN.ROW.THRESH");
+    options->patternRowMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.ROW.MEAN"));
+    options->patternRowStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.ROW.STDEV"));
+    options->patternCellBG = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.CELL.BG"));
+    options->patternCellMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.CELL.MEAN"));
+
     // Remnance options
     options->remnanceSize = psMetadataLookupF32(NULL, recipe, "REMNANCE.SIZE");
