Brings the stills-geom-auto-lcls merge resolution (b10a8ce00) onto the rc178-based stills branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
59 lines
2.5 KiB
C++
59 lines
2.5 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "JFJochReader.h"
|
|
#include "XTC.h"
|
|
|
|
// Reads serial-crystallography stills straight from LCLS-I XTC files: one camera image per event,
|
|
// from a single-panel detector such as the Rayonix CCDs at MFX and XPP. A multi-panel detector
|
|
// (CSPAD, ePix, JUNGFRAU at LCLS) is stored as raw per-module data with its own calibration, and is
|
|
// not read here.
|
|
//
|
|
// XTC records the events and not the experiment: there is no distance, beam centre or wavelength
|
|
// in it that this reader can use. Where a DIALS experiment list (.expt) lies beside the XTC files, or
|
|
// in their parent directory - the geometry a deposition ships for cctbx.xfel - it is read; otherwise
|
|
// the panel is placed square-on with its middle on the beam, the run measures the centre, and the
|
|
// pixel size, distance and wavelength are given on the command line.
|
|
//
|
|
// The images are stills: no goniometer. Each is decoded on demand. The pixels are passed on as
|
|
// stored - the CCD's constant offset of a few counts is left in, as it is in an SMV image, and the
|
|
// pre-scan finds the defective pixels.
|
|
class JFJochXTCReader : public JFJochReader {
|
|
std::vector<xtc::Frame> frames_;
|
|
std::shared_ptr<JFJochReaderDataset> dataset_;
|
|
bool has_geometry_ = false;
|
|
|
|
bool LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset,
|
|
DataMessage &message,
|
|
std::vector<uint8_t> &buffer,
|
|
int64_t image_number,
|
|
bool update_dataset) override;
|
|
|
|
template <class Buffer>
|
|
CompressedImage DecodeInto(int64_t image_number, Buffer &buffer, std::vector<uint8_t> &scratch) const;
|
|
|
|
void ReadGeometry(const std::string &expt);
|
|
|
|
public:
|
|
~JFJochXTCReader() override = default;
|
|
|
|
static bool CanRead(const std::string &path);
|
|
|
|
// path is one XTC stream, or a directory whose streams are all read.
|
|
void ReadFiles(const std::string &path);
|
|
// Whether a DIALS .expt beside the streams gave the geometry; without one the pixel size, the
|
|
// distance and the wavelength are the caller's to give.
|
|
[[nodiscard]] bool HasGeometry() const { return has_geometry_; }
|
|
|
|
[[nodiscard]] uint64_t GetNumberOfImages() const override;
|
|
void Close() override;
|
|
|
|
bool ReadRawImage(int64_t image_number, JFJochReaderRawImage &image) override;
|
|
[[nodiscard]] std::vector<SpotToSave> ReadSpots(int64_t image) const override;
|
|
};
|