diff options
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/index.c | 38 | ||||
-rw-r--r-- | libcrystfel/src/index.h | 2 |
2 files changed, 40 insertions, 0 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 8a390d71..89b8c334 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -993,3 +993,41 @@ IndexingMethod get_indm_from_string(const char *str) { return get_indm_from_string_2(str, NULL); } + + +static void do_probe(const char *(*func)(UnitCell *cell), + UnitCell *cell, char *methods) +{ + const char *probe; + probe = func(cell); + if ( probe != NULL ) { + if ( methods[0] != '\0' ) { + strcat(methods, ","); + } + strcat(methods, probe); + } +} + + +char *detect_indexing_methods(UnitCell *cell) +{ + char *methods; + + methods = malloc(1024); + if ( methods == NULL ) return NULL; + methods[0] = '\0'; + + do_probe(mosflm_probe, cell, methods); + do_probe(dirax_probe, cell, methods); + do_probe(asdf_probe, cell, methods); + do_probe(xds_probe, cell, methods); + /* Don't automatically use Felix (yet) */ + //do_probe(felix_probe, cell, methods); + + if ( strlen(methods) == 0 ) { + free(methods); + return NULL; + } + + return methods; +} diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h index ae5185db..4e1f1519 100644 --- a/libcrystfel/src/index.h +++ b/libcrystfel/src/index.h @@ -143,6 +143,8 @@ extern IndexingPrivate *setup_indexing(const char *methods, UnitCell *cell, IndexingFlags flags, const char *options, struct taketwo_options *ttopts); +extern char *detect_indexing_methods(UnitCell *cell); + extern void index_pattern(struct image *image, IndexingPrivate *ipriv); extern void index_pattern_2(struct image *image, IndexingPrivate *ipriv, |