aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-03-31 16:27:13 +0200
committerThomas White <taw@physics.org>2017-03-31 16:30:13 +0200
commit3746b4dbed15569764ec6de473806468951748b8 (patch)
tree6539282693783345105809166fa58fc9b25cb943 /src
parent10fd97e6f88bd4d28ffc2bff56aa5ff19ca436ae (diff)
Offset peak locations from HDF5 or CXI files by 0.5,0.5
CrystFEL considers all peak locations to be distances from the corner of the detector panel, in pixel units, consistent with its description of detector geometry. In contrast, Cheetah considers the peak locations to be pixel indices in the data array. Therefore, a half-pixel offset is needed when importing the peak lists. For users who need the old behaviour, this commit adds a new option indexamajig --no-half-pixel-shift to deactivate this offset.
Diffstat (limited to 'src')
-rw-r--r--src/indexamajig.c23
-rw-r--r--src/process_image.c10
-rw-r--r--src/process_image.h1
3 files changed, 21 insertions, 13 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 28a7bf85..f48fac17 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -152,16 +152,17 @@ static void show_help(const char *s)
" --temp-dir=<path> Put the temporary folder under <path>.\n"
"\n"
"\nOptions you probably won't need:\n\n"
-" --no-check-prefix Don't attempt to correct the --prefix.\n"
-" --no-use-saturated During the initial peak search, reject\n"
-" peaks which contain pixels above max_adu.\n"
-" --no-revalidate Don't re-integrate and check HDF5 peaks for\n"
-" validity.\n"
-" --no-peaks-in-stream Do not record peak search results in the stream.\n"
-" --no-refls-in-stream Do not record integrated reflections in the stream.\n"
-" --int-diag=<cond> Show debugging information about reflections.\n"
-" --no-refine Skip the prediction refinement step.\n"
-" --profile Show timing data for performance monitoring.\n"
+" --no-check-prefix Don't attempt to correct the --prefix.\n"
+" --no-use-saturated During the initial peak search, reject\n"
+" peaks which contain pixels above max_adu.\n"
+" --no-revalidate Don't re-integrate and check HDF5 peaks for\n"
+" validity.\n"
+" --no-peaks-in-stream Do not record peak search results in the stream.\n"
+" --no-refls-in-stream Do not record integrated reflections in the stream.\n"
+" --int-diag=<cond> Show debugging information about reflections.\n"
+" --no-refine Skip the prediction refinement step.\n"
+" --profile Show timing data for performance monitoring.\n"
+" --no-half-pixel-shift Don't offset the HDF5 peak locations by 0.5 px.\n"
"\nLow-level options for the felix indexer:\n\n"
" --felix-options Change the default arguments passed to the indexer.\n"
" Given as a list of comma separated list of \n"
@@ -243,6 +244,7 @@ int main(int argc, char *argv[])
iargs.peaks = PEAK_ZAEF;
iargs.beam = &beam;
iargs.hdf5_peak_path = NULL;
+ iargs.half_pixel_shift = 1;
iargs.copyme = NULL;
iargs.pk_inn = -1.0;
iargs.pk_mid = -1.0;
@@ -297,6 +299,7 @@ int main(int argc, char *argv[])
{"check-hdf5-snr", 0, &iargs.check_hdf5_snr, 1},
{"no-refine", 0, &no_refine, 1},
{"profile", 0, &iargs.profile, 1},
+ {"no-half-pixel-shift",0, &iargs.half_pixel_shift, 0},
/* Long-only options which don't actually do anything */
{"no-sat-corr", 0, &iargs.satcorr, 0},
diff --git a/src/process_image.c b/src/process_image.c
index e6e6d22a..cd5c0866 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -160,7 +160,9 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
switch ( iargs->peaks ) {
case PEAK_HDF5:
- if ( get_peaks(&image, hdfile, iargs->hdf5_peak_path) ) {
+ if ( get_peaks_2(&image, hdfile, iargs->hdf5_peak_path,
+ iargs->half_pixel_shift) )
+ {
ERROR("Failed to get peaks from HDF5 file.\n");
}
if ( !iargs->no_revalidate ) {
@@ -172,8 +174,10 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
break;
case PEAK_CXI:
- if ( get_peaks_cxi(&image, hdfile, iargs->hdf5_peak_path,
- pargs->filename_p_e) ) {
+ if ( get_peaks_cxi_2(&image, hdfile, iargs->hdf5_peak_path,
+ pargs->filename_p_e,
+ iargs->half_pixel_shift) )
+ {
ERROR("Failed to get peaks from CXI file.\n");
}
if ( !iargs->no_revalidate ) {
diff --git a/src/process_image.h b/src/process_image.h
index bc8b31fd..d63679cf 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -67,6 +67,7 @@ struct index_args
float tols[4];
struct beam_params *beam;
char *hdf5_peak_path;
+ int half_pixel_shift;
float pk_inn;
float pk_mid;
float pk_out;