aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/crystfel_geometry.55
-rw-r--r--libcrystfel/src/datatemplate.c25
-rw-r--r--libcrystfel/src/datatemplate_priv.h8
-rw-r--r--libcrystfel/src/image.c34
4 files changed, 68 insertions, 4 deletions
diff --git a/doc/man/crystfel_geometry.5 b/doc/man/crystfel_geometry.5
index 9435a900..6959e4cf 100644
--- a/doc/man/crystfel_geometry.5
+++ b/doc/man/crystfel_geometry.5
@@ -104,6 +104,11 @@ These specify that the entire detector should be shifted by this amount in the x
.PD
This gives the location of the peak list (for \fB--peaks=cxi\fR or \fB--peaks=hdf5\fR - see indexamajig(1)) in the data files.
+.PD 0
+.IP "\fBpeak_list_type = \fIlayout"
+.PD
+Specify the layout of the peak list. Allowed values are \fBcxi\fR (peak list as used in CXI files from Cheetah), \fBlist3\fR (peak list as used in single-frame HDF5 files from Cheetah) and \fBauto\fR (determine layout from input file extension).
+
.SH PER-PANEL VALUES
The following parameters can be set for each panel individually. Don't forget that they can also be used at the "top level" to set default values.
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c
index 18b09c12..0da913d4 100644
--- a/libcrystfel/src/datatemplate.c
+++ b/libcrystfel/src/datatemplate.c
@@ -756,6 +756,28 @@ static int parse_photon_energy(const char *val,
}
+static int parse_peak_layout(const char *val,
+ enum peak_layout *layout)
+{
+ if ( strcmp(val, "auto") == 0 ) {
+ *layout = PEAK_LIST_AUTO;
+ return 0;
+ }
+
+ if ( strcmp(val, "cxi") == 0 ) {
+ *layout = PEAK_LIST_CXI;
+ return 0;
+ }
+
+ if ( (strcmp(val, "list3") == 0) ) {
+ *layout = PEAK_LIST_LIST3;
+ return 0;
+ }
+
+ return 1;
+}
+
+
static int parse_toplevel(DataTemplate *dt,
const char *key,
const char *val,
@@ -812,6 +834,9 @@ static int parse_toplevel(DataTemplate *dt,
} else if ( strcmp(key, "peak_list") == 0 ) {
dt->peak_list = strdup(val);
+ } else if ( strcmp(key, "peak_list_type") == 0 ) {
+ return parse_peak_layout(val, &dt->peak_list_type);
+
} else if ( strcmp(key, "bandwidth") == 0 ) {
double v;
char *end;
diff --git a/libcrystfel/src/datatemplate_priv.h b/libcrystfel/src/datatemplate_priv.h
index 593ebaa8..5f598184 100644
--- a/libcrystfel/src/datatemplate_priv.h
+++ b/libcrystfel/src/datatemplate_priv.h
@@ -65,6 +65,13 @@ enum flag_value_type
FLAG_LESSTHAN
};
+enum peak_layout
+{
+ PEAK_LIST_AUTO,
+ PEAK_LIST_CXI,
+ PEAK_LIST_LIST3
+};
+
/* Special values for dimension IDs */
#define DIM_FS (-1)
#define DIM_SS (-2)
@@ -203,6 +210,7 @@ struct _datatemplate
int n_rg_collections;
char *peak_list;
+ enum peak_layout peak_list_type;
/* Shift of whole detector, in m */
char * shift_x_from;
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index d50bcf43..54171321 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -938,19 +938,45 @@ ImageFeatureList *image_read_peaks(const DataTemplate *dtempl,
{
if ( is_hdf5_file(filename) ) {
- const char *ext;
- ext = filename_extension(filename, NULL);
- if ( strcmp(ext, ".cxi") == 0 ) {
+ enum peak_layout layout;
+
+ if ( dtempl->peak_list_type == PEAK_LIST_AUTO ) {
+
+ const char *ext;
+ ext = filename_extension(filename, NULL);
+
+ if ( strcmp(ext, ".cxi") == 0 ) {
+ layout = PEAK_LIST_CXI;
+ } else if ( strcmp(ext, ".h5") == 0 ) {
+ layout = PEAK_LIST_LIST3;
+ } else {
+ ERROR("Couldn't determine peak list layout.\n");
+ ERROR("Specify peak_layout = cxi or list3n in geometry file.\n");
+ return NULL;
+ }
+
+ } else {
+ layout = dtempl->peak_list_type;
+ }
+
+ switch ( layout ) {
+
+ case PEAK_LIST_CXI :
return image_hdf5_read_peaks_cxi(dtempl,
filename,
event,
half_pixel_shift);
- } else {
+ case PEAK_LIST_LIST3 :
return image_hdf5_read_peaks_hdf5(dtempl,
filename,
event,
half_pixel_shift);
+
+ default :
+ ERROR("Invalid peak list type %i\n", layout);
+ return NULL;
+
}
} else {