aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-08-17 18:27:24 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:55 +0100
commit3bfd8f444202eb427debdd3f218aa31fa0a35590 (patch)
tree165f668da882fe8ab9734a535483ede85850e3d3
parent93aa7b124f6f971f253326f347d5104d96f14d6e (diff)
Use detector geometry when generating templates
Also, add progress bar.
-rw-r--r--src/index.c4
-rw-r--r--src/index.h4
-rw-r--r--src/indexamajig.c2
-rw-r--r--src/templates.c10
-rw-r--r--src/templates.h4
5 files changed, 13 insertions, 11 deletions
diff --git a/src/index.c b/src/index.c
index 7273d64b..2a5eb5b7 100644
--- a/src/index.c
+++ b/src/index.c
@@ -42,7 +42,7 @@ static IndexingPrivate *indexing_private(IndexingMethod indm)
IndexingPrivate *prepare_indexing(IndexingMethod indm, UnitCell *cell,
- const char *filename)
+ const char *filename, struct detector *det)
{
switch ( indm ) {
case INDEXING_NONE :
@@ -50,7 +50,7 @@ IndexingPrivate *prepare_indexing(IndexingMethod indm, UnitCell *cell,
case INDEXING_DIRAX :
return indexing_private(indm);
case INDEXING_TEMPLATE :
- return generate_templates(cell, filename);
+ return generate_templates(cell, filename, det);
}
return 0;
}
diff --git a/src/index.h b/src/index.h
index 1c637f47..57373469 100644
--- a/src/index.h
+++ b/src/index.h
@@ -20,6 +20,7 @@
#include "cell.h"
#include "image.h"
+#include "detector.h"
typedef enum {
INDEXING_NONE,
@@ -31,7 +32,8 @@ typedef enum {
typedef struct _indexingprivate IndexingPrivate;
extern IndexingPrivate *prepare_indexing(IndexingMethod indm, UnitCell *cell,
- const char *filename);
+ const char *filename,
+ struct detector *det);
extern void index_pattern(struct image *image, UnitCell *cell,
IndexingMethod indm, int no_match, int verbose,
diff --git a/src/indexamajig.c b/src/indexamajig.c
index ec4e18c4..d6b0d982 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -642,7 +642,7 @@ int main(int argc, char *argv[])
}
chomp(prepare_line);
snprintf(prepare_filename, 1023, "%s%s", prefix, prepare_line);
- ipriv = prepare_indexing(indm, cell, prepare_filename);
+ ipriv = prepare_indexing(indm, cell, prepare_filename, det);
if ( ipriv == NULL ) {
ERROR("Failed to prepare indexing.\n");
return 1;
diff --git a/src/templates.c b/src/templates.c
index fd4616b2..e4355295 100644
--- a/src/templates.c
+++ b/src/templates.c
@@ -86,7 +86,8 @@ UnitCell *rotate_cell(UnitCell *in, double omega, double phi)
/* Generate templates for the given cell using a representative image */
-IndexingPrivate *generate_templates(UnitCell *cell, const char *filename)
+IndexingPrivate *generate_templates(UnitCell *cell, const char *filename,
+ struct detector *det)
{
struct _indexingprivate_template *priv;
const char *holo;
@@ -107,6 +108,7 @@ IndexingPrivate *generate_templates(UnitCell *cell, const char *filename)
}
hdf5_read(hdfile, &image, 0);
hdfile_close(hdfile);
+ image.det = det;
priv = calloc(1, sizeof(struct _indexingprivate_template));
priv->base.indm = INDEXING_TEMPLATE;
@@ -149,13 +151,11 @@ IndexingPrivate *generate_templates(UnitCell *cell, const char *filename)
return NULL;
}
- STATUS("%.2f, %.2f : %i features\n",
- rad2deg(omega), rad2deg(phi), n);
-
free(cell_rot);
}
- STATUS("Finished omega=%.2f\n", rad2deg(omega));
+ progress_bar(omega*1000.0, (omega_max-omega_step)*1000.0,
+ "Generating templates");
}
priv->n_templates = n_templates;
diff --git a/src/templates.h b/src/templates.h
index dad46843..559733fe 100644
--- a/src/templates.h
+++ b/src/templates.h
@@ -21,8 +21,8 @@
#include "image.h"
#include "cell.h"
-extern IndexingPrivate *generate_templates(UnitCell *cell,
- const char *filename);
+extern IndexingPrivate *generate_templates(UnitCell *cell, const char *filename,
+ struct detector *det);
extern void match_templates(struct image *image, IndexingPrivate *ipriv);