v1.0.0-rc.71
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "spot_finding/StrongPixelSet.h"
|
||||
#include "../compression/JFJochDecompress.h"
|
||||
#include "spot_finding/SpotAnalysis.h"
|
||||
#include "geom_refinement/XtalOptimizer.h"
|
||||
|
||||
#include "SpotAnalyze.h"
|
||||
|
||||
ImageAnalysisCPU::ImageAnalysisCPU(const DiffractionExperiment &in_experiment,
|
||||
const AzimuthalIntegration &in_integration,
|
||||
@@ -22,8 +22,6 @@ ImageAnalysisCPU::ImageAnalysisCPU(const DiffractionExperiment &in_experiment,
|
||||
mask(in_mask),
|
||||
indexer(nullptr) {
|
||||
|
||||
nquads = 2;
|
||||
|
||||
UpdateROI();
|
||||
|
||||
for (int i = 0; i < npixels; i++)
|
||||
@@ -151,56 +149,9 @@ void ImageAnalysisCPU::Analyze(DataMessage &output,
|
||||
if (spot_finding_settings.enable)
|
||||
spots = spotFinder.Run(image, spot_finding_settings);
|
||||
|
||||
std::vector<SpotToSave> spots_out;
|
||||
|
||||
auto geom = experiment.GetDiffractionGeometry();
|
||||
for (const auto &spot: spots)
|
||||
spots_out.push_back(spot.Export(geom));
|
||||
|
||||
CountSpots(output, spots_out, spot_finding_settings.cutoff_spot_count_low_res);
|
||||
|
||||
FilterSpotsByCount(experiment.GetMaxSpotCount(), spots_out, output.spots);
|
||||
|
||||
if ((indexer != nullptr) && spot_finding_settings.indexing) {
|
||||
auto latt_f = indexer->Run(experiment, output);
|
||||
auto latt = latt_f.get();
|
||||
|
||||
if (latt) {
|
||||
DiffractionExperiment experiment_copy(experiment);
|
||||
XtalOptimizerData data{
|
||||
.geom = experiment_copy.GetDiffractionGeometry(),
|
||||
.latt = latt.value()
|
||||
};
|
||||
switch (experiment.GetIndexingSettings().GetGeomRefinementAlgorithm()) {
|
||||
case GeomRefinementAlgorithmEnum::None:
|
||||
break;
|
||||
case GeomRefinementAlgorithmEnum::BeamCenter:
|
||||
XtalOptimizer(data, output.spots, false);
|
||||
experiment_copy.BeamX_pxl(data.geom.GetBeamX_pxl()).BeamY_pxl(data.geom.GetBeamY_pxl());
|
||||
output.beam_center_x = data.geom.GetBeamX_pxl();
|
||||
output.beam_center_y = data.geom.GetBeamY_pxl();
|
||||
latt = data.latt;
|
||||
output.indexing_lattice = data.latt;
|
||||
break;
|
||||
case GeomRefinementAlgorithmEnum::BeamCenterTetragonal:
|
||||
XtalOptimizer(data, output.spots, true);
|
||||
experiment_copy.BeamX_pxl(data.geom.GetBeamX_pxl()).BeamY_pxl(data.geom.GetBeamY_pxl());
|
||||
output.beam_center_x = data.geom.GetBeamX_pxl();
|
||||
output.beam_center_y = data.geom.GetBeamY_pxl();
|
||||
latt = data.latt;
|
||||
output.indexing_lattice = data.latt;
|
||||
break;
|
||||
}
|
||||
|
||||
if (spot_finding_settings.quick_integration) {
|
||||
auto img = CompressedImage(updated_image, experiment.GetXPixelsNum(), experiment.GetYPixelsNum());
|
||||
auto res = BraggIntegrate2D(experiment_copy, img, latt.value());
|
||||
|
||||
output.reflections = res.reflections;
|
||||
output.b_factor = res.b_factor;
|
||||
}
|
||||
}
|
||||
}
|
||||
SpotAnalyze(experiment, spot_finding_settings, spots,
|
||||
CompressedImage(updated_image, experiment.GetXPixelsNum(), experiment.GetYPixelsNum()),
|
||||
indexer, output);
|
||||
|
||||
output.max_viable_pixel_value = max_value;
|
||||
output.min_viable_pixel_value = min_value;
|
||||
@@ -208,18 +159,11 @@ void ImageAnalysisCPU::Analyze(DataMessage &output,
|
||||
output.saturated_pixel_count = sat_pixels;
|
||||
output.az_int_profile = profile.GetResult();
|
||||
output.bkg_estimate = profile.GetBkgEstimate(integration.Settings());
|
||||
if ((inference_client != nullptr) && spot_finding_settings.resolution_estimate)
|
||||
output.resolution_estimate = inference_client->Inference(experiment, mask, image, nquads);
|
||||
|
||||
for (const auto &[key, val]: roi_names)
|
||||
output.roi[key] = roi[val];
|
||||
}
|
||||
|
||||
ImageAnalysisCPU &ImageAnalysisCPU::NeuralNetInference(NeuralNetInferenceClient *client) {
|
||||
inference_client = client;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ImageAnalysisCPU &ImageAnalysisCPU::SetIndexer(IndexerThreadPool *new_indexer) {
|
||||
indexer = new_indexer;
|
||||
return *this;
|
||||
|
||||
Reference in New Issue
Block a user