From 01e448f5c65e3988fbedabce89a16ca720733ac2 Mon Sep 17 00:00:00 2001 From: robbietuk Date: Tue, 10 Sep 2024 11:32:29 -0700 Subject: [PATCH 1/3] ProjDataInMemory::read_from_file to return a ProjDataInMemory object --- src/buildblock/ProjDataInMemory.cxx | 12 ++++++++++++ src/include/stir/ProjDataInMemory.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/buildblock/ProjDataInMemory.cxx b/src/buildblock/ProjDataInMemory.cxx index 8ec0cfa3c..0194e3c6f 100644 --- a/src/buildblock/ProjDataInMemory.cxx +++ b/src/buildblock/ProjDataInMemory.cxx @@ -350,6 +350,18 @@ ProjDataInMemory::ProjDataInMemory(const ProjDataInMemory& proj_data) std::copy(proj_data.begin_all(), proj_data.end_all(), this->begin_all()); } +shared_ptr +ProjDataInMemory::read_from_file(const std::string& filename, const std::ios::openmode openmode) +{ +#if 1 + const auto proj_data = ProjData::read_from_file(filename, openmode); + return std::make_shared(*proj_data); +#else + // Alternative implementation + return std::make_shared(*ProjData::read_from_file(filename, openmode)); +#endif +} + float ProjDataInMemory::get_bin_value(Bin& bin) { diff --git a/src/include/stir/ProjDataInMemory.h b/src/include/stir/ProjDataInMemory.h index 0ded4e017..c63a58620 100644 --- a/src/include/stir/ProjDataInMemory.h +++ b/src/include/stir/ProjDataInMemory.h @@ -62,6 +62,9 @@ class ProjDataInMemory : public ProjData //! Copy constructor ProjDataInMemory(const ProjDataInMemory& proj_data); + //! A static member to get the projection data in memory from a file + static shared_ptr read_from_file(const std::string& filename, std::ios::openmode open_mode = std::ios::in); + Viewgram get_viewgram(const int view_num, const int segment_num, const bool make_num_tangential_poss_odd = false, From 46ae070d1155577b08cea276130a6b8db7967eea Mon Sep 17 00:00:00 2001 From: robbietuk Date: Thu, 12 Sep 2024 10:41:41 -0700 Subject: [PATCH 2/3] Remove alternative methodology. --- src/buildblock/ProjDataInMemory.cxx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/buildblock/ProjDataInMemory.cxx b/src/buildblock/ProjDataInMemory.cxx index 0194e3c6f..5c8c50203 100644 --- a/src/buildblock/ProjDataInMemory.cxx +++ b/src/buildblock/ProjDataInMemory.cxx @@ -353,13 +353,7 @@ ProjDataInMemory::ProjDataInMemory(const ProjDataInMemory& proj_data) shared_ptr ProjDataInMemory::read_from_file(const std::string& filename, const std::ios::openmode openmode) { -#if 1 - const auto proj_data = ProjData::read_from_file(filename, openmode); - return std::make_shared(*proj_data); -#else - // Alternative implementation return std::make_shared(*ProjData::read_from_file(filename, openmode)); -#endif } float From 4399724858fcc8576384bcc21253af1e8b66a701 Mon Sep 17 00:00:00 2001 From: robbietuk Date: Thu, 12 Sep 2024 12:43:28 -0700 Subject: [PATCH 3/3] Remove openmode and add release notes. --- documentation/release_6.3.htm | 5 +++++ src/buildblock/ProjDataInMemory.cxx | 4 ++-- src/include/stir/ProjDataInMemory.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/documentation/release_6.3.htm b/documentation/release_6.3.htm index 43342331f..54a9c63bc 100644 --- a/documentation/release_6.3.htm +++ b/documentation/release_6.3.htm @@ -48,6 +48,11 @@

Known problems

What is new for developers (aside from what should be obvious from the above):

+

New functionality

+ +
  • + ProjDataInMemory read_from_file method now returns a ProjDataInMemory object. +
  • Changed functionality

    diff --git a/src/buildblock/ProjDataInMemory.cxx b/src/buildblock/ProjDataInMemory.cxx index 5c8c50203..420c801df 100644 --- a/src/buildblock/ProjDataInMemory.cxx +++ b/src/buildblock/ProjDataInMemory.cxx @@ -351,9 +351,9 @@ ProjDataInMemory::ProjDataInMemory(const ProjDataInMemory& proj_data) } shared_ptr -ProjDataInMemory::read_from_file(const std::string& filename, const std::ios::openmode openmode) +ProjDataInMemory::read_from_file(const std::string& filename) { - return std::make_shared(*ProjData::read_from_file(filename, openmode)); + return std::make_shared(*ProjData::read_from_file(filename)); } float diff --git a/src/include/stir/ProjDataInMemory.h b/src/include/stir/ProjDataInMemory.h index c63a58620..b101819b2 100644 --- a/src/include/stir/ProjDataInMemory.h +++ b/src/include/stir/ProjDataInMemory.h @@ -63,7 +63,7 @@ class ProjDataInMemory : public ProjData ProjDataInMemory(const ProjDataInMemory& proj_data); //! A static member to get the projection data in memory from a file - static shared_ptr read_from_file(const std::string& filename, std::ios::openmode open_mode = std::ios::in); + static shared_ptr read_from_file(const std::string& filename); Viewgram get_viewgram(const int view_num, const int segment_num,