Skip to content

Commit

Permalink
added ProjData::get_num_non_tof_sinograms and fixed SWIG for tof
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisThielemans committed Feb 4, 2020
1 parent 31dea95 commit 3f4c94d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/include/stir/ProjData.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,15 @@ class ProjData : public ExamData
//! Get maximum tangential position number
inline int get_max_tangential_pos_num() const;
//! Get the number of sinograms
/*! Note that this will count TOF sinograms as well.
\see get_num_non_tof_sinograms()
*/
inline int get_num_sinograms() const;
//! Get the number of sinograms
/*! Note that this is the sum of the number of axial poss over all segments.
\see get_num_sinograms()
*/
inline int get_num_non_tof_sinograms() const;
//! Get the total size of the data
inline std::size_t size_all() const;
//! writes data to a file in Interfile format
Expand Down
9 changes: 7 additions & 2 deletions src/include/stir/ProjData.inl
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,18 @@ int ProjData::get_min_tof_pos_num() const
int ProjData::get_max_tof_pos_num() const
{ return proj_data_info_ptr->get_max_tof_pos_num(); }

int ProjData::get_num_sinograms() const
int ProjData::get_num_non_tof_sinograms() const
{
int num_sinos = proj_data_info_ptr->get_num_axial_poss(0);
for (int s=1; s<= this->get_max_segment_num(); ++s)
num_sinos += 2* this->get_num_axial_poss(s);

return num_sinos*this->get_num_tof_poss();
return num_sinos;
}

int ProjData::get_num_sinograms() const
{
return this->get_num_non_tof_sinograms()*this->get_num_tof_poss();
}

std::size_t ProjData::size_all() const
Expand Down
8 changes: 2 additions & 6 deletions src/swig/stir.i
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,8 @@ namespace std {
#endif
static Array<4,float> create_array_for_proj_data(const ProjData& proj_data)
{
// int num_sinos=proj_data.get_num_axial_poss(0);
// for (int s=1; s<= proj_data.get_max_segment_num(); ++s)
// {
// num_sinos += 2*proj_data.get_num_axial_poss(s);
// }
Array<4,float> array(IndexRange4D(proj_data.get_num_tof_poss(),proj_data.get_num_segments(), proj_data.get_num_views(), proj_data.get_num_tangential_poss()));
const int num_non_tof_sinos = proj_data.get_num_non_tof_sinograms();
Array<4,float> array(IndexRange4D(proj_data.get_num_tof_poss(),num_non_tof_sinos, proj_data.get_num_views(), proj_data.get_num_tangential_poss()));
return array;
}

Expand Down

0 comments on commit 3f4c94d

Please sign in to comment.