// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include "../../common/DiffractionSpot.h" #include "../image_preprocessing/ImagePreprocessorBuffer.h" class ImageSpotFinder { protected: const int32_t width, height; std::vector output_buffer; ImageSpotFinder(int32_t width, int32_t height); size_t OutputSize() const; size_t OutputByteSize() const; public: constexpr static int32_t MIN_VALID_PIXELS = 100; constexpr static int NBX = 15; virtual ~ImageSpotFinder() = default; // Detect flags the image's strong pixels into the internal bit buffer - the expensive step (local // box or per-ring background over every pixel). ExtractSpots then builds the spots from those // pixels; min/max-pix and the resolution mask enter only there, so several min-pix values can be // tried on ONE detection pass (MXAnalysisWithoutFPGA does that when min-pix is chosen per image). virtual void Detect(const ImagePreprocessorBuffer &image, const SpotFindingSettings &settings) = 0; std::vector ExtractSpots(const ImagePreprocessorBuffer &image, const SpotFindingSettings &settings, const std::vector &res_mask); std::vector Run(const ImagePreprocessorBuffer &image, const SpotFindingSettings &settings, const std::vector &res_mask); };