aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-08-11 13:46:22 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:55 +0100
commit08eb56662c980d570e8a0f88aff25d3a3f4a288f (patch)
treeb12b001ab2f452909166db3cea732fd7b12bee2a /src/detector.c
parente1be058cc4bd3a78e384c6960fe2b38fcba06bbd (diff)
Add no_index option to detector geometry
Diffstat (limited to 'src/detector.c')
-rw-r--r--src/detector.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/detector.c b/src/detector.c
index 97e62202..9a6ab51c 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -22,6 +22,14 @@
#include "parameters-lcls.tmp"
+int atob(const char *a)
+{
+ if ( strcasecmp(a, "true") == 0 ) return 1;
+ if ( strcasecmp(a, "false") == 0 ) return 1;
+ return atoi(a);
+}
+
+
/* x,y in pixels relative to image origin */
int map_position(struct image *image, double dx, double dy,
double *rx, double *ry, double *rz)
@@ -35,6 +43,7 @@ int map_position(struct image *image, double dx, double dy,
p = find_panel(image->det, dx, dy);
if ( p == NULL ) return 1;
+ if ( p->no_index ) return 1;
x = ((double)dx - p->cx);
y = ((double)dy - p->cy);
@@ -256,6 +265,8 @@ struct detector *get_detector_geometry(const char *filename)
ERROR("Assuming 'x'\n.");
det->panels[np].badrow = 'x';
}
+ } else if ( strcmp(path[1], "no_index") == 0 ) {
+ det->panels[np].no_index = atob(bits[2]);
} else {
ERROR("Unrecognised field '%s'\n", path[1]);
}