mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-18 18:27:13 +02:00
WIP
This commit is contained in:
@ -49,10 +49,20 @@ void RawFile::read_into(std::byte *image_buf) {
|
||||
|
||||
|
||||
void RawFile::read_into(std::byte *image_buf, DetectorHeader *header) {
|
||||
|
||||
return get_frame_into(m_current_frame++, image_buf, header);
|
||||
};
|
||||
|
||||
void RawFile::read_into(std::byte *image_buf, size_t n_frames, DetectorHeader *header) {
|
||||
// return get_frame_into(m_current_frame++, image_buf, header);
|
||||
|
||||
for (size_t i = 0; i < n_frames; i++) {
|
||||
this->get_frame_into(m_current_frame++, image_buf, header);
|
||||
image_buf += bytes_per_frame();
|
||||
if(header)
|
||||
header+=n_mod();
|
||||
}
|
||||
};
|
||||
|
||||
size_t RawFile::n_mod() const { return n_subfile_parts; }
|
||||
|
||||
|
||||
@ -117,10 +127,7 @@ DetectorHeader RawFile::read_header(const std::filesystem::path &fname) {
|
||||
|
||||
return h;
|
||||
}
|
||||
bool RawFile::is_master_file(const std::filesystem::path &fpath) {
|
||||
std::string const stem = fpath.stem().string();
|
||||
return stem.find("_master_") != std::string::npos;
|
||||
}
|
||||
|
||||
|
||||
int RawFile::find_number_of_subfiles() {
|
||||
int n_files = 0;
|
||||
@ -135,6 +142,8 @@ int RawFile::find_number_of_subfiles() {
|
||||
|
||||
}
|
||||
|
||||
RawMasterFile RawFile::master() const { return m_master; }
|
||||
|
||||
void RawFile::find_geometry() {
|
||||
uint16_t r{};
|
||||
uint16_t c{};
|
||||
@ -208,8 +217,8 @@ void RawFile::update_geometry_with_roi() {
|
||||
if (m.y + m.height < roi.ymin) {
|
||||
m.height = 0;
|
||||
} else {
|
||||
if (roi.ymin < m.y + m.height) {
|
||||
m.height -= roi.ymin;
|
||||
if ((roi.ymin > m.y) && (roi.ymin < m.y + m.height)) {
|
||||
m.height -= roi.ymin - m.y;
|
||||
}
|
||||
if (roi.ymax < m.y + m.height) {
|
||||
m.height -= m.y + original_height - roi.ymax;
|
||||
|
@ -72,6 +72,9 @@ ScanParameters::ScanParameters(const std::string& par){
|
||||
|
||||
int ScanParameters::start() const { return m_start; }
|
||||
int ScanParameters::stop() const { return m_stop; }
|
||||
void ScanParameters::increment_stop(){
|
||||
m_stop += 1;
|
||||
};
|
||||
int ScanParameters::step() const { return m_step; }
|
||||
const std::string &ScanParameters::dac() const { return m_dac; }
|
||||
bool ScanParameters::enabled() const { return m_enabled; }
|
||||
@ -240,6 +243,9 @@ void RawMasterFile::parse_json(const std::filesystem::path &fpath) {
|
||||
try{
|
||||
std::string scan_parameters = j.at("Scan Parameters");
|
||||
m_scan_parameters = ScanParameters(scan_parameters);
|
||||
if(v<7.21){
|
||||
m_scan_parameters.increment_stop(); //adjust for endpoint being included
|
||||
}
|
||||
}catch (const json::out_of_range &e) {
|
||||
// not a scan
|
||||
}
|
||||
|
Reference in New Issue
Block a user