mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-09-03 16:50:43 +02:00
Collection of small improvements in usability: - NDView works for large arrays - Direct subtraction of Pedestal from np.array - len() support for python bindings of files
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
// SPDX-License-Identifier: MPL-2.0
|
|
#pragma once
|
|
|
|
#include "aare/FileInterface.hpp"
|
|
#include "aare/Frame.hpp"
|
|
#include "aare/RawMasterFile.hpp"
|
|
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
|
|
namespace aare {
|
|
|
|
class CtbRawFile {
|
|
RawMasterFile m_master;
|
|
std::ifstream m_file;
|
|
size_t m_current_frame{0};
|
|
size_t m_current_subfile{0};
|
|
size_t m_num_subfiles{0};
|
|
|
|
public:
|
|
CtbRawFile(const std::filesystem::path &fname);
|
|
|
|
void read_into(std::byte *image_buf, DetectorHeader *header = nullptr);
|
|
void seek(size_t frame_index); //!< seek to the given frame index
|
|
size_t tell() const; //!< get the frame index of the file pointer
|
|
|
|
// in the specific class we can expose more functionality
|
|
|
|
size_t image_size_in_bytes() const;
|
|
size_t frames_in_file() const;
|
|
size_t total_frames() const;
|
|
|
|
RawMasterFile master() const;
|
|
|
|
private:
|
|
void find_subfiles();
|
|
size_t sub_file_index(size_t frame_index) const {
|
|
return frame_index / m_master.max_frames_per_file();
|
|
}
|
|
void open_data_file(size_t subfile_index);
|
|
};
|
|
|
|
} // namespace aare
|