aboutsummaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-04 19:04:20 +0100
committerThomas White <taw@physics.org>2010-02-04 19:04:20 +0100
commita162a01f988a86f38d10a1b507d524637670566e (patch)
tree401f12e5878d8ca150b51bca5835cae627eabc6e /src/index.c
parentc85a8a308ec7ab50545255530da6a31b841be3ed (diff)
Improved framework for detector geometry
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c27
1 files changed, 19 insertions, 8 deletions
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; i<image_feature_count(image->features); 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; p<image->det.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);