AARE
Data analysis library for PSI hybrid detectors
|
RawFile class to read .raw and .json files. More...
#include <RawFile.hpp>
Public Member Functions | |
RawFile (const std::filesystem::path &fname, const std::string &mode="r", const FileConfig &cfg={}) | |
RawFile constructor. | |
void | write (Frame &frame) override |
write function is not implemented for RawFile | |
Frame | read () override |
write a vector of frames to the file | |
std::vector< Frame > | read (size_t n_frames) override |
read n_frames from the file at the current position | |
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 | |
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 | |
size_t | frame_number (size_t frame_index) override |
get the frame number at the given frame index | |
size_t | bytes_per_frame () override |
get the number of bytess per frame | |
size_t | pixels () override |
get the number of pixels in the frame | |
void | seek (size_t frame_number) override |
seek to the given frame number | |
size_t | tell () override |
get the current position of the file pointer | |
void | set_config (int row, int col) |
set the module gap row and column | |
void | find_number_of_subfiles () |
get the number of subfiles for the RawFile | |
std::filesystem::path | master_fname () |
get the master file name path for the RawFile | |
std::filesystem::path | data_fname (int mod_id, int file_id) |
get the data file name path for the RawFile with the given module id and file id | |
~RawFile () | |
destructor: will delete the subfiles | |
size_t | total_frames () const override |
get the total number of frames in the file | |
ssize_t | rows () const override |
get the number of rows in the file | |
ssize_t | cols () const override |
get the number of columns in the file | |
ssize_t | bitdepth () const override |
get the bitdepth of the file | |
Frame | iread (size_t frame_number) |
read one frame from the file at the given frame number | |
std::vector< Frame > | iread (size_t frame_number, size_t n_frames) |
read n_frames from the file starting at the given frame number | |
Static Public Member Functions | |
static bool | is_master_file (std::filesystem::path fpath) |
check if the file is a master file | |
Data Fields | |
std::string | m_mode |
std::filesystem::path | m_fname |
std::filesystem::path | m_base_path |
std::string | m_base_name |
std::string | m_ext |
int | m_findex |
size_t | m_total_frames {} |
size_t | max_frames_per_file {} |
std::string | version |
DetectorType | m_type |
ssize_t | m_rows {} |
ssize_t | m_cols {} |
ssize_t | m_bitdepth {} |
size_t | current_frame {} |
Private Member Functions | |
void | get_frame_into (size_t frame_number, std::byte *image_buf) |
read the frame at the given frame number into the image buffer | |
Frame | get_frame (size_t frame_number) |
get the frame at the given frame number | |
void | parse_fname () |
parse the file name to get the extension, base name and index | |
void | parse_metadata () |
parse the metadata from the file | |
void | parse_raw_metadata () |
parse the metadata of a .raw file | |
void | parse_json_metadata () |
parse the metadata of a .json file | |
void | find_geometry () |
finds the geometry of the file | |
sls_detector_header | read_header (const std::filesystem::path &fname) |
read the header of the file | |
void | open_subfiles () |
open the subfiles | |
Private Attributes | |
size_t | n_subfiles |
size_t | n_subfile_parts |
std::vector< std::vector< SubFile * > > | subfiles |
int | subfile_rows |
int | subfile_cols |
xy | geometry |
std::vector< xy > | positions |
RawFileConfig | cfg {0, 0} |
TimingMode | timing_mode |
bool | quad {false} |
RawFile class to read .raw and .json files.
aare::RawFile::RawFile | ( | const std::filesystem::path & | fname, |
const std::string & | mode = "r" , |
||
const FileConfig & | cfg = {} |
||
) |
RawFile constructor.
fname | path to the file |
mode | file mode (r, w) |
cfg | file configuration |
aare::RawFile::~RawFile | ( | ) |
destructor: will delete the subfiles
|
inlineoverridevirtual |
|
inlineoverridevirtual |
get the number of bytess per frame
Implements aare::FileInterface.
|
inlineoverridevirtual |
get the number of columns in the file
Implements aare::FileInterface.
|
inline |
get the data file name path for the RawFile with the given module id and file id
mod_id | module id |
file_id | file id |
|
private |
finds the geometry of the file
void aare::RawFile::find_number_of_subfiles | ( | ) |
get the number of subfiles for the RawFile
|
overridevirtual |
get the frame number at the given frame index
frame_index | index of the frame |
Implements aare::FileInterface.
|
private |
|
private |
read the frame at the given frame number into the image buffer
frame_number | frame number to read |
image_buf | buffer to store the frame |
|
inlineinherited |
read one frame from the file at the given frame number
frame_number | frame number to read |
|
inlineinherited |
read n_frames from the file starting at the given frame number
frame_number | frame number to start reading from |
n_frames | number of frames to read |
|
static |
check if the file is a master file
fpath | path to the file |
|
inline |
get the master file name path for the RawFile
|
private |
open the subfiles
|
private |
parse the file name to get the extension, base name and index
|
private |
parse the metadata of a .json file
|
private |
parse the metadata from the file
|
private |
parse the metadata of a .raw file
|
inlineoverridevirtual |
|
inlineoverridevirtual |
write a vector of frames to the file
frames | vector of frames to write |
read one frame from the file at the current position
Implements aare::FileInterface.
|
overridevirtual |
read n_frames from the file at the current position
n_frames | number of frames to read |
Implements aare::FileInterface.
|
private |
|
inlineoverridevirtual |
read one frame from the file at the current position and store it in the provided buffer
image_buf | buffer to store the frame |
Implements aare::FileInterface.
|
overridevirtual |
read n_frames from the file at the current position and store them in the provided buffer
image_buf | buffer to store the frames |
n_frames | number of frames to read |
Implements aare::FileInterface.
|
inlineoverridevirtual |
get the number of rows in the file
Implements aare::FileInterface.
|
inlineoverridevirtual |
seek to the given frame number
frame_number | frame number to seek to |
Implements aare::FileInterface.
|
inline |
set the module gap row and column
row | gap between rows |
col | gap between columns |
|
inlineoverridevirtual |
get the current position of the file pointer
Implements aare::FileInterface.
|
inlineoverridevirtual |
get the total number of frames in the file
Implements aare::FileInterface.
|
inlineoverridevirtual |
write function is not implemented for RawFile
frame | frame to write |
Implements aare::FileInterface.
|
private |
|
inherited |
|
private |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inherited |