aboutsummaryrefslogtreecommitdiff
path: root/src/dw-hdfsee.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-03-11 12:08:11 +0100
committerThomas White <taw@physics.org>2013-03-11 12:08:55 +0100
commit26b9d5227a96e5f5a607df98622df83f0f944bcc (patch)
tree9e0641293c7073c69002baaff490e0f1cf67aae6 /src/dw-hdfsee.c
parentdcfeca3dc9a38873de0d39cfcef4a80b26974352 (diff)
hdfsee: Add --median-filter, and make --filter-cm and --filter-noise actually work
Diffstat (limited to 'src/dw-hdfsee.c')
-rw-r--r--src/dw-hdfsee.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index c4eabaf2..8ad12a2a 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -47,6 +47,7 @@
#include "hdfsee.h"
#include "utils.h"
#include "detector.h"
+#include "filters.h"
static void displaywindow_error(DisplayWindow *dw, const char *message)
@@ -1526,6 +1527,20 @@ static int geometry_fits(struct image *image, struct detector *geom)
}
+static void do_filters(DisplayWindow *dw)
+{
+ if ( dw->cmfilter ) filter_cm(dw->image);
+
+ if ( dw->median_filter > 0 ) {
+ filter_median(dw->image, dw->median_filter);
+ }
+
+ if ( dw->noisefilter ) {
+ filter_noise(dw->image);
+ }
+}
+
+
struct newhdf {
DisplayWindow *dw;
GtkWidget *widget;
@@ -1581,6 +1596,8 @@ static gint displaywindow_newhdf(GtkMenuItem *item, struct newhdf *nh)
nh->dw->image->det = nh->dw->simple_geom;
}
+ do_filters(nh->dw);
+
displaywindow_update(nh->dw);
return 0;
}
@@ -1782,7 +1799,8 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
int noisefilter, int colscale,
const char *element, const char *geometry,
int show_rings, double *ring_radii,
- int n_rings, double ring_size)
+ int n_rings, double ring_size,
+ int median_filter)
{
DisplayWindow *dw;
char *title;
@@ -1813,6 +1831,7 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
dw->ring_radius = ring_size;
dw->ring_radii = ring_radii;
dw->n_rings = n_rings;
+ dw->median_filter = median_filter;
/* Open the file, if any */
if ( filename != NULL ) {
@@ -1850,6 +1869,9 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
dw->simple_geom = simple_geometry(dw->image);
dw->image->det = dw->simple_geom;
+ /* Filters need geometry */
+ do_filters(dw);
+
/* Peak list provided at startup? */
if ( peaks != NULL ) {
load_features_from_file(dw->image, peaks);