diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-11-12 18:18:19 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-11-12 18:18:19 +0000 |
commit | a65405c3a6dee5152697c40e5875ac7d9dffe2da (patch) | |
tree | e9c451c3bb5c8a1159807181606bfbd256eb1504 /src/prealign.c | |
parent | 9665d9b38ec7d6ae515ef88e2bc849018e096bd2 (diff) |
Feature centering
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@192 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/prealign.c')
-rw-r--r-- | src/prealign.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/src/prealign.c b/src/prealign.c index 9574946..955ef4d 100644 --- a/src/prealign.c +++ b/src/prealign.c @@ -177,7 +177,7 @@ void prealign_sum_stack(ImageList *list, int have_centres) { } -#define CENTERING_WINDOW_SIZE 20 +#define CENTERING_WINDOW_SIZE 50 void prealign_fine_centering(ImageList *list) { @@ -195,22 +195,36 @@ void prealign_fine_centering(ImageList *list) { height = list->images[i].height; mask_x = list->images[i].x_centre; mask_y = list->images[i].y_centre; - - while ( (did_something) && (distance(mask_x, mask_y, list->images[i].x_centre, list->images[i].y_centre)<50) ) { + while ( (did_something) && (distance(mask_x, mask_y, list->images[i].x_centre, list->images[i].y_centre)<100) ) { + + double nmax, nmask_x, nmask_y; + + nmax = 0.0; + nmask_x = 0; + nmask_y = 0; max = list->images[i].image[mask_x+width*mask_y]; did_something = 0; + for ( sy=biggest(mask_y-CENTERING_WINDOW_SIZE/2, 0); sy<smallest(mask_y+CENTERING_WINDOW_SIZE/2, height); sy++ ) { for ( sx=biggest(mask_x-CENTERING_WINDOW_SIZE/2, 0); sx<smallest(mask_x+CENTERING_WINDOW_SIZE/2, width); sx++ ) { - if ( list->images[i].image[sx+width*sy] > max ) { - max = list->images[i].image[sx+width*sy]; - mask_x = sx; - mask_y = sy; - did_something = 1; + + if ( list->images[i].image[sx+width*sy] > nmax ) { + nmax = list->images[i].image[sx+width*sy]; + nmask_x = sx; + nmask_y = sy; } + } } + if ( nmax > max ) { + max = nmax; + mask_x = nmask_x; + mask_y = nmask_y; + did_something = 1; + } + } if ( !did_something ) { @@ -233,3 +247,20 @@ void prealign_fine_centering(ImageList *list) { } +void prealign_feature_centering(ImageList *list) { + + int i; + + for ( i=0; i<list->n_images; i++ ) { + + double d; + ImageFeature *feature; + + feature = image_feature_closest(list->images[i].features, list->images[i].x_centre, list->images[i].y_centre, &d); + list->images[i].x_centre = feature->x; + list->images[i].y_centre = feature->y; + + } + +} + |