Files
leonarski_f 9de65e195e
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 22m36s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 30m21s
Build Packages / Build documentation (push) Successful in 45s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 30m22s
Build Packages / Validation Battery (push) Successful in 44m53s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 31m42s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 38m51s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 26m6s
Build Packages / Unit tests (push) Successful in 2h20m32s
Build Packages / Create release (push) Successful in 8s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m41s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 26m37s
Build Packages / Generate python client (push) Successful in 1m3s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 11m41s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 17m13s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 26m16s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 32m10s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 30m12s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 30m19s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 33m53s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 33m7s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 35m27s
v1.0.0-rc.183 (#94)
* jfjoch_broker (experimental): Serial data are merged live, with intermediate results during the collection.
* Rugnux: More robust processing of serial data, including CCD detectors.
* Rugnux: Parts of a rotation sweep that spoil the merge are removed automatically.
* Rugnux: Clearer maps, and anomalous peaks not explained by the model are reported.
* Rugnux: SHELX files work with SHELXL; XFEL pulse IDs are kept in `_process.h5`.
* Web frontend: Spot-finding settings change only when the user changes them.
* Rugnux: Faster processing.

Reviewed-on: #94
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2026-11-06 03:34:07 +01:00

70 lines
2.7 KiB
C++

// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#ifndef JFJOCHIMAGEREADER_H
#define JFJOCHIMAGEREADER_H
#include <unordered_set>
#include <map>
#include <mutex>
#include "../common/JFJochMessages.h"
#include "../common/Plot.h"
#include "../common/ROIBox.h"
#include "../common/DiffractionExperiment.h"
#include "JFJochReaderDataset.h"
#include "JFJochReaderImage.h"
#include "JFJochReaderSpots.h"
class JFJochReader {
// Reads each of its inputs' frames through them (JFJochMultiReader.h).
friend class JFJochMultiReader;
mutable std::mutex m;
std::shared_ptr<JFJochReaderDataset> dataset;
virtual bool LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset,
DataMessage& message,
std::vector<uint8_t> &buffer,
int64_t image_number,
bool update_dataset) = 0;
mutable std::mutex summation_mutex;
void SummationThread(int64_t image0,
int64_t n_image,
int64_t image_jump,
JFJochReaderImage &image);
protected:
void SetStartMessage(const std::shared_ptr<JFJochReaderDataset> &val);
DiffractionExperiment default_experiment;
public:
virtual ~JFJochReader() = default;
JFJochReader& Experiment(const DiffractionExperiment& experiment);
std::shared_ptr<const JFJochReaderDataset> GetDataset() const;
[[nodiscard]] virtual uint64_t GetNumberOfImages() const = 0;
virtual void Close() = 0;
std::shared_ptr<JFJochReaderImage> LoadImage(int64_t image_number, int64_t summation_factor = 1);
void UpdateGeomMetadata(const DiffractionExperiment& experiment);
void UpdateUserMask(const std::vector<uint32_t>& mask);
void AddDeadPixelMask(const std::vector<uint32_t>& mask);
// Read one image into a raw image the caller owns, false where there is nothing to read. A
// worker that walks a whole sweep hands the same object back on every frame and so keeps its
// buffer: GetRawImage() allocates a fresh one per call, which on a 4-byte 16 Mpx frame is 72 MB
// of untouched pages the decoder then faults in one by one, measurably more than the decode.
virtual bool ReadRawImage(int64_t image_number, JFJochReaderRawImage &image) = 0;
// The same image in a freshly allocated raw image.
std::shared_ptr<JFJochReaderRawImage> GetRawImage(int64_t image_number);
virtual std::vector<SpotToSave> ReadSpots(int64_t image) const = 0;
std::shared_ptr<JFJochReaderSpots> ReadAllSpots(int64_t start_image, int64_t end_image, int64_t stride = 1) const;
};
#endif //JFJOCHIMAGEREADER_H