diff --git a/image_analysis/StrongPixelSet.cpp b/image_analysis/StrongPixelSet.cpp index 880e6372..5aeebaa9 100644 --- a/image_analysis/StrongPixelSet.cpp +++ b/image_analysis/StrongPixelSet.cpp @@ -2,6 +2,7 @@ #include #include "StrongPixelSet.h" +#include "../common/RawToConvertedGeometry.h" StrongPixelSet::StrongPixelSet(const DiffractionExperiment &experiment) : xpixel(experiment.GetXPixelsNum()), @@ -122,4 +123,21 @@ size_t StrongPixelSet::Common(const StrongPixelSet &set) const { ret++; } return ret; -} \ No newline at end of file +} + +void StrongPixelSet::ReadFPGAOutput(const DiffractionExperiment& experiment, + const DeviceOutput &output, + uint16_t module) { + auto out_ptr = (uint32_t *) output.spot_finding_result.strong_pixel; + for (int i = 0; i < RAW_MODULE_SIZE / (8 * sizeof(out_ptr[0])); i++) { + if (out_ptr[i]) { + for (int j = 0; j < 8 * sizeof(out_ptr[0]); j++) { + if (out_ptr[i] & (1 << j)) { + size_t npixel = i * 8 * sizeof(out_ptr[0])| j; + auto [col, line] = RawToConvertedCoordinate(experiment, module, npixel); + AddStrongPixel(col, line); + } + } + } + } +} diff --git a/image_analysis/StrongPixelSet.h b/image_analysis/StrongPixelSet.h index a78f310a..c1c24a28 100644 --- a/image_analysis/StrongPixelSet.h +++ b/image_analysis/StrongPixelSet.h @@ -8,6 +8,7 @@ #include "../common/DiffractionExperiment.h" #include "../common/Coord.h" #include "../common/DiffractionSpot.h" +#include "../receiver/AcquisitionDevice.h" inline uint32_t strong_pixel_coord(uint16_t col, uint16_t line) { return col + (static_cast(line) << 16u); @@ -30,6 +31,7 @@ class StrongPixelSet { DiffractionSpot BuildSpot(std::unordered_map::iterator &it_frames); void ExtendSpot(DiffractionSpot &spot, std::unordered_map::iterator &it_frames); public: + void ReadFPGAOutput(const DiffractionExperiment& experiment, const DeviceOutput& output, uint16_t module); StrongPixelSet(const DiffractionExperiment& experiment); size_t Count() const; void AddStrongPixel(uint16_t col, uint16_t line, int32_t photons = 1);