RawFile

class RawFile : public aare::FileInterface

Class to read .raw files. The class will parse the master file to find the correct geometry for the frames.

Note

A more generic interface is available in the aare::File class. Consider using that unless you need raw file specific functionality.

Public Functions

RawFile(const std::filesystem::path &fname, const std::string &mode = "r")

RawFile constructor.

Parameters:
  • fname – path to the master file (.json)

  • mode – file mode (only “r” is supported at the moment)

virtual ~RawFile() override
virtual Frame read_frame() override

one frame from the file at the current position

Returns:

Frame

virtual Frame read_frame(size_t frame_number) override

read one frame from the file at the given frame number

Parameters:

frame_number – frame number to read

Returns:

frame

virtual std::vector<Frame> read_n(size_t n_frames) override

read n_frames from the file at the current position

Parameters:

n_frames – number of frames to read

Returns:

vector of frames

virtual void read_into(std::byte *image_buf) override

read one frame from the file at the current position and store it in the provided buffer

Parameters:

image_buf – buffer to store the frame

Returns:

void

virtual void read_into(std::byte *image_buf, size_t n_frames) override

read n_frames from the file at the current position and store them in the provided buffer

Parameters:
  • image_buf – buffer to store the frames

  • n_frames – number of frames to read

Returns:

void

void read_into(std::byte *image_buf, DetectorHeader *header)
void read_into(std::byte *image_buf, size_t n_frames, DetectorHeader *header)
virtual size_t frame_number(size_t frame_index) override

get the frame number at the given frame index

Parameters:

frame_index – index of the frame

Returns:

frame number

virtual size_t bytes_per_frame() override

get the size of one frame in bytes

Returns:

size of one frame

virtual size_t pixels_per_frame() override

get the number of pixels in one frame

Returns:

number of pixels in one frame

size_t bytes_per_pixel() const
virtual void seek(size_t frame_index) override

seek to the given frame number

Parameters:

frame_number – frame number to seek to

Returns:

void

virtual size_t tell() override

get the current position of the file pointer

Returns:

current position of the file pointer

virtual size_t total_frames() const override

get the total number of frames in the file

Returns:

total number of frames in the file

virtual size_t rows() const override

get the number of rows in the file

Returns:

number of rows in the file

virtual size_t cols() const override

get the number of columns in the file

Returns:

number of columns in the file

virtual size_t bitdepth() const override

get the bitdepth of the file

Returns:

bitdepth of the file

xy geometry()
size_t n_mod() const
RawMasterFile master() const
virtual DetectorType detector_type() const override

Private Functions

void get_frame_into(size_t frame_index, std::byte *frame_buffer, DetectorHeader *header = nullptr)

read the frame at the given frame index into the image buffer

Parameters:
  • frame_number – frame number to read

  • image_buf – buffer to store the frame

Frame get_frame(size_t frame_index)

get the frame at the given frame index

Parameters:

frame_number – frame number to read

Returns:

Frame

void update_geometry_with_roi()
int find_number_of_subfiles()
void open_subfiles()
void find_geometry()

Private Members

size_t n_subfiles = {}
size_t n_subfile_parts = {}
std::vector<std::vector<RawSubFile*>> subfiles
std::vector<xy> positions
std::vector<ModuleGeometry> m_module_pixel_0
ModuleConfig cfg = {0, 0}
RawMasterFile m_master
size_t m_current_frame = {}
size_t m_rows = {}
size_t m_cols = {}

Private Static Functions

static DetectorHeader read_header(const std::filesystem::path &fname)

read the header of the file

Parameters:

fname – path to the data subfile

Returns:

DetectorHeader