ImageSpotFinder: Work in progress to combine ImageSpotFinders
This commit is contained in:
@@ -19,11 +19,13 @@ ImageAnalysisCPU::ImageAnalysisCPU(const DiffractionExperiment &in_experiment,
|
||||
npixels(experiment.GetPixelsNum()),
|
||||
xpixels(experiment.GetXPixelsNum()),
|
||||
mask_1bit(npixels, false),
|
||||
spotFinder(mask_1bit, in_integration),
|
||||
indexer(in_indexer),
|
||||
saturation_limit(experiment.GetSaturationLimit()),
|
||||
mask(in_mask),
|
||||
azint_bins(in_integration.GetBinNumber()) {
|
||||
azint_bins(in_integration.GetBinNumber()),
|
||||
mask_resolution(experiment.GetPixelsNum(), false),
|
||||
mask_high_res(-1),
|
||||
mask_low_res(-1) {
|
||||
|
||||
roi_map = experiment.ExportROIMap();
|
||||
roi_count = experiment.ROI().size();
|
||||
@@ -31,6 +33,8 @@ ImageAnalysisCPU::ImageAnalysisCPU(const DiffractionExperiment &in_experiment,
|
||||
|
||||
for (int i = 0; i < npixels; i++)
|
||||
mask_1bit[i] = (in_mask.GetMask().at(i) != 0);
|
||||
|
||||
spotFinder = std::make_unique<ImageSpotFinderCPU>(mask_1bit, experiment.GetXPixelsNum(), experiment.GetYPixelsNum());
|
||||
}
|
||||
|
||||
void ImageAnalysisCPU::Analyze(DataMessage &output, std::vector<uint8_t> &image, AzimuthalIntegrationProfile &profile,
|
||||
@@ -67,13 +71,21 @@ void ImageAnalysisCPU::Analyze(DataMessage &output, std::vector<uint8_t> &image,
|
||||
}
|
||||
}
|
||||
|
||||
void ImageAnalysisCPU::UpdateMaskResolution(const SpotFindingSettings &settings) {
|
||||
mask_low_res = settings.low_resolution_limit;
|
||||
mask_high_res = settings.high_resolution_limit;
|
||||
auto const &resolution_map = integration.Resolution();
|
||||
for (int i = 0; i < mask_resolution.size(); i++)
|
||||
mask_resolution[i] = (resolution_map[i] > mask_low_res) || (resolution_map[i] < mask_high_res);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void ImageAnalysisCPU::Analyze(DataMessage &output,
|
||||
const uint8_t *in_image,
|
||||
T err_pixel_val,
|
||||
T sat_pixel_val,
|
||||
AzimuthalIntegrationProfile &profile,
|
||||
const SpotFindingSettings &spot_finding_settings) {
|
||||
const SpotFindingSettings &settings) {
|
||||
auto image = reinterpret_cast<const T *>(in_image);
|
||||
|
||||
std::vector<ROIMessage> roi(roi_count);
|
||||
@@ -141,10 +153,15 @@ void ImageAnalysisCPU::Analyze(DataMessage &output,
|
||||
}
|
||||
}
|
||||
|
||||
if (spot_finding_settings.enable) {
|
||||
std::vector<DiffractionSpot> spots = spotFinder.Run(image, spot_finding_settings);
|
||||
if (settings.enable) {
|
||||
// Update resolution mask
|
||||
if (mask_high_res != settings.high_resolution_limit
|
||||
|| mask_low_res != settings.low_resolution_limit)
|
||||
UpdateMaskResolution(settings);
|
||||
|
||||
SpotAnalyze(experiment, spot_finding_settings, spots,
|
||||
const std::vector<DiffractionSpot> spots = spotFinder->Run(image, settings, mask_resolution);
|
||||
|
||||
SpotAnalyze(experiment, settings, spots,
|
||||
CompressedImage(updated_image, experiment.GetXPixelsNum(), experiment.GetYPixelsNum()),
|
||||
indexer, output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user