From 59ad27a1b2d4acbe2c99b8fe70d31252a62981d2 Mon Sep 17 00:00:00 2001 From: Evgueni Ovtchinnikov Date: Wed, 22 Nov 2023 14:39:29 +0000 Subject: [PATCH] attended to the reviewer comments and suggestions --- examples/Python/MR/noncartesian_cg_sense.py | 2 +- examples/Python/MR/noncartesian_recon.py | 2 +- src/xGadgetron/cGadgetron/cgadgetron.cpp | 2 +- .../Gadgetron/gadgetron_data_containers.h | 32 +++++++++++++------ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/examples/Python/MR/noncartesian_cg_sense.py b/examples/Python/MR/noncartesian_cg_sense.py index 51d0e4347..e4b5e86e9 100644 --- a/examples/Python/MR/noncartesian_cg_sense.py +++ b/examples/Python/MR/noncartesian_cg_sense.py @@ -137,7 +137,7 @@ def main(): # acquisition data will be read from an HDF file input_file # AcquisitionData.set_storage_scheme('memory') - acq_data = mr.AcquisitionData(input_file, False) + acq_data = mr.AcquisitionData(input_file) print('---\n acquisition data norm: %e' % acq_data.norm()) diff --git a/examples/Python/MR/noncartesian_recon.py b/examples/Python/MR/noncartesian_recon.py index 3371ff6a7..2d18031c3 100644 --- a/examples/Python/MR/noncartesian_recon.py +++ b/examples/Python/MR/noncartesian_recon.py @@ -71,7 +71,7 @@ def main(): # locate the k-space raw data file adn read input_file = existing_filepath(data_path, data_file) - acq_data = mr.AcquisitionData(input_file, False) + acq_data = mr.AcquisitionData(input_file) # pre-process acquisition data if trajtype != 'radial' and trajtype != 'goldenangle': diff --git a/src/xGadgetron/cGadgetron/cgadgetron.cpp b/src/xGadgetron/cGadgetron/cgadgetron.cpp index 788f5fef7..ce0dd2008 100644 --- a/src/xGadgetron/cGadgetron/cgadgetron.cpp +++ b/src/xGadgetron/cGadgetron/cgadgetron.cpp @@ -574,7 +574,7 @@ cGT_ISMRMRDAcquisitionsFromFile(const char* file, int all, size_t ptr) mask.set(0); else mask.set(ignored); - mask.show_bits(); + std::cout << mask.bits_string() << '\n'; shared_ptr acquisitions(new AcquisitionsVector); IgnoreMask copy = acquisitions->ignore_mask(); diff --git a/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_data_containers.h b/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_data_containers.h index 57d17c721..c0a82280d 100644 --- a/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_data_containers.h +++ b/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_data_containers.h @@ -117,7 +117,17 @@ namespace sirf { /*! \ingroup Gadgetron Data Containers - \brief Class enabling ignoring certain 'irregular' acquisitions. + \brief Class enabling ignoring acquisitions with certain ISMRMRD acquisition flags. + + Most of the acquisitiondata can be represented by a multidimensional array. + However, the input raw data may also contain acquisitions serving some special + purposes different from the rest, e.g. acquisitions with noise calibration data + (ISMRMRD flag 19). These may have incompatible shape, and must be ignored e.g. + when calculating multidimensional data dimensions or performing algebraic operations + on acquisition data by some reconstruction algorithms. Class IgnoreMask encapsulates + a 64-bit integer with non-zero bits representing 'forbidden' ISMRMRD flags, i.e. any + acquisition acq that has at least one of these flags in its bit field returned by + its acq.flags() method will be ignored. */ class IgnoreMask { public: @@ -156,20 +166,22 @@ namespace sirf { { return bits & ignore_; } - void show_bits() const + std::string bits_string() const { unsigned int size = max_; unsigned long int one = 1; unsigned long int bitmask = (one << (size - 1)); + std::stringstream str; for (unsigned int i = 0; i < size; i++) { if (ignore_ & (bitmask >> i)) - std::cout << '1'; + str << '1'; else - std::cout << '0'; + str << '0'; if ((i + 1) % 4 == 0) - std::cout << ' '; + str << ' '; } - std::cout << '\n'; + str << '\n'; + return str.str(); } private: unsigned long int ignore_; @@ -722,11 +734,13 @@ namespace sirf { /*! \brief Reader for ISMRMRD::Acquisition from ISMRMRD file. - * filename_ismrmrd_with_ext: filename of ISMRMRD rawdata file with .h5 extension. * In case the ISMRMRD::Dataset constructor throws an std::runtime_error the reader catches it, * displays the message and throws it again. - * To avoid reading noise samples and other calibration data, IgnoreMask may be employed - * to exclude potentially incompatible input. + * To avoid reading noise samples and other calibration data, IgnoreMask may be set + * (see method set_ignore_mask) to exclude potentially incompatible input. + + * filename_ismrmrd_with_ext: filename of ISMRMRD rawdata file with .h5 extension. + * all: overrider of the ignore mask - non-zero value forces reading all acquisitions. */ void read(const std::string& filename_ismrmrd_with_ext, int all = 0);