From a65405c3a6dee5152697c40e5875ac7d9dffe2da Mon Sep 17 00:00:00 2001 From: taw27 Date: Mon, 12 Nov 2007 18:18:19 +0000 Subject: Feature centering git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@192 bf6ca9ba-c028-0410-8290-897cf20841d1 --- src/prealign.c | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'src/prealign.c') 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); syimages[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; in_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; + + } + +} + -- cgit v1.2.3