Files
Jungfraujoch/image_analysis/image_preprocessing/ImagePreprocessor.h
T

35 lines
1.1 KiB
C++

// 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/PixelMask.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;
std::vector<int32_t> &processed_image;
std::vector<bool> mask_1bit;
const int64_t saturation_limit;
template <class T> ImageStatistics Analyze(const uint8_t *input, T err_value, T sat_value);
public:
ImagePreprocessor(const DiffractionExperiment &experiment,
const PixelMask &mask,
std::vector<int32_t> &processed_image);
ImageStatistics Analyze(const uint8_t *decompressed_image, CompressedImageMode image_mode);
};