aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-03-18 11:05:41 +0100
committerThomas White <taw@physics.org>2010-03-18 11:05:41 +0100
commit88c08418710ab2c72d51f6fce13ad2d78e0706f6 (patch)
treea6e7451341a1bda9307c1c71eb77a1cae898699f
parent7678f34afc9df872af539d56c8110e578e683b08 (diff)
Separate CM subtraction and noise filter
-rw-r--r--src/displaywindow.c6
-rw-r--r--src/displaywindow.h6
-rw-r--r--src/filters.c7
-rw-r--r--src/filters.h4
-rw-r--r--src/hdfsee.c17
-rw-r--r--src/indexamajig.c22
-rw-r--r--src/render.c3
7 files changed, 45 insertions, 20 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 2501f38b..0fc71254 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -982,7 +982,8 @@ static gint displaywindow_press(GtkWidget *widget, GdkEventButton *event,
DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
- int boost, int binning, int clean)
+ int boost, int binning, int cmfilter,
+ int noisefilter)
{
DisplayWindow *dw;
char *title;
@@ -1048,7 +1049,8 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
dw->binning = binning;
dw->boostint = boost;
- dw->clean = clean;
+ dw->cmfilter = cmfilter;
+ dw->noisefilter = noisefilter;
displaywindow_update(dw);
/* Peak list provided at startup? */
diff --git a/src/displaywindow.h b/src/displaywindow.h
index 0ca59933..ee34dab9 100644
--- a/src/displaywindow.h
+++ b/src/displaywindow.h
@@ -63,7 +63,8 @@ typedef struct {
int height; /* Size of the drawing area */
int binning;
int boostint;
- int clean; /* Whether or not to clean the image */
+ int cmfilter; /* Use CM subtraction */
+ int noisefilter; /* Use aggressive noise filter */
int show_col_scale;
int scale;
@@ -74,7 +75,8 @@ typedef struct {
/* Open an image display window showing the given filename, or NULL */
extern DisplayWindow *displaywindow_open(const char *filename,
const char *peaks, int boost,
- int binning, int clean);
+ int binning, int cmfilter,
+ int noisefilter);
#endif /* DISPLAYWINDOW_H */
diff --git a/src/filters.c b/src/filters.c
index f6f5e0b8..172be222 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -97,7 +97,7 @@ static void noise_filter(struct image *image)
/* Pre-processing to make life easier */
-void clean_image(struct image *image)
+void filter_cm(struct image *image)
{
int px, py;
@@ -111,5 +111,10 @@ void clean_image(struct image *image)
}
}
+}
+
+
+void filter_noise(struct image *image)
+{
noise_filter(image);
}
diff --git a/src/filters.h b/src/filters.h
index b28cb908..97bcf5a2 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -18,6 +18,8 @@
#endif
-extern void clean_image(struct image *image);
+extern void filter_cm(struct image *image);
+extern void filter_noise(struct image *image);
+
#endif /* FILTERS_H */
diff --git a/src/hdfsee.c b/src/hdfsee.c
index a1d16b56..ff74ead6 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -38,9 +38,11 @@ static void show_help(const char *s)
" -p, --peak-overlay=<filename> Draw circles in positions listed in file.\n"
" -i, --int-boost=<n> Multiply intensity by <n>.\n"
" -b, --binning=<n> Set display binning to <n>.\n"
-" --clean-image Perform common-mode noise subtraction and\n"
-" background removal on images before\n"
-" proceeding.\n"
+" --filter-cm Perform common-mode noise subtraction.\n"
+" --filter-noise Apply an aggressive noise filter which\n"
+" sets all pixels in each 3x3 region to\n"
+" zero if any of them have negative\n"
+" values.\n"
"\n");
}
@@ -79,7 +81,8 @@ int main(int argc, char *argv[])
char *peaks = NULL;
int boost = 1;
int binning = 2;
- int config_clean = 0;
+ int config_cmfilter = 0;
+ int config_noisefilter = 0;
/* Long options */
const struct option longopts[] = {
@@ -87,7 +90,8 @@ int main(int argc, char *argv[])
{"peak-overlay", 1, NULL, 'p'},
{"int-boost", 1, NULL, 'i'},
{"binning", 1, NULL, 'b'},
- {"clean-image", 0, &config_clean, 1},
+ {"filter-cm", 0, &config_cmfilter, 1},
+ {"filter-noise", 0, &config_noisefilter, 1},
{0, 0, NULL, 0}
};
@@ -145,7 +149,8 @@ int main(int argc, char *argv[])
for ( i=0; i<nfiles; i++ ) {
main_window_list[i] = displaywindow_open(argv[optind+i], peaks,
boost, binning,
- config_clean);
+ config_cmfilter,
+ config_noisefilter);
if ( main_window_list[i] == NULL ) {
ERROR("Couldn't open display window\n");
} else {
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 7c227cb1..ac5fb0ae 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -49,6 +49,8 @@ static void show_help(const char *s)
" dirax : invoke DirAx\n"
"\n"
" --verbose Be verbose about indexing.\n"
+" --gpu Use the GPU to speed up the simulation.\n"
+"\n"
" --write-drx Write 'xfel.drx' for visualisation of reciprocal\n"
" space. Implied by any indexing method other than\n"
" 'none'. Beware: the units in this file are\n"
@@ -57,9 +59,13 @@ static void show_help(const char *s)
" --near-bragg Output a list of reflection intensities to stdout.\n"
" --simulate Simulate the diffraction pattern using the indexed\n"
" unit cell.\n"
-" --gpu Use the GPU to speed up the simulation.\n"
-" --clean-image Perform common-mode noise subtraction and\n"
-" background removal on images before proceeding.\n"
+" --filter-cm Perform common-mode noise subtraction on images\n"
+" before proceeding. Intensities will be extracted\n"
+" from the image as it is after this processing.\n"
+" --filter-noise Apply an aggressive noise filter which sets all\n"
+" pixels in each 3x3 region to zero if any of them\n"
+" have negative values. Intensity measurement will\n"
+" be performed on the image as it was before this.\n"
" --no-match Don't attempt to match the indexed cell to the\n"
" model, just proceed with the one generated by the\n"
" auto-indexing procedure.\n"
@@ -170,7 +176,8 @@ int main(int argc, char *argv[])
int config_nearbragg = 0;
int config_writedrx = 0;
int config_simulate = 0;
- int config_clean = 0;
+ int config_cmfilter = 0;
+ int config_noisefilter = 0;
int config_nomatch = 0;
int config_gpu = 0;
int config_verbose = 0;
@@ -190,7 +197,8 @@ int main(int argc, char *argv[])
{"write-drx", 0, &config_writedrx, 1},
{"indexing", 1, NULL, 'z'},
{"simulate", 0, &config_simulate, 1},
- {"clean-image", 0, &config_clean, 1},
+ {"filter-cm", 0, &config_cmfilter, 1},
+ {"filter-noise", 0, &config_noisefilter, 1},
{"no-match", 0, &config_nomatch, 1},
{"verbose", 0, &config_verbose, 1},
{"alternate", 0, &config_alternate, 1},
@@ -296,8 +304,8 @@ int main(int argc, char *argv[])
hdf5_read(hdfile, &image);
- if ( config_clean ) {
- clean_image(&image);
+ if ( config_cmfilter ) {
+ filter_cm(&image);
}
/* Perform 'fine' peak search */
diff --git a/src/render.c b/src/render.c
index 432b81ab..a4be5a14 100644
--- a/src/render.c
+++ b/src/render.c
@@ -77,7 +77,8 @@ float *render_get_image_binned(DisplayWindow *dw, int binning, float *max)
hdf5_read(dw->hdfile, image);
dw->image_dirty = 0;
- if ( dw->clean ) clean_image(image);
+ if ( dw->cmfilter ) filter_cm(image);
+ if ( dw->noisefilter ) filter_noise(image);
/* Deal with the old image, if existing */
if ( dw->image != NULL ) {