From 1dc4b5ae9c42e13d49c85ae106e5b2d654451ef0 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 15 Dec 2014 13:40:33 +0100 Subject: hdfsee: Handle peak lists from old streams (without panel names) --- src/dw-hdfsee.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c index 72e3b435..d86d70cc 100644 --- a/src/dw-hdfsee.c +++ b/src/dw-hdfsee.c @@ -1088,23 +1088,41 @@ static void load_features_from_file(struct image *image, const char *filename) /* Try long peak format from stream */ r = sscanf(line, "%f %f %f %f %s", &fs, &ss, &d, &intensity, pn); - if ( r != 5 ) continue; + if ( r == 5 ) { - p = find_panel_by_name(image->det, pn); - if ( p == NULL ) { - ERROR("Unable to find panel %s " - "(no geometry file given?)\n", pn); - } else { + p = find_panel_by_name(image->det, pn); + if ( p == NULL ) { + ERROR("Unable to find panel %s " + "(no geometry file given?)\n", pn); + } else { - /* Convert coordinates to match rearranged panels in - * memory */ - fs = fs - p->orig_min_fs + p->min_fs; - ss = ss - p->orig_min_ss + p->min_ss; + /* Convert coordinates to match rearranged panels in + * memory */ + fs = fs - p->orig_min_fs + p->min_fs; + ss = ss - p->orig_min_ss + p->min_ss; - } + } + + image_add_feature(image->features, fs, ss, image, 1.0, + "peak"); + } else if ( r == 4 ) { - image_add_feature(image->features, fs, ss, image, 1.0, "peak"); + p = find_orig_panel(image->det, fs, ss); + + if ( p == NULL ) { + ERROR("Unable to find panel " + "(no geometry file given?)\n"); + } else { + /* Convert coordinates to match rearranged + * panels in memory */ + fs = fs - p->orig_min_fs + p->min_fs; + ss = ss - p->orig_min_ss + p->min_ss; + } + image_add_feature(image->features, fs, ss, image, 1.0, + "peak"); + + } } while ( rval != NULL ); -- cgit v1.2.3