30 lines
977 B
C++
30 lines
977 B
C++
// SPDX-FileCopyrightText: 2026 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/PixelMask.h"
|
|
|
|
struct alignas(8) ImageStatistics {
|
|
unsigned long long error_pixel_count = 0;
|
|
unsigned long long saturated_pixel_count = 0;
|
|
unsigned long long masked_pixel_count = 0;
|
|
long long max_value = INT64_MIN;
|
|
long long min_value = INT64_MAX;
|
|
};
|
|
|
|
class ImagePreprocessor {
|
|
protected:
|
|
const size_t npixels;
|
|
const DiffractionExperiment &experiment;
|
|
const int64_t saturation_limit;
|
|
public:
|
|
ImagePreprocessor(const DiffractionExperiment &experiment);
|
|
virtual ~ImagePreprocessor() = default;
|
|
virtual ImageStatistics Analyze(std::vector<int32_t> &processed_image, const uint8_t *decompressed_image, CompressedImageMode image_mode) = 0;
|
|
};
|