mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-19 10:37:12 +02:00
starting work on ROI
This commit is contained in:
@ -29,9 +29,10 @@ struct ModuleConfig {
|
||||
* Consider using that unless you need raw file specific functionality.
|
||||
*/
|
||||
class RawFile : public FileInterface {
|
||||
size_t n_subfiles{};
|
||||
size_t n_subfile_parts{};
|
||||
std::vector<std::vector<SubFile *>> subfiles;
|
||||
size_t n_subfiles{}; //f0,f1...fn
|
||||
size_t n_subfile_parts{}; // d0,d1...dn
|
||||
//TODO! move to vector of SubFile instead of pointers
|
||||
std::vector<std::vector<SubFile *>> subfiles; //subfiles[f0,f1...fn][d0,d1...dn]
|
||||
std::vector<xy> positions;
|
||||
ModuleConfig cfg{0, 0};
|
||||
|
||||
@ -102,7 +103,7 @@ class RawFile : public FileInterface {
|
||||
static DetectorHeader read_header(const std::filesystem::path &fname);
|
||||
|
||||
|
||||
void find_number_of_subfiles();
|
||||
int find_number_of_subfiles();
|
||||
void open_subfiles();
|
||||
void find_geometry();
|
||||
};
|
||||
|
@ -58,6 +58,13 @@ class ScanParameters {
|
||||
bool enabled() const;
|
||||
};
|
||||
|
||||
struct ROI{
|
||||
size_t xmin{};
|
||||
size_t xmax{};
|
||||
size_t ymin{};
|
||||
size_t ymax{};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class for parsing a master file either in our .json format or the old
|
||||
* .raw format
|
||||
@ -95,6 +102,8 @@ class RawMasterFile {
|
||||
std::optional<size_t> m_number_of_rows;
|
||||
std::optional<uint8_t> m_quad;
|
||||
|
||||
std::optional<ROI> m_roi;
|
||||
|
||||
public:
|
||||
RawMasterFile(const std::filesystem::path &fpath);
|
||||
|
||||
@ -121,6 +130,8 @@ class RawMasterFile {
|
||||
std::optional<size_t> number_of_rows() const;
|
||||
std::optional<uint8_t> quad() const;
|
||||
|
||||
std::optional<ROI> roi() const;
|
||||
|
||||
ScanParameters scan_parameters() const;
|
||||
|
||||
private:
|
||||
|
@ -14,8 +14,20 @@ namespace aare {
|
||||
* @brief Class to read a subfile from a RawFile
|
||||
*/
|
||||
class SubFile {
|
||||
protected:
|
||||
FILE *fp = nullptr;
|
||||
size_t m_bitdepth;
|
||||
std::filesystem::path m_fname;
|
||||
size_t m_rows{};
|
||||
size_t m_cols{};
|
||||
std::string m_mode;
|
||||
size_t n_frames{};
|
||||
int m_sub_file_index_{};
|
||||
DetectorType m_detector_type;
|
||||
std::optional<NDArray<ssize_t, 2>> pixel_map;
|
||||
|
||||
|
||||
public:
|
||||
size_t write_part(std::byte *buffer, DetectorHeader header, size_t frame_index);
|
||||
/**
|
||||
* @brief SubFile constructor
|
||||
* @param fname path to the subfile
|
||||
@ -58,23 +70,13 @@ class SubFile {
|
||||
size_t get_part(std::byte *buffer, size_t frame_index);
|
||||
size_t frame_number(size_t frame_index);
|
||||
|
||||
// TODO: define the inlines as variables and assign them in constructor
|
||||
inline size_t bytes_per_part() const { return (m_bitdepth / 8) * m_rows * m_cols; }
|
||||
inline size_t pixels_per_part() const { return m_rows * m_cols; }
|
||||
|
||||
size_t bytes_per_part() const { return (m_bitdepth / 8) * m_rows * m_cols; }
|
||||
size_t pixels_per_part() const { return m_rows * m_cols; }
|
||||
|
||||
~SubFile();
|
||||
|
||||
protected:
|
||||
FILE *fp = nullptr;
|
||||
size_t m_bitdepth;
|
||||
std::filesystem::path m_fname;
|
||||
size_t m_rows{};
|
||||
size_t m_cols{};
|
||||
std::string m_mode;
|
||||
size_t n_frames{};
|
||||
int m_sub_file_index_{};
|
||||
DetectorType m_detector_type;
|
||||
std::optional<NDArray<ssize_t, 2>> pixel_map;
|
||||
|
||||
};
|
||||
|
||||
} // namespace aare
|
Reference in New Issue
Block a user