From 2e2eeec338757beaf0bdd770f6f2a95caa6708b4 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 13 Aug 2014 15:21:57 +0200 Subject: Remove integrate_peak() from the API Good riddance. One of my least favourite routines. --- libcrystfel/src/peaks.c | 24 ++++++++++-------------- libcrystfel/src/peaks.h | 12 +++--------- tests/ring_check.c | 12 +++++------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index ca5a6951..9fd36037 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -3,12 +3,12 @@ * * Peak search and other image analysis * - * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * Copyright © 2012 Richard Kirian * * Authors: - * 2010-2013 Thomas White + * 2010-2014 Thomas White * 2012 Kenneth Beyerlein * 2011 Andrew Martin * 2011 Richard Kirian @@ -225,11 +225,11 @@ int *make_BgMask(struct image *image, struct panel *p, double ir_inn) /* Returns non-zero if peak has been vetoed. * i.e. don't use result if return value is not zero. */ -int integrate_peak(struct image *image, int cfs, int css, - double *pfs, double *pss, - double *intensity, double *sigma, - double ir_inn, double ir_mid, double ir_out, - int *bgPkMask, int *saturated) +static int integrate_peak(struct image *image, int cfs, int css, + double *pfs, double *pss, + double *intensity, double *sigma, + double ir_inn, double ir_mid, double ir_out, + int *saturated) { signed int dfs, dss; double lim_sq, out_lim_sq, mid_lim_sq; @@ -286,10 +286,6 @@ int integrate_peak(struct image *image, int cfs, int css, return 14; } - /* Check if there is a peak in the background region */ - if ( (bgPkMask != NULL) - && bgPkMask[(p_cfs+dfs) + p_w*(p_css+dss)] ) continue; - idx = dfs+cfs+image->width*(dss+css); /* Veto this peak if we tried to integrate in a bad region */ @@ -505,7 +501,7 @@ static void search_peaks_in_panel(struct image *image, float threshold, /* Centroid peak and get better coordinates. */ r = integrate_peak(image, mask_fs, mask_ss, &f_fs, &f_ss, &intensity, &sigma, - ir_inn, ir_mid, ir_out, NULL, &saturated); + ir_inn, ir_mid, ir_out, &saturated); if ( r ) { /* Bad region - don't detect peak */ @@ -701,7 +697,7 @@ void validate_peaks(struct image *image, double min_snr, r = integrate_peak(image, f->fs, f->ss, &f_fs, &f_ss, &intensity, &sigma, - ir_inn, ir_mid, ir_out, NULL, &saturated); + ir_inn, ir_mid, ir_out, &saturated); if ( r ) { n_int++; continue; diff --git a/libcrystfel/src/peaks.h b/libcrystfel/src/peaks.h index 902a5177..9900c232 100644 --- a/libcrystfel/src/peaks.h +++ b/libcrystfel/src/peaks.h @@ -3,11 +3,11 @@ * * Peak search and other image analysis * - * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2010-2013 Thomas White + * 2010-2014 Thomas White * * This file is part of CrystFEL. * @@ -56,12 +56,6 @@ extern void validate_peaks(struct image *image, double min_snr, int ir_inn, int ir_mid, int ir_out, int use_saturated, int check_snr); -extern int integrate_peak(struct image *image, int cfs, int css, - double *pfs, double *pss, - double *intensity, double *sigma, - double ir_inn, double ir_mid, double ir_out, - int *bgPkMask, int *saturated); - #ifdef __cplusplus } #endif diff --git a/tests/ring_check.c b/tests/ring_check.c index f7e8c473..2581f248 100644 --- a/tests/ring_check.c +++ b/tests/ring_check.c @@ -69,8 +69,7 @@ static void third_integration_check(struct image *image, int n_trials, } r = integrate_peak(image, 64, 64, &fsp, &ssp, - &intensity, &sigma, 10.0, 15.0, 17.0, - NULL, NULL); + &intensity, &sigma, 10.0, 15.0, 17.0, NULL); if ( r == 0 ) { mean_intensity += intensity; @@ -131,8 +130,7 @@ static void fourth_integration_check(struct image *image, int n_trials, } r = integrate_peak(image, 64, 64, &fsp, &ssp, - &intensity, &sigma, 10.0, 15.0, 17.0, - NULL, NULL); + &intensity, &sigma, 10.0, 15.0, 17.0, NULL); if ( r == 0 ) { mean_intensity += intensity; @@ -218,7 +216,7 @@ int main(int argc, char *argv[]) /* First check: no intensity -> no peak, or very low intensity */ r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, - 10.0, 15.0, 17.0, NULL, NULL); + 10.0, 15.0, 17.0, NULL); STATUS(" First check: integrate_peak() returned %i", r); if ( r == 0 ) { @@ -244,7 +242,7 @@ int main(int argc, char *argv[]) } r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, - 10.0, 15.0, 17.0, NULL, NULL); + 10.0, 15.0, 17.0, NULL); if ( r ) { ERROR(" Second check: integrate_peak() returned %i (wrong).\n", r); @@ -286,7 +284,7 @@ int main(int argc, char *argv[]) } r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, - 10.0, 15.0, 17.0, NULL, NULL); + 10.0, 15.0, 17.0, NULL); if ( r ) { ERROR(" Fifth check: integrate_peak() returned %i (wrong).\n", r); -- cgit v1.2.3