Index: trunk/psModules/src/imcombine/pmSubtractionVisual.c
===================================================================
--- trunk/psModules/src/imcombine/pmSubtractionVisual.c	(revision 29599)
+++ trunk/psModules/src/imcombine/pmSubtractionVisual.c	(revision 29600)
@@ -19,4 +19,5 @@
 #include "pmSubtractionStamps.h"
 #include "pmSubtractionEquation.h"
+#include "pmSubtractionKernels.h"
 
 #include "pmVisual.h"
@@ -40,4 +41,5 @@
 static int kapa2 = -1;
 static int kapa3 = -1;
+static int kapa4 = -1;
 
 /** function prototypes*/
@@ -61,5 +63,5 @@
  *  @param convKernels the kernels to plot
  *    @return true for success */
-bool pmSubtractionVisualPlotConvKernels(psImage *convKernels) {
+bool pmSubtractionVisualPlotConvKernels(pmSubtractionKernels *kernels) {
 
     if (!pmVisualTestLevel("ppsub.kernels", 1)) return true;
@@ -67,9 +69,12 @@
     if (!plotConvKernels) return true;
 
-    if (!pmVisualInitWindow(&kapa1, "ppSub:Images")) {
+    if (!pmVisualInitWindow(&kapa4, "kernels")) {
         return false;
     }
-    pmVisualScaleImage(kapa1, convKernels, "Convolution_Kernels", 0, true);
+
+    psImage *convKernels = pmSubtractionKernelsImageMosaic(kernels);
+    pmVisualScaleImage(kapa4, convKernels, "Convolution_Kernels", 0, true);
     pmVisualAskUser(&plotConvKernels);
+    psFree(convKernels);
     return true;
 }
@@ -549,5 +554,5 @@
     for (int y = -footprint; y <= footprint; y++) {
 	for (int x = -footprint; x <= footprint; x++) {
-	    convolutionImage->data.F32[y + NYpix][x + NXpix] = -convolution->kernel[y][x];
+	    convolutionImage->data.F32[y + NYpix][x + NXpix] = convolution->kernel[y][x];
 	    sum += convolutionImage->data.F32[y + NYpix][x + NXpix];
 	}
@@ -584,4 +589,26 @@
 }
 
+bool pmVisualShowImage(int kapaFD, psImage *inImage, const char *name, int channel, float min, float max) {
+
+    KiiImage image;
+    KapaImageData data;
+    Coords coords;
+    strcpy (coords.ctype, "RA---TAN");
+    
+    image.data2d = inImage->data.F32;
+    image.Nx = inImage->numCols;
+    image.Ny = inImage->numRows;
+    strcpy (data.name, name);
+    strcpy (data.file, name);
+    
+    data.zero  = min;
+    data.range = max;
+    data.logflux = 0;
+    
+    KiiSetChannel (kapaFD, channel);
+    KiiNewPicture2D (kapaFD, &image, &data, &coords);
+    return true;
+}
+
 bool pmSubtractionVisualShowFit(double norm) {
 
@@ -604,34 +631,12 @@
     KiiEraseOverlay (kapa2, "red");
 
-    pmVisualScaleImage(kapa1, targetImage, "Target Stamps", 0, true);
-    pmVisualScaleImage(kapa1, sourceImage, "Source Stamps", 1, true);
-    pmVisualScaleImage(kapa1, convolutionImage, "Convolution Stamps", 2, true);
+    pmVisualShowImage(kapa1, targetImage, "Target", 0, -200.0, 400.0);
+    pmVisualShowImage(kapa1, sourceImage, "Source", 1, -200.0, 400.0);
+    pmVisualShowImage(kapa1, convolutionImage, "Convolution", 2, -200.0, 400.0);
     KiiCenter (kapa1, 0.5*targetImage->numCols, 0.5*targetImage->numRows, 1);
 
-    pmVisualScaleImage(kapa2, fresidualImage, "Frac Residual Stamps", 2, true);
-    pmVisualScaleImage(kapa2, differenceImage, "Difference Stamps", 0, true);
-
-    if (1) {
-	KiiImage image;
-	KapaImageData data;
-	Coords coords;
-	strcpy (coords.ctype, "RA---TAN");
-
-	image.data2d = residualImage->data.F32;
-	image.Nx = residualImage->numCols;
-	image.Ny = residualImage->numRows;
-	strcpy (data.name, "Residual Stamps");
-	strcpy (data.file, "Residual Stamps");
-
-	data.zero  = -300.0;
-	data.range = +600.0;
-	data.logflux = 0;
-
-	KiiSetChannel (kapa2, 1);
-	KiiNewPicture2D (kapa2, &image, &data, &coords);
-    } else {
-	pmVisualScaleImage(kapa2, residualImage, "Residual Stamps", 1, true);
-    }
-
+    pmVisualScaleImage(kapa2, fresidualImage, "Frac.Residual", 2, true);
+    pmVisualShowImage(kapa2, differenceImage, "Difference", 0, -200.0, 400.0);
+    pmVisualShowImage(kapa2, residualImage, "Residual", 1, -200.0, 400.0);
     KiiCenter (kapa2, 0.5*residualImage->numCols, 0.5*residualImage->numRows, 1);
 
