aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-10-16 16:22:44 +0200
committerThomas White <taw@bitwiz.org.uk>2009-10-16 16:22:44 +0200
commitf5dab4ce7e8aea035ee25ca8f818e5779eb88726 (patch)
tree9a491c7963e145c1d995acaddaed0dc6f21c5ae7 /src/main.c
parenta5289c2bbfdc7a04fc3f44b0cead930a2740394b (diff)
Read image and generate templates
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 79dff45a..257a1169 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,6 +20,12 @@
#include <string.h>
#include <unistd.h>
+#include "cell.h"
+#include "image.h"
+#include "utils.h"
+#include "hdf5-file.h"
+#include "templates.h"
+
static void main_show_help(const char *s)
{
@@ -35,6 +41,9 @@ int main(int argc, char *argv[])
char **in_files;
size_t nin;
size_t i;
+ UnitCell *cell;
+ TemplateList *templates;
+ struct image template_parameters;
while ((c = getopt(argc, argv, "h")) != -1) {
@@ -60,11 +69,49 @@ int main(int argc, char *argv[])
return 1;
}
- printf("Generating templates...\n");
+ /* Define unit cell */
+ cell = cell_new_from_parameters(28.10e-9,
+ 28.10e-9,
+ 16.52e-9,
+ deg2rad(90.0),
+ deg2rad(90.0),
+ deg2rad(120.0));
+
+ /* Generate templates */
+ template_parameters.width = 512;
+ template_parameters.height = 512;
+ template_parameters.fmode = FORMULATION_CLEN;
+ template_parameters.x_centre = 255.5;
+ template_parameters.y_centre = 255.5;
+ template_parameters.camera_len = 0.2; /* 20 cm */
+ template_parameters.resolution = 5120; /* 512 pixels in 10 cm */
+ template_parameters.lambda = 0.2e-9; /* LCLS wavelength */
+ templates = generate_templates(cell, template_parameters);
printf("Input files (%i):\n", nin);
for ( i=0; i<nin; i++ ) {
+
+ struct image image;
+
printf("%6i: %s\n", i+1, in_files[i]);
+
+ image.width = 512;
+ image.height = 512;
+ image.fmode = FORMULATION_CLEN;
+ image.x_centre = 255.5;
+ image.y_centre = 255.5;
+ image.camera_len = 0.2; /* 20 cm */
+ image.resolution = 5120; /* 512 pixels in 10 cm */
+ image.lambda = 0.2e-9; /* LCLS wavelength */
+
+ if ( hdf5_read(&image, in_files[i]) ) {
+ fprintf(stderr, "Couldn't read file '%s'\n",
+ in_files[i]);
+ continue;
+ }
+
+ try_templates(&image, templates);
+
}
return 0;