From 56fa6f6bfb0b76d6c84142624fe5e798e6b891be Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 10 Jun 2025 09:25:20 +0200 Subject: [PATCH] added counter mask, fixed adc mask data type, removed redundant scan parameter parsing --- include/aare/Hdf5MasterFile.hpp | 4 ++-- src/Hdf5MasterFile.cpp | 35 ++++++++++++++++----------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/include/aare/Hdf5MasterFile.hpp b/include/aare/Hdf5MasterFile.hpp index a1b3ca8..0702874 100644 --- a/include/aare/Hdf5MasterFile.hpp +++ b/include/aare/Hdf5MasterFile.hpp @@ -85,7 +85,7 @@ class Hdf5MasterFile { std::optional m_transceiver_samples; // g1 roi std::optional m_roi; - // counter mask + std::optional m_counter_mask; // exptimearray // gatedelay array // gates @@ -143,7 +143,7 @@ class Hdf5MasterFile { std::optional transceiver_samples() const; // g1 roi std::optional roi() const; - // counter mask + std::optional counter_mask() const; // exptimearray // gatedelay array // gates diff --git a/src/Hdf5MasterFile.cpp b/src/Hdf5MasterFile.cpp index f7b80a9..f40eedf 100644 --- a/src/Hdf5MasterFile.cpp +++ b/src/Hdf5MasterFile.cpp @@ -156,7 +156,7 @@ std::optional Hdf5MasterFile::transceiver_samples() const { } // g1 roi std::optional Hdf5MasterFile::roi() const { return m_roi; } -// counter mask +std::optional Hdf5MasterFile::counter_mask() const { return m_counter_mask; } // exptimearray // gatedelay array // gates @@ -254,7 +254,7 @@ void Hdf5MasterFile::parse_acquisition_metadata( std::string(metadata_group_name + "Number of pixels in x axis")); LOG(logDEBUG) << "Pixels in x: " << m_pixels_x; - // Image Size in Bytes + // Max Frames Per File m_max_frames_per_file = h5_get_scalar_dataset( file, std::string(metadata_group_name + "Maximum frames per file")); LOG(logDEBUG) << "Max frames per File: " << m_max_frames_per_file; @@ -411,10 +411,10 @@ void Hdf5MasterFile::parse_acquisition_metadata( // ADC Mask H5::Exception::dontPrint(); try { - m_adc_mask = h5_get_scalar_dataset( + m_adc_mask = h5_get_scalar_dataset( file, std::string(metadata_group_name + "ADC Mask")); } catch (H5::FileIException &e) { - m_adc_mask = 0; + // keep the optional empty } LOG(logDEBUG) << "ADC Mask: " << m_adc_mask; H5Eset_auto(H5E_DEFAULT, reinterpret_cast(H5Eprint2), @@ -514,19 +514,7 @@ void Hdf5MasterFile::parse_acquisition_metadata( H5Eset_auto(H5E_DEFAULT, reinterpret_cast(H5Eprint2), stderr); - // ROI - try { - std::string scan_parameters = h5_get_scalar_dataset( - file, std::string(metadata_group_name + "Scan Parameters")); - m_scan_parameters = ScanParameters(scan_parameters); - if (dVersion < 6.61){ - m_scan_parameters.increment_stop(); //adjust for endpoint being included - } - } catch (H5::FileIException &e) { - // keep the optional empty - } - LOG(logDEBUG) << "Scan Parameters: " << ToString(m_scan_parameters); - + // Rx ROI try{ ROI tmp_roi; tmp_roi.xmin = h5_get_scalar_dataset( @@ -574,7 +562,18 @@ void Hdf5MasterFile::parse_acquisition_metadata( m_type = DetectorType::Moench03_old; } - // counter mask + // Counter Mask + H5::Exception::dontPrint(); + try { + m_counter_mask = h5_get_scalar_dataset( + file, std::string(metadata_group_name + "Counter Mask")); + } catch (H5::FileIException &e) { + // keep the optional empty + } + LOG(logDEBUG) << "Counter Mask: " << m_counter_mask; + H5Eset_auto(H5E_DEFAULT, reinterpret_cast(H5Eprint2), + stderr); + // exptimearray // gatedelay array // gates