Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_DEV.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_DEV.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_DEV.c	(revision 35321)
@@ -295,5 +295,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_DEV.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_DEV.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_DEV.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_DEV(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_DEV(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_DEV(pmModel *model, pmSource *source);
+bool pmModelGuess_DEV(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_DEV(const psVector *params);
 psF64 pmModelRadius_DEV(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_EXP.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_EXP.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_EXP.c	(revision 35321)
@@ -287,5 +287,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_EXP.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_EXP.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_EXP.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_EXP(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_EXP(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_EXP(pmModel *model, pmSource *source);
+bool pmModelGuess_EXP(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_EXP(const psVector *params);
 psF64 pmModelRadius_EXP(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_GAUSS.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_GAUSS.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_GAUSS.c	(revision 35321)
@@ -192,5 +192,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_GAUSS.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_GAUSS.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_GAUSS.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_GAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_GAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_GAUSS(pmModel *model, pmSource *source);
+bool pmModelGuess_GAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_GAUSS(const psVector *params);
 psF64 pmModelRadius_GAUSS(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PGAUSS.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PGAUSS.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PGAUSS.c	(revision 35321)
@@ -193,5 +193,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PGAUSS.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PGAUSS.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PGAUSS.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_PGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_PGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source);
+bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_PGAUSS(const psVector *params);
 psF64 pmModelRadius_PGAUSS(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PS1_V1.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PS1_V1.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PS1_V1.c	(revision 35321)
@@ -212,5 +212,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PS1_V1.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PS1_V1.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_PS1_V1.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_PS1_V1(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_PS1_V1(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source);
+bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_PS1_V1(const psVector *params);
 psF64 pmModelRadius_PS1_V1(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_QGAUSS.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_QGAUSS.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_QGAUSS.c	(revision 35321)
@@ -213,5 +213,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_QGAUSS.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_QGAUSS.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_QGAUSS.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_QGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_QGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source);
+bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_QGAUSS(const psVector *params);
 psF64 pmModelRadius_QGAUSS(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_RGAUSS.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_RGAUSS.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_RGAUSS.c	(revision 35321)
@@ -202,5 +202,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_RGAUSS.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_RGAUSS.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_RGAUSS.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_RGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_RGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source);
+bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_RGAUSS(const psVector *params);
 psF64 pmModelRadius_RGAUSS(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_SERSIC.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_SERSIC.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_SERSIC.c	(revision 35321)
@@ -307,5 +307,5 @@
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     pmMoments *moments = source->moments;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_SERSIC.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_SERSIC.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_SERSIC.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_SERSIC(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_SERSIC(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_SERSIC(pmModel *model, pmSource *source);
+bool pmModelGuess_SERSIC(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_SERSIC(const psVector *params);
 psF64 pmModelRadius_SERSIC(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_TRAIL.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_TRAIL.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_TRAIL.c	(revision 35321)
@@ -168,4 +168,13 @@
         dPAR[PM_PAR_THETA]  = PAR[PM_PAR_I0] * dPdT;
         dPAR[PM_PAR_SIGMA]  = 0;	// we don't actually allow this to vary, so we do not need to calculate it
+
+	for (int i = 0; i < 7; i++) {
+	  if (isnan(dPAR[i])) {
+	    fprintf (stderr, "*");
+	  }
+	}
+    }
+    if (isnan(f)) {
+      fprintf (stderr, "!");
     }
     return(f);
@@ -228,7 +237,111 @@
 }
 
+# define NA 21
+# define NR 21
+static float flux[NA][NR];
+static float npix[NA][NR];
+
+bool pmTrailGetAngle (float *To, float *Io, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal, float sigma) {
+
+  float Xo, Yo;
+  if (!pmModelSetPosition(&Xo, &Yo, source)) return false;
+
+  psImage *image = source->pixels;
+  psImage *mask = source->maskObj;
+  psF32 **imData = image->data.F32;
+  psImageMaskType **mkData = mask->data.PS_TYPE_IMAGE_MASK_DATA;
+
+  // do a loop over the pixels, generating (dX,dY) dot (cos(theta),sin(theta))
+  int dP;
+  int dX = Xo - mask->col0;
+  dP = mask->numCols - dX;
+  int DX = PS_MAX(dP, dX);
+  int NX = mask->numCols;
+
+  int dY = Yo - mask->row0;
+  dP = mask->numRows - dY;
+  int DY = PS_MAX(dP, dY);
+  int NY = mask->numRows;
+
+  // just hard wire this for now...
+  float radius = 10.0;
+  float radius2 = PS_SQR(radius);
+
+  // we have an array of Angles x Radii
+  float dT = M_PI / NA;
+  for (int na = 0; na < NA; na++) {
+    memset (flux[na], 0, NR*sizeof(float));
+    memset (npix[na], 0, NR*sizeof(float));
+  }
+
+  // we skip any pixels [real or virtual] outside of the specified radius (nominally the aperture radius)
+  // ix and iy track pixels relative to the centroid
+  for (int ix = -DX; ix < DX + 1; ix++) {
+    if (ix > radius) continue;
+    int mx = ix + dX;
+    for (int iy = -DY; iy < DY + 1; iy++) {
+      if (iy > radius) continue;
+      if (ix*ix + iy*iy > radius2) continue;
+      int my = iy + dY;
+      
+      // include count only the unmasked pixels within the image area
+      if (mx < 0) continue;
+      if (my < 0) continue;
+      if (mx >= NX) continue;
+      if (my >= NY) continue;
+      
+      // count pixels which are masked only with bad pixels
+      if (mkData[my][mx] & maskVal)continue;
+
+      // we have defined NA to be 21
+      int na = 0;
+      for (float angle = 0.0; na < NA; angle += dT, na ++) {
+
+	// XXX optimization : pre-compute the angle sines and cosines
+	float Rad = (ix * cos(angle)) + (iy * sin(angle));
+	int nr = PS_MAX (PS_MIN (NR, Rad + 0.5*NR), 0);
+
+	flux[na][nr] += imData[my][mx];
+	npix[na][nr] ++;
+      }
+    }
+  }
+
+  // generate a psf model (with integral of 1.0)
+  float Ao = 1.0 / sqrt(2*M_PI) / sigma;
+  float psf[NR];
+  for (int nr = 0; nr < NR; nr++) {
+    psf[nr] = Ao*exp(-0.5*PS_SQR((nr - 0.5*NR)/sigma));
+  }
+
+  float fangle[NA];
+  for (int na = 0; na < NA; na++) {
+    float fpsf = 0.0;
+    for (int nr = 0; nr < NR; nr++) {
+      fpsf += psf[nr]*flux[na][nr];
+    }
+    fangle[na] = fpsf;
+    // fprintf (stderr, "fpsf: %f, theta = %f\n", fpsf, PS_DEG_RAD*dT*na);
+  }
+
+  float peak = fangle[0];
+  int pbin = 0;
+  for (int na = 0; na < NA; na++) {
+    if (fangle[na] > peak) {
+      peak = fangle[na];
+      pbin = na;
+    }
+  }
+
+  // result is peak, pbin -> angle
+  *To = dT * pbin;
+  *Io = peak * Ao;
+  
+  return true;
+}
+
 // make an initial guess for parameters
 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
-bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
+bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psF32 *PAR  = model->params->data.F32;
@@ -260,4 +373,7 @@
     //else { size = psfAxes.major; }
 
+    float theta, peak;
+    pmTrailGetAngle (&theta, &peak, source, maskVal, markVal, psfAxes.major);
+
     // axes.major is a sigma in the major direction; scale to 
     PAR[PM_PAR_LENGTH] = 1.5*2.35*size; // a tophat of length L has L = 1.5 * 2.35 * sigma
@@ -266,7 +382,8 @@
 
     // set the model normalization
-    if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
-      return false;
-    }
+    // if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
+    //   return false;
+    // }
+    PAR[PM_PAR_I0] = peak;
 
     // set the model position
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_TRAIL.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_TRAIL.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/models/pmModel_TRAIL.h	(revision 35321)
@@ -5,5 +5,5 @@
 psF32 pmModelFunc_TRAIL(psVector *deriv, const psVector *params, const psVector *pixcoord);
 bool pmModelLimits_TRAIL(psMinConstraintMode mode, int nParam, float *params, float *beta);
-bool pmModelGuess_TRAIL(pmModel *model, pmSource *source);
+bool pmModelGuess_TRAIL(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 psF64 pmModelFlux_TRAIL(const psVector *params);
 psF64 pmModelRadius_TRAIL(const psVector *params, psF64 flux);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/pmModelFuncs.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/pmModelFuncs.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/pmModelFuncs.h	(revision 35321)
@@ -107,5 +107,5 @@
 //  This function provides the model guess parameters based on the details of
 //  the given source.
-typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);
+typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
 
 //  This function constructs the PSF model for the given source based on the
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/pmPSFtryFitEXT.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/pmPSFtryFitEXT.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/pmPSFtryFitEXT.c	(revision 35321)
@@ -83,5 +83,5 @@
         }
 
-        source->modelEXT = pmSourceModelGuess (source, options->type);
+        source->modelEXT = pmSourceModelGuess (source, options->type, maskVal, markVal);
         if (source->modelEXT == NULL) {
             psTrace ("psModules.objects", 4, "masking %d (%d,%d) : failed to generate model guess\n", i, source->peak->x, source->peak->y);
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceFitPCM.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceFitPCM.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceFitPCM.c	(revision 35321)
@@ -145,5 +145,5 @@
 bool pmSourceModelGuessPCM (pmPCMdata *pcm, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) {
 
-    if (!pcm->modelConv->modelGuess(pcm->modelConv, source)) {
+  if (!pcm->modelConv->modelGuess(pcm->modelConv, source, maskVal, markVal)) {
 	return false;
     }
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceUtils.c
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceUtils.c	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceUtils.c	(revision 35321)
@@ -46,8 +46,8 @@
 
 /******************************************************************************
-    pmSourceModelGuess(source, model): This function allocates a new
-    pmModel structure based on the given modelType specified in the argument list.
-    The corresponding pmModelGuess function is returned, and used to
-    supply the values of the params array in the pmModel structure.
+    pmSourceModelGuess(source, model, maskVal, markVal): This function allocates a new
+    pmModel structure based on the given modelType specified in the argument list.  The
+    corresponding pmModelGuess function is returned, and used to supply the values of the
+    params array in the pmModel structure.
  
     XXX: Many parameters are based on the src->moments structure, which is in
@@ -55,6 +55,5 @@
     functions will be in image, not subImage coords.  Remember this.
 *****************************************************************************/
-pmModel *pmSourceModelGuess(pmSource *source,
-                            pmModelType modelType)
+pmModel *pmSourceModelGuess(pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal)
 {
     psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
@@ -65,5 +64,5 @@
     pmModel *model = pmModelAlloc(modelType);
 
-    if (!model->modelGuess(model, source)) {
+    if (!model->modelGuess(model, source, maskVal, markVal)) {
 	psFree (model);
 	return NULL;
Index: /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceUtils.h
===================================================================
--- /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceUtils.h	(revision 35320)
+++ /branches/eam_branches/ipp-20130307/psModules/src/objects/pmSourceUtils.h	(revision 35321)
@@ -27,5 +27,7 @@
 pmModel *pmSourceModelGuess(
     pmSource *source,   ///< The input pmSource
-    pmModelType model   ///< The type of model to be created.
+    pmModelType model,   ///< The type of model to be created.
+    psImageMaskType maskVal, 
+    psImageMaskType markVal
 );
 
