From a162a01f988a86f38d10a1b507d524637670566e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 4 Feb 2010 19:04:20 +0100 Subject: Improved framework for detector geometry --- src/index.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/index.c') diff --git a/src/index.c b/src/index.c index 2e0fd027..1d737e7e 100644 --- a/src/index.c +++ b/src/index.c @@ -111,19 +111,30 @@ void index_pattern(struct image *image, IndexingMethod indm) for ( i=0; ifeatures); i++ ) { struct imagefeature *f; + double rx = 0.0; + double ry = 0.0; + int p; + int found = 0; f = image_get_feature(image->features, i); if ( f == NULL ) continue; - if ( f->y >=512 ) { - /* Top half of CCD */ - map_position(image, f->x-UPPER_CX, f->y-UPPER_CY, - &f->rx, &f->ry, &f->rz); - } else { - /* Lower half of CCD */ - map_position(image, f->x-LOWER_CX, f->y-LOWER_CY, - &f->rx, &f->ry, &f->rz); + for ( p=0; pdet.n_panels; p++ ) { + if ( (f->x >= image->det.panels[p].min_x) + && (f->x <= image->det.panels[p].max_x) + && (f->y >= image->det.panels[p].min_y) + && (f->y <= image->det.panels[p].max_y) ) { + rx = ((double)f->x - image->det.panels[p].cx); + ry = ((double)f->y - image->det.panels[p].cy); + found = 1; + } } + if ( !found ) { + ERROR("No mapping found for %f,%f\n", f->x, f->y); + continue; + } + + map_position(image, rx, ry, &f->rx, &f->ry, &f->rz); } write_drx(image); -- cgit v1.2.3