ImagePreprocessor: Dedicated class to handle preprocessing of diffraction images in Receiver Lite workflow + remove ROI calculation in Lite workflow
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include "../common/CompressedImage.h"
|
||||
#include "../common/DiffractionExperiment.h"
|
||||
#include "../common/AzimuthalIntegration.h"
|
||||
#include "../common/PixelMask.h"
|
||||
#include "../common/AzimuthalIntegrationProfile.h"
|
||||
|
||||
struct ImageStatistics {
|
||||
size_t error_pixel_count = 0;
|
||||
size_t saturated_pixel_count = 0;
|
||||
size_t masked_pixel_count = 0;
|
||||
int64_t max_value = INT64_MIN;
|
||||
int64_t min_value = INT64_MAX;
|
||||
};
|
||||
|
||||
class ImagePreprocessor {
|
||||
protected:
|
||||
const size_t npixels;
|
||||
const DiffractionExperiment &experiment;
|
||||
const AzimuthalIntegration &integration;
|
||||
|
||||
std::vector<float> azint_sum;
|
||||
std::vector<float> azint_sum2;
|
||||
std::vector<uint32_t> azint_count;
|
||||
std::vector<int32_t> processed_image;
|
||||
|
||||
std::vector<bool> mask_1bit;
|
||||
|
||||
uint16_t azint_bins;
|
||||
const int64_t saturation_limit;
|
||||
|
||||
public:
|
||||
ImagePreprocessor(const DiffractionExperiment &experiment, const AzimuthalIntegration &integration, const PixelMask &mask);
|
||||
|
||||
virtual ~ImagePreprocessor() = default;
|
||||
virtual ImageStatistics Analyze(const uint8_t *decompressed_image, CompressedImageMode image_mode) = 0;
|
||||
|
||||
[[nodiscard]] const std::vector<int32_t> &GetProcessedImage() const;
|
||||
|
||||
void Update(AzimuthalIntegrationProfile &profile) const;
|
||||
};
|
||||
Reference in New Issue
Block a user