aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-09-30 17:55:17 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:00 +0100
commitb493440b312b1d08b3f70277fe9b78ce33a8e033 (patch)
tree7a4aa4f0ba8dd423c433cfdeafdeeca4061e1107 /src/detector.c
parent8679d7a1977239c98b0f296e9d5b71eb08e4434b (diff)
pattern_sim: Get image size from detector geometry
Diffstat (limited to 'src/detector.c')
-rw-r--r--src/detector.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/detector.c b/src/detector.c
index c5665ab2..86d806e3 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -202,6 +202,7 @@ struct detector *get_detector_geometry(const char *filename)
char **bits;
int i;
int reject;
+ int x, y, max_x, max_y;
fh = fopen(filename, "r");
if ( fh == NULL ) return NULL;
@@ -339,7 +340,10 @@ struct detector *get_detector_geometry(const char *filename)
}
reject = 0;
+ max_x = 0;
+ max_y = 0;
for ( i=0; i<det->n_panels; i++ ) {
+
STATUS("Panel %i, min_x = %i\n", i, det->panels[i].min_x);
if ( det->panels[i].min_x == -1 ) {
ERROR("Please specify the minimum x coordinate for"
@@ -397,7 +401,25 @@ struct detector *get_detector_geometry(const char *filename)
}
/* It's not a problem if "no_index" is still zero */
+ if ( det->panels[i].max_x > max_x ) {
+ max_x = det->panels[i].max_x;
+ }
+ if ( det->panels[i].max_y > max_y ) {
+ max_y = det->panels[i].max_y;
+ }
+
+ }
+
+ for ( x=0; x<=max_x; x++ ) {
+ for ( y=0; y<=max_y; y++ ) {
+ if ( find_panel(det, x, y) == NULL ) {
+ ERROR("Detector geometry invalid: contains gaps.\n");
+ reject = 1;
+ }
+ }
}
+ det->max_x = max_x;
+ det->max_y = max_y;
if ( reject ) return NULL;