aboutsummaryrefslogtreecommitdiff
path: root/src
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
parente1be058cc4bd3a78e384c6960fe2b38fcba06bbd (diff)
Add no_index option to detector geometry
Diffstat (limited to 'src')
-rw-r--r--src/detector.c11
-rw-r--r--src/detector.h15
2 files changed, 19 insertions, 7 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]);
}
diff --git a/src/detector.h b/src/detector.h
index 92e10458..128332fd 100644
--- a/src/detector.h
+++ b/src/detector.h
@@ -22,15 +22,16 @@ struct image;
struct panel
{
- int min_x; /* Smallest x value considered to be in this panel */
- int max_x; /* Largest x value considered to be in this panel */
- int min_y; /* ... and so on */
+ int min_x; /* Smallest x value considered to be in this panel */
+ int max_x; /* Largest x value considered to be in this panel */
+ int min_y; /* ... and so on */
int max_y;
- float cx; /* Location of centre */
+ float cx; /* Location of centre */
float cy;
- float clen; /* Camera length */
- float res; /* Resolution */
- char badrow; /* 'x' or 'y' */
+ float clen; /* Camera length */
+ float res; /* Resolution */
+ char badrow; /* 'x' or 'y' */
+ int no_index; /* Don't index peaks in this panel if non-zero */
};
struct detector