Files
Jungfraujoch/image_analysis/spot_finding/StrongPixelSet.h
T
leonarski_f ebc28744e2 viewer: fix MSVC compatibility in viewer-reachable code
Address portability issues found building jfjoch_viewer with MSVC:

- common/{ADUHistogram,AzimuthalIntegrationProfile}.h and
  image_analysis/spot_finding/StrongPixelSet.h only need DeviceOutput,
  so include fpga/pcie_driver/jfjoch_fpga.h (plain-C, self-contained)
  directly instead of acquisition_device/AcquisitionDevice.h, which
  dragged <unistd.h> into the viewer tree.
- common/time_utc.h: guard gmtime_r/timegm/localtime_r with the MSVC
  equivalents (gmtime_s/_mkgmtime/localtime_s) under _WIN32; drop the
  duplicated includes and add the headers used directly.
- gemmi_gph/gemmi/utf.hpp: vendor the upstream gemmi header; fileutil.hpp
  includes it on Windows for UTF8_to_wchar but it was never vendored.
- writer/HDF5Objects.cpp: ExtractFilename returns path.filename().string()
  (std::filesystem::path has no implicit conversion to std::string on
  Windows, where it is wchar_t-based).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 23:15:27 +02:00

41 lines
1.4 KiB
C++

// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "../../common/DiffractionExperiment.h"
#include "../../common/DiffractionSpot.h"
#include "../../fpga/pcie_driver/jfjoch_fpga.h" // DeviceOutput
#include "SpotFindingSettings.h"
struct strong_pixel {
uint16_t col;
uint16_t line;
int32_t counts;
};
class StrongPixelSet {
std::vector<strong_pixel> pixels;
std::vector<uint32_t> L;
static const constexpr size_t max_strong_pixel_per_module = 4000;
static const constexpr uint32_t xpixel = RAW_MODULE_COLS;
static const constexpr uint32_t ypixel = RAW_MODULE_LINES;
uint32_t strong_pixel_count;
uint32_t find_root(uint32_t e);
uint32_t make_union(uint32_t e1, uint32_t e2);
std::vector<DiffractionSpot> sparseccl();
public:
void ReadFPGAOutput(const DiffractionExperiment& experiment,
const DeviceOutput& output);
StrongPixelSet();
void AddStrongPixel(uint16_t col, uint16_t line, int32_t photons = 1);
void FindSpots(const DiffractionExperiment &experiment, const SpotFindingSettings &settings, std::vector<DiffractionSpot> &spots,
uint16_t module_number);
void FindSpotsImage(const SpotFindingSettings &settings, std::vector<DiffractionSpot> &spots);
uint32_t GetStrongPixelCount() const;
};