Index: /trunk/Ohana/src/addstar/include/addstar.h
===================================================================
--- /trunk/Ohana/src/addstar/include/addstar.h	(revision 28964)
+++ /trunk/Ohana/src/addstar/include/addstar.h	(revision 28965)
@@ -209,5 +209,5 @@
 Stars     *ReadStarsSDSS          PROTO((FILE *f, char *name, Header *header, Header *in_theader, Image *images, off_t *nimages, unsigned int *nstars));
 int        ReadImageHeader        PROTO((Header *header, Image *image, int photcode));
-Stars     *FilterStars            PROTO((Stars *instars, Image *image, unsigned int imageID));
+Stars     *FilterStars            PROTO((Stars *instars, Image *image, unsigned int imageID, const AddstarClientOptions *options));
 Stars     *MergeStars             PROTO((Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars));
 double     scat_subpix            PROTO((double x, double y));
Index: /trunk/Ohana/src/addstar/src/FilterStars.c
===================================================================
--- /trunk/Ohana/src/addstar/src/FilterStars.c	(revision 28964)
+++ /trunk/Ohana/src/addstar/src/FilterStars.c	(revision 28965)
@@ -1,3 +1,5 @@
 # include "addstar.h"
+#include "pslib/psMetadata.h"
+#include "psmodules/pmSourceMasks.h"
 # define EXTERNAL_ID TRUE
 
@@ -10,5 +12,5 @@
 // the imageID supplied here is the sequence **within this set**
 // this value is updated based on the image table later
-Stars *FilterStars (Stars *instars, Image *image, unsigned int imageID) {
+Stars *FilterStars (Stars *instars, Image *image, unsigned int imageID, const AddstarClientOptions *options) {
 
   int j, N;
@@ -28,4 +30,6 @@
   ALLOCATE (stars, Stars, image[0].nstar);
   for (N = j = 0; j < image[0].nstar; j++) {
+
+    if (instars[j].measure.photFlags & options->detectionFilter) continue;
 
     /* allow for some dynamic filtering of star list */
@@ -100,4 +104,7 @@
     N ++;
   }
+
+  // DEBUG printf("N stars orig = %d after filter = %d\n", image[0].nstar, N);
+  
   image[0].nstar = N;
   REALLOCATE (stars, Stars, image[0].nstar);
