mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-13 07:47:13 +02:00
merge with branch developer (commit: ea8efa)
This commit is contained in:
@ -13,7 +13,7 @@ template <DetectorType detector,typename DataType>
|
||||
JsonFileFactory<detector,DataType>::JsonFileFactory(std::filesystem::path fpath) {
|
||||
if (not is_master_file(fpath))
|
||||
throw std::runtime_error("Json file is not a master file");
|
||||
this->fpath = fpath;
|
||||
this->m_fpath = fpath;
|
||||
}
|
||||
|
||||
template <DetectorType detector,typename DataType>
|
||||
@ -63,7 +63,7 @@ void JsonFileFactory<detector,DataType>::open_subfiles(File<detector,DataType> *
|
||||
template <DetectorType detector,typename DataType>
|
||||
File<detector,DataType> *JsonFileFactory<detector,DataType>::load_file() {
|
||||
JsonFile<detector,DataType> *file = new JsonFile<detector,DataType>();
|
||||
file->fname = this->fpath;
|
||||
file->fname = this->m_fpath;
|
||||
this->parse_fname(file);
|
||||
this->parse_metadata(file);
|
||||
file->find_number_of_subfiles();
|
||||
@ -113,9 +113,9 @@ void JsonFileFactory<detector, DataType>::find_geometry(File<detector, DataType>
|
||||
template <DetectorType detector, typename DataType>
|
||||
void JsonFileFactory<detector, DataType>::parse_fname(File<detector, DataType> *file) {
|
||||
|
||||
file->base_path = this->fpath.parent_path();
|
||||
file->base_name = this->fpath.stem();
|
||||
file->ext = this->fpath.extension();
|
||||
file->base_path = this->m_fpath.parent_path();
|
||||
file->base_name = this->m_fpath.stem();
|
||||
file->ext = this->m_fpath.extension();
|
||||
|
||||
auto pos = file->base_name.rfind("_");
|
||||
file->findex = std::stoi(file->base_name.substr(pos + 1));
|
||||
|
@ -9,10 +9,10 @@
|
||||
*/
|
||||
|
||||
SubFile::SubFile(std::filesystem::path fname, DetectorType detector, ssize_t rows, ssize_t cols, uint16_t bitdepth) {
|
||||
this->rows = rows;
|
||||
this->cols = cols;
|
||||
this->fname = fname;
|
||||
this->bitdepth = bitdepth;
|
||||
this->m_rows = rows;
|
||||
this->m_cols = cols;
|
||||
this->m_fname = fname;
|
||||
this->m_bitdepth = bitdepth;
|
||||
fp = fopen(fname.c_str(), "rb");
|
||||
if (fp == nullptr) {
|
||||
throw std::runtime_error("Could not open file " + fname.string());
|
||||
@ -77,12 +77,12 @@ template <typename DataType> size_t SubFile::read_impl_flip(std::byte *buffer) {
|
||||
size_t rc = fread(reinterpret_cast<char *>(&tmp[0]), this->bytes_per_frame(), 1, this->fp);
|
||||
|
||||
// copy to place
|
||||
const size_t start = this->cols * (this->rows - 1) * sizeof(DataType);
|
||||
const size_t row_size = this->cols * sizeof(DataType);
|
||||
const size_t start = this->m_cols * (this->m_rows - 1) * sizeof(DataType);
|
||||
const size_t row_size = this->m_cols * sizeof(DataType);
|
||||
auto dst = buffer + start;
|
||||
auto src = &tmp[0];
|
||||
|
||||
for (int i = 0; i != this->rows; ++i) {
|
||||
for (int i = 0; i != this->m_rows; ++i) {
|
||||
memcpy(dst, src, row_size);
|
||||
dst -= row_size;
|
||||
src += row_size;
|
||||
|
Reference in New Issue
Block a user