diff --git a/image_analysis/IndexAndRefine.cpp b/image_analysis/IndexAndRefine.cpp index df0e5eb5..0b9979ca 100644 --- a/image_analysis/IndexAndRefine.cpp +++ b/image_analysis/IndexAndRefine.cpp @@ -9,6 +9,7 @@ #include "indexing/AnalyzeIndexing.h" #include "indexing/FFTIndexer.h" #include "lattice_search/LatticeSearch.h" +#include IndexAndRefine::IndexAndRefine(const DiffractionExperiment &x, IndexerThreadPool *indexer) : min_accum_angle_deg(x.GetIndexingSettings().GetRotationIndexingMinAngularRange_deg()), @@ -198,10 +199,14 @@ void IndexAndRefine::ProcessImage(DataMessage &msg, .crystal_system = search_result_.system }; beam_center_updated = true; + experiment_copy.BeamX_pxl(updated_geom_.GetBeamX_pxl()) + .BeamY_pxl(updated_geom_.GetBeamY_pxl()) + .DetectorDistance_mm(updated_geom_.GetDetectorDistance_mm()); } } if (lattice_candidate) { + XtalOptimizerData data{ .geom = updated_geom_, .latt = lattice_candidate.value(), @@ -225,36 +230,34 @@ void IndexAndRefine::ProcessImage(DataMessage &msg, } break; } - if (XtalOptimizer(data, msg.spots)) { - if (AnalyzeIndexing(msg, experiment, data.latt)) { - msg.lattice_type = symmetry; + if (AnalyzeIndexing(msg, experiment, data.latt)) { + msg.lattice_type = symmetry; - float ewald_dist_cutoff = 0.001f; + float ewald_dist_cutoff = 0.001f; - if (msg.profile_radius) - ewald_dist_cutoff = msg.profile_radius.value() * 2.0f; - if (experiment.GetBraggIntegrationSettings().GetFixedProfileRadius_recipA()) - ewald_dist_cutoff = experiment.GetBraggIntegrationSettings().GetFixedProfileRadius_recipA().value() - * 3.0f; + if (msg.profile_radius) + ewald_dist_cutoff = msg.profile_radius.value() * 2.0f; + if (experiment.GetBraggIntegrationSettings().GetFixedProfileRadius_recipA()) + ewald_dist_cutoff = experiment.GetBraggIntegrationSettings().GetFixedProfileRadius_recipA().value() + * 3.0f; - if (beam_center_updated) { - msg.beam_corr_x = data.beam_corr_x; - msg.beam_corr_y = data.beam_corr_y; - } + if (beam_center_updated) { + msg.beam_corr_x = data.beam_corr_x; + msg.beam_corr_y = data.beam_corr_y; + } - if (spot_finding_settings.quick_integration) { - auto res = BraggIntegrate2D(experiment_copy, image, *lattice_candidate, - prediction, ewald_dist_cutoff, msg.number, symmetry.centering); + if (spot_finding_settings.quick_integration) { + auto res = BraggIntegrate2D(experiment_copy, image, *lattice_candidate, + prediction, ewald_dist_cutoff, msg.number, symmetry.centering); - constexpr size_t kMaxReflections = 10000; - if (res.size() > kMaxReflections) { - msg.reflections.assign(res.begin(), res.begin() + kMaxReflections); - } else - msg.reflections = res; + constexpr size_t kMaxReflections = 10000; + if (res.size() > kMaxReflections) { + msg.reflections.assign(res.begin(), res.begin() + kMaxReflections); + } else + msg.reflections = res; - CalcISigma(msg); - CalcWilsonBFactor(msg); - } + CalcISigma(msg); + CalcWilsonBFactor(msg); } } }