v.1.0.0-rc.32
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "MXImageAnalyzer.h"
|
||||
#include "../common/CUDAWrapper.h"
|
||||
#include "../common/AzimuthalIntegrationProfile.h"
|
||||
#include "AzimuthalIntegrationCPU.h"
|
||||
#include "StrongPixelSet.h"
|
||||
|
||||
MXImageAnalyzer::MXImageAnalyzer(const AzimuthalIntegration &in_integration,
|
||||
const DiffractionGeometry& in_geom,
|
||||
const std::optional<UnitCell> &uc,
|
||||
size_t width, size_t height)
|
||||
: integration(in_integration), geom(in_geom), spotFinder(integration.Resolution(), width, height) {
|
||||
if (uc && (get_gpu_count() > 0)) {
|
||||
try {
|
||||
indexer = std::make_unique<IndexerWrapper>();
|
||||
indexer->Setup(uc.value());
|
||||
} catch (const std::exception &e) {
|
||||
throw JFJochException(JFJochExceptionCategory::GPUCUDAError, e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void MXImageAnalyzer::ProcessInternal(DataMessage &message, const T* data, const SpotFindingSettings& settings) {
|
||||
AzimuthalIntegrationProfile profile(integration);
|
||||
AzimuthalIntegrationCPU(integration, profile, data);
|
||||
|
||||
message.az_int_profile = profile.GetResult();
|
||||
message.bkg_estimate = profile.GetBkgEstimate(integration.Settings());
|
||||
|
||||
std::vector<DiffractionSpot> spots = spotFinder.Run(data, settings);
|
||||
std::vector<DiffractionSpot> spots_out;
|
||||
FilterSpotsByCount(250, spots, spots_out);
|
||||
|
||||
for (const auto &spot: spots_out)
|
||||
message.spots.push_back(spot);
|
||||
|
||||
message.indexing_result = false;
|
||||
|
||||
if (indexer && settings.indexing)
|
||||
indexer->Run(message, spots_out, geom, settings.indexing_tolerance);
|
||||
}
|
||||
|
||||
void MXImageAnalyzer::Process(DataMessage &message, const int16_t *data, const SpotFindingSettings &settings) {
|
||||
ProcessInternal(message, data, settings);
|
||||
}
|
||||
|
||||
|
||||
void MXImageAnalyzer::Process(DataMessage &message, const int32_t *data, const SpotFindingSettings &settings) {
|
||||
ProcessInternal(message, data, settings);
|
||||
}
|
||||
Reference in New Issue
Block a user