diff options
author | Thomas White <taw@physics.org> | 2010-08-16 17:10:11 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:26:55 +0100 |
commit | ac20d7cd290e7bac157b9b90a73a04a956ab6ee3 (patch) | |
tree | fba201da581382f001c7dd3fe7f8d81c258ac71a /src/templates.c | |
parent | 02e1ef093dc34e79e832764029db838cd5c13261 (diff) |
Determine orientation range for template matching
Diffstat (limited to 'src/templates.c')
-rw-r--r-- | src/templates.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/templates.c b/src/templates.c index db28b9b9..98182bbe 100644 --- a/src/templates.c +++ b/src/templates.c @@ -16,6 +16,8 @@ #include "index.h" #include "index-priv.h" +#include "symmetry.h" +#include "utils.h" /* Private data for template indexing */ @@ -25,13 +27,36 @@ struct _indexingprivate_template }; +/* Generate templates for the given cell using a representative image */ IndexingPrivate *generate_templates(UnitCell *cell, const char *filename) { struct _indexingprivate_template *priv; + const char *holo; + double omega_max, phi_max; priv = calloc(1, sizeof(struct _indexingprivate_template)); priv->base.indm = INDEXING_TEMPLATE; + /* We can only distinguish orientations within the holohedral cell */ + holo = get_holohedral(cell_get_pointgroup(cell)); + STATUS("%s\n", holo); + + /* These define the orientation in space */ + if ( is_polyhedral(holo) ) { + ERROR("WARNING: Holohedral point group is polyhedral.\n"); + ERROR("This means I can't properly determine the orientation"); + ERROR(" ranges for template matching. Expect trouble.\n"); + } + omega_max = 2.0*M_PI / rotational_order(holo); + if ( has_bisecting_mirror_or_diad(holo) ) omega_max /= 2.0; + phi_max = M_PI; + if ( has_perpendicular_mirror(holo) ) phi_max /= 2.0; + + /* One more axis would define the rotation in the plane of the image */ + + STATUS("Orientation ranges: %5.0f -> %5.0f, %5.0f -> %5.0f deg.\n", + 0.0, rad2deg(omega_max), 0.0, rad2deg(phi_max)); + return (struct _indexingprivate *)priv; } |