From a53f6c6bf41d897a6dafbbe9791ffe24196ec400 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 12 Jun 2010 19:44:30 -0700 Subject: calibrate-detector: Only integrate near peaks --- src/Makefile.am | 2 +- src/calibrate-detector.c | 42 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7a440ed8..c484d63e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,7 +50,7 @@ render_hkl_SOURCES = render_hkl.c cell.c reflections.c utils.c render_hkl_LDADD = @LIBS@ calibrate_detector_SOURCES = calibrate-detector.c utils.c hdf5-file.c image.c \ - filters.c + filters.c peaks.c calibrate_detector_LDADD = @LIBS@ INCLUDES = "-I$(top_srcdir)/data" diff --git a/src/calibrate-detector.c b/src/calibrate-detector.c index d411c2c6..1e6d88aa 100644 --- a/src/calibrate-detector.c +++ b/src/calibrate-detector.c @@ -27,8 +27,10 @@ #include "utils.h" #include "hdf5-file.h" #include "filters.h" +#include "peaks.h" +#define INTEGRATION_RADIUS (10) #define MAX_THREADS (96) struct process_args @@ -70,7 +72,7 @@ static void *process_image(void *pargsv) struct process_args *pargs = pargsv; struct hdfile *hdfile; struct image image; - int x, y; + int x, y, i; image.features = NULL; image.data = NULL; @@ -113,10 +115,40 @@ static void *process_image(void *pargsv) goto out; } - for ( x=0; xsum[x+pargs->w*y] += image.data[x+image.width*y]; - } + search_peaks(&image); + +// for ( x=0; x 100.0 ) { +// pargs->sum[x+pargs->w*y] += val; +// } +// } +// } + + const int lim = INTEGRATION_RADIUS * INTEGRATION_RADIUS; + + for ( i=0; ix; + int yp = f->y; + + for ( x=-INTEGRATION_RADIUS; x<+INTEGRATION_RADIUS; x++ ) { + for ( y=-INTEGRATION_RADIUS; y<+INTEGRATION_RADIUS; y++ ) { + + /* Circular mask */ + if ( x*x + y*y > lim ) continue; + + if ( ((x+xp)>=image.width) || ((x+xp)<0) ) continue; + if ( ((y+yp)>=image.height) || ((y+yp)<0) ) continue; + + float val = image.data[x+image.width*y]; + pargs->sum[x+pargs->w*y] += val; + + } + } + } out: -- cgit v1.2.3