Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oleksii Turkot
CrystFEL
Commits
b493440b
Commit
b493440b
authored
Sep 30, 2010
by
Thomas White
Committed by
Thomas White
Feb 22, 2012
Browse files
pattern_sim: Get image size from detector geometry
parent
8679d7a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/detector.c
View file @
b493440b
...
...
@@ -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
;
...
...
src/detector.h
View file @
b493440b
...
...
@@ -38,6 +38,8 @@ struct detector
{
struct
panel
*
panels
;
int
n_panels
;
int
max_x
;
int
max_y
;
/* Size of overall array needed, minus 1 */
};
extern
struct
rvec
get_q
(
struct
image
*
image
,
unsigned
int
xs
,
unsigned
int
ys
,
...
...
src/pattern_sim.c
View file @
b493440b
...
...
@@ -338,9 +338,16 @@ int main(int argc, char *argv[])
delete_items
(
items
);
}
image
.
det
=
get_detector_geometry
(
geometry
);
if
(
image
.
det
==
NULL
)
{
ERROR
(
"Failed to read detector geometry from '%s'
\n
"
,
geometry
);
return
1
;
}
free
(
geometry
);
/* Define image parameters */
image
.
width
=
1024
;
image
.
height
=
1024
;
image
.
width
=
image
.
det
->
max_x
+
1
;
image
.
height
=
image
.
det
->
max_y
+
1
;
image
.
lambda
=
ph_en_to_lambda
(
eV_to_J
(
PHOTON_ENERGY
));
/* Wavelength */
cell
=
load_cell_from_pdb
(
filename
);
if
(
cell
==
NULL
)
{
...
...
@@ -352,13 +359,6 @@ int main(int argc, char *argv[])
image
.
f0
=
1
.
0
;
image
.
f0_available
=
1
;
image
.
det
=
get_detector_geometry
(
geometry
);
if
(
image
.
det
==
NULL
)
{
ERROR
(
"Failed to read detector geometry from '%s'
\n
"
,
geometry
);
return
1
;
}
free
(
geometry
);
powder
=
calloc
(
image
.
width
*
image
.
height
,
sizeof
(
*
powder
));
/* Splurge a few useful numbers */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment