aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/index.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-04-16 15:17:00 +0200
committerThomas White <taw@physics.org>2015-04-20 12:56:03 +0200
commitb91dbbe0052f17b44ba0b47befe46a4567906c33 (patch)
treeef4880edcfa647dab961ce95a3fd124c58468146 /libcrystfel/src/index.c
parent4a5c2b7ac8c1c514a33d575a9a9ecba69a2129d3 (diff)
Add INDEXING_DEBUG
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r--libcrystfel/src/index.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index c3f7c35d..9ac5b3cc 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -55,6 +55,19 @@
#include "grainspotter.h"
+static int debug_index(struct image *image)
+{
+ Crystal *cr = crystal_new();
+ UnitCell *cell = cell_new();
+ cell_set_reciprocal(cell, +0.0000e9, +0.0000e9, +0.0000e9,
+ +0.0000e9, +0.0000e9, +0.0000e9,
+ +0.0000e9, +0.0000e9, +0.0000e9);
+ crystal_set_cell(cr, cell);
+ image_add_crystal(image, cr);
+ return 1;
+}
+
+
IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell,
struct detector *det, float *ltl)
{
@@ -96,6 +109,10 @@ IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell,
det, ltl);
break;
+ case INDEXING_DEBUG :
+ iprivs[n] = (IndexingPrivate *)strdup("Hello!");
+ break;
+
default :
ERROR("Don't know how to prepare indexing method %i\n",
indm[n]);
@@ -166,6 +183,10 @@ void cleanup_indexing(IndexingMethod *indms, IndexingPrivate **privs)
grainspotter_cleanup(privs[n]);
break;
+ case INDEXING_DEBUG :
+ free(privs[n]);
+ break;
+
default :
ERROR("Don't know how to clean up indexing method %i\n",
indms[n]);
@@ -231,6 +252,9 @@ static int try_indexer(struct image *image, IndexingMethod indm,
return grainspotter_index(image, ipriv);
break;
+ case INDEXING_DEBUG :
+ return debug_index(image);
+
default :
ERROR("Unrecognised indexing method: %i\n", indm);
break;
@@ -369,6 +393,10 @@ char *indexer_str(IndexingMethod indm)
strcpy(str, "simulation");
break;
+ case INDEXING_DEBUG :
+ strcpy(str, "debug");
+ break;
+
default :
ERROR("Unrecognised indexing method %i\n",
indm & INDEXING_METHOD_MASK);
@@ -442,6 +470,10 @@ IndexingMethod *build_indexer_list(const char *str)
list[++nmeth] = INDEXING_SIMULATION;
return list;
+ } else if ( strcmp(methods[i], "debug") == 0) {
+ list[++nmeth] = INDEXING_DEBUG;
+ return list;
+
} else if ( strcmp(methods[i], "raw") == 0) {
list[nmeth] = set_raw(list[nmeth]);