Skip to content

Commit

Permalink
ProjDataInMemory::read_from_file to return a ProjDataInMemory object
Browse files Browse the repository at this point in the history
  • Loading branch information
robbietuk committed Sep 10, 2024
1 parent e168b07 commit 01e448f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/buildblock/ProjDataInMemory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
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<ProjDataInMemory>(*proj_data);
#else
// Alternative implementation
return std::make_shared<ProjDataInMemory>(*ProjData::read_from_file(filename, openmode));
#endif
}

float
ProjDataInMemory::get_bin_value(Bin& bin)
{
Expand Down
3 changes: 3 additions & 0 deletions src/include/stir/ProjDataInMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProjDataInMemory> read_from_file(const std::string& filename, std::ios::openmode open_mode = std::ios::in);

Viewgram<float> get_viewgram(const int view_num,
const int segment_num,
const bool make_num_tangential_poss_odd = false,
Expand Down

0 comments on commit 01e448f

Please sign in to comment.