From 9d09550d6ce5279ca5f68a8a4dc5bd96758d5852 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 8 Jan 2010 16:45:20 +0100 Subject: Use feature list to improve peak search --- src/Makefile.am | 2 +- src/dirax.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 839f7450..978ab602 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,7 +16,7 @@ process_hkl_SOURCES = process_hkl.c sfac.c statistics.c cell.c utils.c \ reflections.c process_hkl_LDADD = @LIBS@ -indexamajig_SOURCES = indexamajig.c hdf5-file.c utils.c dirax.c cell.c +indexamajig_SOURCES = indexamajig.c hdf5-file.c utils.c dirax.c cell.c image.c indexamajig_LDADD = @LIBS@ if HAVE_GTK diff --git a/src/dirax.c b/src/dirax.c index 634a37e9..6e38d76f 100644 --- a/src/dirax.c +++ b/src/dirax.c @@ -385,6 +385,11 @@ static void search_peaks(struct image *image) width = image->width; height = image->height; + if ( image->features != NULL ) { + image_feature_list_free(image->features); + } + image->features = image_feature_list_new(); + for ( x=1; xwidth-1; x++ ) { for ( y=1; yheight-1; y++ ) { @@ -441,8 +446,8 @@ static void search_peaks(struct image *image) if ( !did_something ) { - //double d; - //int idx; + double d; + int idx; assert(mask_xwidth); assert(mask_yheight); @@ -453,10 +458,10 @@ static void search_peaks(struct image *image) /* Check for a feature at exactly the * same coordinates */ - //image_feature_closest(flist, mask_x, mask_y, - // &d, &idx); + image_feature_closest(image->features, mask_x, mask_y, + &d, &idx); - //if ( d > 1.0 ) { + if ( d > 1.0 ) { double rx = 0.0; double ry = 0.0; @@ -464,10 +469,13 @@ static void search_peaks(struct image *image) /* Map and record reflection */ printf("%i %i\n", x, y); + + image_add_feature(image->features, x, y, + image, 1.0); map_position(image, x, y, &rx, &ry, &rz); fprintf(fh, "%10f %10f %10f %8f\n", rx/1e10, ry/1e10, rz/1e10, 1.0); - //} + } } -- cgit v1.2.3