aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/indexers
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-14 11:31:42 +0200
committerThomas White <taw@physics.org>2021-07-14 11:31:42 +0200
commit1a60c142dc919cf9765547c3c79be10155d3a873 (patch)
tree8e2c21ef511537260abaf5aad07da9cebddfdce1 /libcrystfel/src/indexers
parent4960248e89b3083ebdeddbfdef6bea83ad5225c8 (diff)
Make all the indexer-specific option structures non-opaque
Making them opaque seemed like a nice idea, because all the indexers could take care of their own command-line arguments. However, it doesn't work at all when indexing is run via the API.
Diffstat (limited to 'libcrystfel/src/indexers')
-rw-r--r--libcrystfel/src/indexers/felix.c20
-rw-r--r--libcrystfel/src/indexers/felix.h2
-rw-r--r--libcrystfel/src/indexers/fromfile.c10
-rw-r--r--libcrystfel/src/indexers/fromfile.h2
-rw-r--r--libcrystfel/src/indexers/pinkindexer.c24
-rw-r--r--libcrystfel/src/indexers/pinkindexer.h4
-rw-r--r--libcrystfel/src/indexers/taketwo.c12
-rw-r--r--libcrystfel/src/indexers/taketwo.h2
-rw-r--r--libcrystfel/src/indexers/xgandalf.c15
-rw-r--r--libcrystfel/src/indexers/xgandalf.h2
10 files changed, 24 insertions, 69 deletions
diff --git a/libcrystfel/src/indexers/felix.c b/libcrystfel/src/indexers/felix.c
index dcd50613..db9cccf8 100644
--- a/libcrystfel/src/indexers/felix.c
+++ b/libcrystfel/src/indexers/felix.c
@@ -62,26 +62,12 @@
#include "cell.h"
#include "cell-utils.h"
#include "felix.h"
+#include "index.h"
#define FELIX_VERBOSE 0
-struct felix_options
-{
- double ttmin; /* radians */
- double ttmax; /* radians */
- int min_visits;
- double min_completeness;
- double max_uniqueness;
- int n_voxels;
- double fraction_max_visits;
- double sigma;
- double domega;
- double max_internal_angle;
-};
-
-
/* Global private data, prepared once */
struct felix_private
{
@@ -820,9 +806,9 @@ static void felix_show_help()
}
-int felix_default_options(FelixOptions **opts_ptr)
+int felix_default_options(struct felix_options **opts_ptr)
{
- FelixOptions *opts;
+ struct felix_options *opts;
opts = malloc(sizeof(struct felix_options));
if ( opts == NULL ) return ENOMEM;
diff --git a/libcrystfel/src/indexers/felix.h b/libcrystfel/src/indexers/felix.h
index 83179d6f..6379c4ee 100644
--- a/libcrystfel/src/indexers/felix.h
+++ b/libcrystfel/src/indexers/felix.h
@@ -39,7 +39,7 @@
* Felix indexer interface
*/
-extern int felix_default_options(FelixOptions **opts_ptr);
+extern int felix_default_options(struct felix_options **opts_ptr);
extern void *felix_prepare(IndexingMethod *indm, UnitCell *cell,
struct felix_options *opts);
diff --git a/libcrystfel/src/indexers/fromfile.c b/libcrystfel/src/indexers/fromfile.c
index 9a99b242..f0372489 100644
--- a/libcrystfel/src/indexers/fromfile.c
+++ b/libcrystfel/src/indexers/fromfile.c
@@ -42,14 +42,10 @@
#include "image.h"
#include "uthash.h"
+#include "index.h"
/** \file fromfile.h */
-struct fromfile_options
-{
- char *filename;
-};
-
#define MAX_KEY_LEN (256)
#define MAX_CRYSTALS (16)
@@ -373,9 +369,9 @@ static void fromfile_show_help()
}
-int fromfile_default_options(FromFileOptions **opts_ptr)
+int fromfile_default_options(struct fromfile_options **opts_ptr)
{
- FromFileOptions *opts;
+ struct fromfile_options *opts;
opts = malloc(sizeof(struct fromfile_options));
if ( opts == NULL ) return ENOMEM;
opts->filename = NULL;
diff --git a/libcrystfel/src/indexers/fromfile.h b/libcrystfel/src/indexers/fromfile.h
index 375a54e5..caff07c5 100644
--- a/libcrystfel/src/indexers/fromfile.h
+++ b/libcrystfel/src/indexers/fromfile.h
@@ -36,7 +36,7 @@
#include "image.h"
-extern int fromfile_default_options(FromFileOptions **opts_ptr);
+extern int fromfile_default_options(struct fromfile_options **opts_ptr);
extern void *fromfile_prepare(IndexingMethod *indm,
struct fromfile_options *opts);
extern int fromfile_index(struct image *image, void *mpriv);
diff --git a/libcrystfel/src/indexers/pinkindexer.c b/libcrystfel/src/indexers/pinkindexer.c
index 7da44f73..7522aad1 100644
--- a/libcrystfel/src/indexers/pinkindexer.c
+++ b/libcrystfel/src/indexers/pinkindexer.c
@@ -39,19 +39,9 @@
#include "utils.h"
#include "cell-utils.h"
#include "peaks.h"
+#include "index.h"
-struct pinkIndexer_options {
- unsigned int considered_peaks_count;
- unsigned int angle_resolution;
- unsigned int refinement_type;
- float maxResolutionForIndexing_1_per_A;
- float tolerance;
- float reflectionRadius; /* In m^-1 */
- float customBandwidth;
- float maxRefinementDisbalance;
-};
-
#ifdef HAVE_PINKINDEXER
#include <pinkIndexer/adaptions/crystfel/Lattice.h>
@@ -190,7 +180,7 @@ int run_pinkIndexer(struct image *image, void *ipriv, int n_threads)
void *pinkIndexer_prepare(IndexingMethod *indm,
UnitCell *cell,
- struct pinkIndexer_options *pinkIndexer_opts,
+ struct pinkindexer_options *pinkIndexer_opts,
double wavelength_estimate,
double clen_estimate)
{
@@ -383,7 +373,7 @@ int run_pinkIndexer(struct image *image, void *ipriv, int n_threads)
extern void *pinkIndexer_prepare(IndexingMethod *indm,
UnitCell *cell,
- struct pinkIndexer_options *pinkIndexer_opts,
+ struct pinkindexer_options *pinkIndexer_opts,
double wavelength_estimate,
double clen_estimate)
{
@@ -431,11 +421,11 @@ static void pinkIndexer_show_help()
}
-int pinkIndexer_default_options(PinkIndexerOptions **opts_ptr)
+int pinkIndexer_default_options(struct pinkindexer_options **opts_ptr)
{
- PinkIndexerOptions *opts;
+ struct pinkindexer_options *opts;
- opts = malloc(sizeof(struct pinkIndexer_options));
+ opts = malloc(sizeof(struct pinkindexer_options));
if ( opts == NULL ) return ENOMEM;
opts->considered_peaks_count = 4;
@@ -456,7 +446,7 @@ static error_t pinkindexer_parse_arg(int key, char *arg,
{
float tmp;
int r;
- struct pinkIndexer_options **opts_ptr = state->input;
+ struct pinkindexer_options **opts_ptr = state->input;
switch ( key ) {
diff --git a/libcrystfel/src/indexers/pinkindexer.h b/libcrystfel/src/indexers/pinkindexer.h
index 122bac87..c75b5551 100644
--- a/libcrystfel/src/indexers/pinkindexer.h
+++ b/libcrystfel/src/indexers/pinkindexer.h
@@ -35,13 +35,13 @@
#include "index.h"
#include "datatemplate.h"
-extern int pinkIndexer_default_options(PinkIndexerOptions **opts_ptr);
+extern int pinkIndexer_default_options(struct pinkindexer_options **opts_ptr);
extern int run_pinkIndexer(struct image *image, void *ipriv, int n_threads);
extern void *pinkIndexer_prepare(IndexingMethod *indm,
UnitCell *cell,
- struct pinkIndexer_options *pinkIndexer_opts,
+ struct pinkindexer_options *pinkIndexer_opts,
double wavelength_estimate,
double clen_estimate);
diff --git a/libcrystfel/src/indexers/taketwo.c b/libcrystfel/src/indexers/taketwo.c
index 8ce33083..60bb6fed 100644
--- a/libcrystfel/src/indexers/taketwo.c
+++ b/libcrystfel/src/indexers/taketwo.c
@@ -102,14 +102,6 @@
#include "peaks.h"
#include "symmetry.h"
-struct taketwo_options
-{
- int member_thresh;
- double len_tol;
- double angle_tol;
- double trace_tol;
-};
-
/**
* \param obsvec an observed vector between two spots
* \param matches array of matching theoretical vectors from unit cell
@@ -2284,9 +2276,9 @@ static void taketwo_show_help()
}
-int taketwo_default_options(TakeTwoOptions **opts_ptr)
+int taketwo_default_options(struct taketwo_options **opts_ptr)
{
- TakeTwoOptions *opts;
+ struct taketwo_options *opts;
opts = malloc(sizeof(struct taketwo_options));
if ( opts == NULL ) return ENOMEM;
diff --git a/libcrystfel/src/indexers/taketwo.h b/libcrystfel/src/indexers/taketwo.h
index f3157d72..471b08b2 100644
--- a/libcrystfel/src/indexers/taketwo.h
+++ b/libcrystfel/src/indexers/taketwo.h
@@ -38,7 +38,7 @@
/** \file taketwo.h */
-extern int taketwo_default_options(TakeTwoOptions **opts_ptr);
+extern int taketwo_default_options(struct taketwo_options **opts_ptr);
extern void *taketwo_prepare(IndexingMethod *indm, struct taketwo_options *opts,
UnitCell *cell);
extern const char *taketwo_probe(UnitCell *cell);
diff --git a/libcrystfel/src/indexers/xgandalf.c b/libcrystfel/src/indexers/xgandalf.c
index ada0507a..d83af6cb 100644
--- a/libcrystfel/src/indexers/xgandalf.c
+++ b/libcrystfel/src/indexers/xgandalf.c
@@ -35,6 +35,7 @@
#include "utils.h"
#include "cell-utils.h"
#include "peaks.h"
+#include "index.h"
#ifdef HAVE_XGANDALF
#include "xgandalf/adaptions/crystfel/Lattice.h"
@@ -44,16 +45,6 @@
/** \file xgandalf.h */
-struct xgandalf_options {
- unsigned int sampling_pitch;
- unsigned int grad_desc_iterations;
- float tolerance;
- unsigned int no_deviation_from_provided_cell;
- float minLatticeVectorLength_A;
- float maxLatticeVectorLength_A;
- int maxPeaksForIndexing;
-};
-
#ifdef HAVE_XGANDALF
struct xgandalf_private_data {
@@ -387,9 +378,9 @@ static void xgandalf_show_help()
}
-int xgandalf_default_options(XGandalfOptions **opts_ptr)
+int xgandalf_default_options(struct xgandalf_options **opts_ptr)
{
- XGandalfOptions *opts;
+ struct xgandalf_options *opts;
opts = malloc(sizeof(struct xgandalf_options));
if ( opts == NULL ) return ENOMEM;
diff --git a/libcrystfel/src/indexers/xgandalf.h b/libcrystfel/src/indexers/xgandalf.h
index 79078410..b43f09ea 100644
--- a/libcrystfel/src/indexers/xgandalf.h
+++ b/libcrystfel/src/indexers/xgandalf.h
@@ -39,7 +39,7 @@
#include "index.h"
-extern int xgandalf_default_options(XGandalfOptions **opts_ptr);
+extern int xgandalf_default_options(struct xgandalf_options **opts_ptr);
extern int run_xgandalf(struct image *image, void *ipriv);