aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-01-08 16:45:20 +0100
committerThomas White <taw@physics.org>2010-01-08 16:45:20 +0100
commit9d09550d6ce5279ca5f68a8a4dc5bd96758d5852 (patch)
treefd105f72743fbf0cd199495cd3807ba91831c5c7
parentb7691bf576bf1d8e0af02d9cede71a2680f2db0d (diff)
Use feature list to improve peak search
-rw-r--r--src/Makefile.am2
-rw-r--r--src/dirax.c20
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; x<image->width-1; x++ ) {
for ( y=1; y<image->height-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_x<image->width);
assert(mask_y<image->height);
@@ -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);
- //}
+ }
}