43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
// Copyright (2019-2022) Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#ifndef JUNGFRAUJOCH_STRONGPIXELSET_H
|
|
#define JUNGFRAUJOCH_STRONGPIXELSET_H
|
|
|
|
#include <unordered_map>
|
|
#include <mutex>
|
|
#include "../common/DiffractionExperiment.h"
|
|
#include "../common/Coord.h"
|
|
#include "../common/DiffractionSpot.h"
|
|
|
|
inline uint32_t strong_pixel_coord(uint16_t col, uint16_t line) {
|
|
return col + (static_cast<uint32_t>(line) << 16u);
|
|
}
|
|
|
|
inline uint16_t line_from_strong_pixel(uint32_t strong_pixel) {
|
|
return ((strong_pixel & 0xFFFF0000u) >> 16u);
|
|
}
|
|
|
|
inline uint16_t col_from_strong_pixel(uint32_t strong_pixel) {
|
|
return (strong_pixel & 0x0000FFFFu);
|
|
}
|
|
|
|
class StrongPixelSet {
|
|
std::unordered_map<uint32_t, int32_t> strong_pixel_map;
|
|
uint32_t xpixel;
|
|
uint32_t ypixel;
|
|
std::vector<bool> strong_pixel_vector;
|
|
void AddNeighbor(DiffractionSpot &spot, uint16_t col, uint16_t line);
|
|
DiffractionSpot BuildSpot(std::unordered_map<uint32_t, int32_t>::iterator &it_frames);
|
|
void ExtendSpot(DiffractionSpot &spot, std::unordered_map<uint32_t, int32_t>::iterator &it_frames);
|
|
public:
|
|
StrongPixelSet(const DiffractionExperiment& experiment);
|
|
size_t Count() const;
|
|
void AddStrongPixel(uint16_t col, uint16_t line, int32_t photons = 1);
|
|
void FindSpots(const DiffractionExperiment &experiment, const JFJochProtoBuf::DataProcessingSettings &settings, std::vector<DiffractionSpot> &spots);
|
|
size_t Common(const StrongPixelSet &set) const;
|
|
};
|
|
|
|
|
|
#endif //JUNGFRAUJOCH_STRONGPIXELSET_H
|