diff options
-rw-r--r-- | src/detector.c | 11 | ||||
-rw-r--r-- | src/detector.h | 15 |
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 |