From 29136c31705b8012f7d2f393da6f6bb3d036498c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 7 Apr 2011 18:22:51 +0200 Subject: Simplify reflection integration logic --- src/peaks.c | 57 +++++++++++---------------------------------------------- 1 file changed, 11 insertions(+), 46 deletions(-) (limited to 'src/peaks.c') diff --git a/src/peaks.c b/src/peaks.c index 38825d93..153387bc 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -591,13 +591,14 @@ void integrate_reflections(struct image *image, int polar, int use_closer) double bg, max; struct panel *p; double pfs, pss; + int r; get_detector_pos(refl, &pfs, &pss); p = find_panel(image->det, pfs, pss); if ( p == NULL ) continue; if ( p->no_index ) continue; - /* Wait.. is there a really close feature which was detected? */ + /* Is there a really close feature which was detected? */ if ( use_closer ) { struct imagefeature *f; @@ -610,57 +611,21 @@ void integrate_reflections(struct image *image, int polar, int use_closer) } if ( (f != NULL) && (d < PEAK_REALLY_CLOSE) ) { - int r; - - /* f->intensity was measured on the filtered - * pattern, so instead re-integrate using old - * coordinates. This will produce further - * revised coordinates. */ - r = integrate_peak(image, f->fs, f->ss, - &fs, &ss, &intensity, &bg, - &max, polar, 1); - if ( r ) { - /* The original peak (which also went - * through integrate_peak(), but with - * the mangled image data) would have - * been rejected if it was in a bad - * region. Integration of the same - * peak included a bad region this time. - */ - continue; - } - intensity = f->intensity; - - } else { - - int r; - - r = integrate_peak(image, pfs, pss, &fs, &ss, - &intensity, &bg, &max, - polar, 1); - if ( r ) { - /* Plain old ordinary peak veto */ - continue; - } + pfs = f->fs; + pss = f->ss; } + } - } else { - - int r; - - r = integrate_peak(image, pfs, pss, &fs, &ss, - &intensity, &bg, &max, polar, 0); - if ( r ) { - /* Plain old ordinary peak veto */ - continue; - } + r = integrate_peak(image, pfs, pss, &fs, &ss, + &intensity, &bg, &max, polar, 0); + /* Record intensity and set redundancy to 1 on success */ + if ( r == 0 ) { + set_int(refl, intensity); + set_redundancy(refl, 1); } - set_int(refl, intensity); - set_redundancy(refl, 1); - } } -- cgit v1.2.3