aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-05-23 12:01:59 +0200
committerThomas White <taw@physics.org>2013-05-27 17:33:15 +0200
commit4fd346391387f740c29561257a5af3fdfdd56700 (patch)
tree0eee358d475d4ca3bef2d45596fb4de33f71bf1b /src
parent2977589d2201ade9aa02289a54359288af2ff16e (diff)
Initial integration stuff
Diffstat (limited to 'src')
-rw-r--r--src/indexamajig.c33
-rw-r--r--src/process_image.c28
-rw-r--r--src/process_image.h7
3 files changed, 33 insertions, 35 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 208c0ed0..7d26c15d 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -66,6 +66,7 @@
#include "stream.h"
#include "reflist-utils.h"
#include "cell-utils.h"
+#include "integration.h"
#include "im-sandbox.h"
@@ -100,6 +101,7 @@ static void show_help(const char *s)
" hdf5 : Get from a table in HDF5 file.\n"
" --hdf5-peaks=<p> Find peaks table in HDF5 file here.\n"
" Default: /processing/hitfinder/peakinfo\n"
+" --integration=<meth> Perform final pattern integration using <meth>.\n"
"\n\n"
"For more control over the process, you might need:\n\n"
" --tolerance=<tol> Set the tolerances for cell comparison.\n"
@@ -139,17 +141,12 @@ static void show_help(const char *s)
" --no-check-prefix Don't attempt to correct the --prefix.\n"
" --closer-peak Don't integrate from the location of a nearby peak\n"
" instead of the predicted spot. Don't use.\n"
-" --no-bg-sub Don't subtract local background estimates from\n"
-" integrated intensities.\n"
" --use-saturated During the initial peak search, don't reject\n"
" peaks which contain pixels above max_adu.\n"
" --integrate-saturated During the final integration stage, don't reject\n"
" peaks which contain pixels above max_adu.\n"
" --no-revalidate Don't re-integrate and check HDF5 peaks for\n"
" validity.\n"
-" --integrate-found Skip the spot prediction step, and just integrate\n"
-" the intensities of the spots found by the initial\n"
-" peak search.\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"
);
@@ -179,6 +176,7 @@ int main(int argc, char *argv[])
char *use_this_one_instead;
struct index_args iargs;
char *intrad = NULL;
+ char *int_str = NULL;
/* Defaults */
iargs.cell = NULL;
@@ -186,7 +184,6 @@ int main(int argc, char *argv[])
iargs.median_filter = 0;
iargs.satcorr = 1;
iargs.closer = 0;
- iargs.bgsub = 1;
iargs.tols[0] = 5.0;
iargs.tols[1] = 5.0;
iargs.tols[2] = 5.0;
@@ -207,10 +204,8 @@ int main(int argc, char *argv[])
iargs.use_saturated = 0;
iargs.integrate_saturated = 0;
iargs.no_revalidate = 0;
- iargs.integrate_found = 0;
iargs.stream_peaks = 1;
iargs.stream_refls = 1;
- iargs.res_cutoff = 0;
iargs.copyme = new_copy_hdf5_field_list();
if ( iargs.copyme == NULL ) {
ERROR("Couldn't allocate HDF5 field list.\n");
@@ -218,6 +213,7 @@ int main(int argc, char *argv[])
}
iargs.indm = NULL; /* No default */
iargs.ipriv = NULL; /* No default */
+ iargs.int_meth = integration_method("rings", NULL);
/* Long options */
const struct option longopts[] = {
@@ -242,15 +238,11 @@ int main(int argc, char *argv[])
{"no-closer-peak", 0, &iargs.closer, 0},
{"closer-peak", 0, &iargs.closer, 1},
{"basename", 0, &config_basename, 1},
- {"bg-sub", 0, &iargs.bgsub, 1},
- {"no-bg-sub", 0, &iargs.bgsub, 0},
{"no-peaks-in-stream", 0, &iargs.stream_peaks, 0},
{"no-refls-in-stream", 0, &iargs.stream_refls, 0},
- {"res-cutoff", 0, &iargs.res_cutoff, 1},
{"integrate-saturated",0, &iargs.integrate_saturated,1},
{"use-saturated", 0, &iargs.use_saturated, 1},
{"no-revalidate", 0, &iargs.no_revalidate, 1},
- {"integrate-found", 0, &iargs.integrate_found, 1},
/* Long-only options with arguments */
{"peaks", 1, NULL, 2},
@@ -267,6 +259,7 @@ int main(int argc, char *argv[])
{"tolerance", 1, NULL, 13},
{"int-radius", 1, NULL, 14},
{"median-filter", 1, NULL, 15},
+ {"integration", 1, NULL, 16},
{0, 0, NULL, 0}
};
@@ -391,6 +384,10 @@ int main(int argc, char *argv[])
iargs.median_filter = atoi(optarg);
break;
+ case 16 :
+ int_str = strdup(optarg);
+ break;
+
case 0 :
break;
@@ -465,6 +462,18 @@ int main(int argc, char *argv[])
free(indm_str);
}
+ if ( int_str != NULL ) {
+
+ int err;
+
+ iargs.int_meth = integration_method(int_str, &err);
+ if ( err ) {
+ ERROR("Invalid integration method '%s'\n", int_str);
+ return 1;
+ }
+ free(int_str);
+ }
+
if ( toler != NULL ) {
int ttt;
ttt = sscanf(toler, "%f,%f,%f,%f",
diff --git a/src/process_image.c b/src/process_image.c
index ef673c84..bf694623 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -46,6 +46,7 @@
#include "stream.h"
#include "reflist-utils.h"
#include "process_image.h"
+#include "integration.h"
void process_image(const struct index_args *iargs, struct pattern_args *pargs,
@@ -188,34 +189,21 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
/* Integrate each crystal's diffraction spots */
for ( i=0; i<image.n_crystals; i++ ) {
- RefList *reflections;
-
/* Set default crystal parameter(s) */
crystal_set_profile_radius(image.crystals[i],
image.beam->profile_radius);
-
- if ( iargs->integrate_found ) {
- reflections = select_intersections(&image,
- image.crystals[i]);
- } else {
- reflections = find_intersections(&image,
- image.crystals[i]);
- }
-
- crystal_set_reflections(image.crystals[i], reflections);
+ crystal_set_mosaicity(image.crystals[i], 2e-3); /* radians */
+ crystal_set_image(image.crystals[i], &image);
}
/* Integrate all the crystals at once - need all the crystals so that
* overlaps can be detected. */
- integrate_reflections(&image, iargs->closer,
- iargs->bgsub,
- iargs->min_int_snr,
- iargs->ir_inn,
- iargs->ir_mid,
- iargs->ir_out,
- iargs->integrate_saturated,
- iargs->res_cutoff);
+ integrate_all(&image, iargs->int_meth,
+ iargs->closer,
+ iargs->min_int_snr,
+ iargs->ir_inn, iargs->ir_mid, iargs->ir_out,
+ iargs->integrate_saturated);
write_chunk(st, &image, hdfile,
iargs->stream_peaks, iargs->stream_refls);
diff --git a/src/process_image.h b/src/process_image.h
index 5fe11e33..03041562 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -34,6 +34,9 @@
#endif
+#include "integration.h"
+
+
enum {
PEAK_ZAEF,
PEAK_HDF5,
@@ -49,7 +52,6 @@ struct index_args
int median_filter;
int satcorr;
int closer;
- int bgsub;
float threshold;
float min_gradient;
float min_snr;
@@ -69,10 +71,9 @@ struct index_args
int integrate_saturated;
int use_saturated;
int no_revalidate;
- int integrate_found;
int stream_peaks;
int stream_refls;
- int res_cutoff;
+ IntegrationMethod int_meth;
};