ebc28744e2
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>
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
#include <mutex>
|
|
#include "MultiLinePlot.h"
|
|
|
|
#include "AzimuthalIntegrationMapping.h"
|
|
#include "../fpga/pcie_driver/jfjoch_fpga.h" // DeviceOutput
|
|
|
|
class AzimuthalIntegrationProfile {
|
|
mutable std::mutex m;
|
|
std::vector<float> sum;
|
|
std::vector<float> sum2;
|
|
std::vector<uint64_t> count;
|
|
std::vector<float> bin_to_q;
|
|
std::vector<float> bin_to_d;
|
|
std::vector<float> bin_to_2theta;
|
|
std::vector<float> bin_to_phi;
|
|
std::vector<float> bin_to_q_1d;
|
|
|
|
int32_t q_bins;
|
|
int32_t azim_bins;
|
|
std::string title;
|
|
|
|
const std::vector<float>& GetXAxis(PlotAzintUnit unit) const;
|
|
public:
|
|
explicit AzimuthalIntegrationProfile(const AzimuthalIntegrationMapping &mapping);
|
|
void Clear(const AzimuthalIntegrationMapping &mapping);
|
|
void SetTitle(const std::string& input);
|
|
void Add(const DeviceOutput &result);
|
|
void Add(const std::vector<float> &sum,
|
|
const std::vector<float> &sum2,
|
|
const std::vector<uint32_t> &count);
|
|
void Add(int64_t bin, int64_t value);
|
|
|
|
std::vector<float> GetResult() const;
|
|
std::vector<float> GetStd() const;
|
|
std::vector<uint64_t> GetPixelCount() const;
|
|
|
|
std::vector<float> GetResult1D() const;
|
|
|
|
float GetMeanValueOfBins(uint16_t min_bin, uint16_t max_bin) const;
|
|
float GetBkgEstimate(const AzimuthalIntegrationSettings& settings) const;
|
|
MultiLinePlot GetPlot(bool force_1d = false, PlotAzintUnit plot_unit = PlotAzintUnit::Q_recipA) const;
|
|
AzimuthalIntegrationProfile& operator+=(const AzimuthalIntegrationProfile& profile); // Not thread safe
|
|
};
|