From bcf77b3e373a52626c7a8293e64115ee258925b9 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 14 Oct 2023 16:31:01 +0100 Subject: [PATCH 1/6] implemented *Indices classes for projdata indexing --- src/include/stir/Bin.h | 16 ++---- src/include/stir/Bin.inl | 26 ++------- src/include/stir/ProjData.h | 17 +++++- src/include/stir/ProjData.inl | 26 ++++++++- src/include/stir/SegmentIndices.h | 63 +++++++++++++++++++++ src/include/stir/SegmentIndices.inl | 58 ++++++++++++++++++++ src/include/stir/SinogramIndices.h | 68 +++++++++++++++++++++++ src/include/stir/SinogramIndices.inl | 65 ++++++++++++++++++++++ src/include/stir/ViewSegmentNumbers.h | 58 ++++---------------- src/include/stir/ViewSegmentNumbers.inl | 73 ------------------------- src/include/stir/ViewgramIndices.h | 64 ++++++++++++++++++++++ src/include/stir/ViewgramIndices.inl | 64 ++++++++++++++++++++++ 12 files changed, 446 insertions(+), 152 deletions(-) create mode 100644 src/include/stir/SegmentIndices.h create mode 100644 src/include/stir/SegmentIndices.inl create mode 100644 src/include/stir/SinogramIndices.h create mode 100644 src/include/stir/SinogramIndices.inl delete mode 100644 src/include/stir/ViewSegmentNumbers.inl create mode 100644 src/include/stir/ViewgramIndices.h create mode 100644 src/include/stir/ViewgramIndices.inl diff --git a/src/include/stir/Bin.h b/src/include/stir/Bin.h index 32deba80e1..9a087c5546 100644 --- a/src/include/stir/Bin.h +++ b/src/include/stir/Bin.h @@ -17,6 +17,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2009, Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -27,7 +28,7 @@ #define __stir_Bin_H__ -#include "stir/common.h" +#include "stir/ViewgramIndices.h" START_NAMESPACE_STIR @@ -39,10 +40,11 @@ START_NAMESPACE_STIR handling list mode data. */ -class Bin +class Bin : public ViewgramIndices { + typedef ViewgramIndices base_type; public: - //! default constructor + //! default constructor (leaves most members uninitialised) inline Bin(); //! A constructor : constructs a bin with value (defaulting to 0) @@ -51,19 +53,13 @@ class Bin //!get axial position number inline int axial_pos_num()const; - //! get segmnet number - inline int segment_num()const; //! get tangential position number inline int tangential_pos_num() const; - //! get view number - inline int view_num() const; //! get time-frame number (1-based) inline int time_frame_num() const; inline int& axial_pos_num(); - inline int& segment_num(); inline int& tangential_pos_num(); - inline int& view_num(); inline int& time_frame_num(); @@ -91,8 +87,6 @@ class Bin private : // shared_ptr proj_data_info_ptr; - int segment; - int view; int axial_pos; int tangential_pos; float bin_value; diff --git a/src/include/stir/Bin.inl b/src/include/stir/Bin.inl index 663f9853f6..7b50302041 100644 --- a/src/include/stir/Bin.inl +++ b/src/include/stir/Bin.inl @@ -15,6 +15,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2009, Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -25,31 +26,24 @@ START_NAMESPACE_STIR Bin::Bin() + : time_frame(1) {} Bin::Bin(int segment_num,int view_num, int axial_pos_num,int tangential_pos_num,float bin_value) - :segment(segment_num),view(view_num), - axial_pos(axial_pos_num),tangential_pos(tangential_pos_num),bin_value(bin_value),time_frame(1) - {} + : ViewgramIndices(view_num, segment_num), + axial_pos(axial_pos_num),tangential_pos(tangential_pos_num),bin_value(bin_value),time_frame(1) +{} int Bin:: axial_pos_num()const { return axial_pos;} -int - Bin::segment_num()const -{return segment;} - int Bin::tangential_pos_num() const { return tangential_pos;} -int - Bin::view_num() const -{ return view;} - int Bin:: time_frame_num() const {return time_frame;} @@ -58,18 +52,10 @@ int& Bin::axial_pos_num() { return axial_pos;} -int& - Bin:: segment_num() -{return segment;} - int& Bin::tangential_pos_num() { return tangential_pos;} -int& - Bin:: view_num() -{ return view;} - int& Bin:: time_frame_num() {return time_frame;} @@ -109,7 +95,7 @@ bool Bin::operator==(const Bin& bin2) const { return - segment == bin2.segment && view == bin2.view && + base_type::operator==(bin2) && axial_pos == bin2.axial_pos && tangential_pos == bin2.tangential_pos && bin_value == bin2.bin_value; } diff --git a/src/include/stir/ProjData.h b/src/include/stir/ProjData.h index c7a9bcee9e..722c045acd 100644 --- a/src/include/stir/ProjData.h +++ b/src/include/stir/ProjData.h @@ -1,7 +1,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2012, Hammersmith Imanet Ltd - Copyright (C) 2013, 2015-2017, 2020, University College London + Copyright (C) 2013, 2015-2017, 2020, 2023 University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -28,6 +28,9 @@ #include "stir/Succeeded.h" #include "stir/SegmentBySinogram.h" #include "stir/SegmentByView.h" +#include "stir/SegmentIndices.h" +#include "stir/ViewgramIndices.h" +#include "stir/SinogramIndices.h" //#include #include "stir/ExamData.h" @@ -118,12 +121,17 @@ class ProjData : public ExamData //! Get viewgram virtual Viewgram get_viewgram(const int view, const int segment_num,const bool make_num_tangential_poss_odd = false) const=0; + inline Viewgram + get_viewgram(const ViewgramIndices&); //! Set viewgram virtual Succeeded set_viewgram(const Viewgram&) = 0; //! Get sinogram virtual Sinogram get_sinogram(const int ax_pos_num, const int segment_num,const bool make_num_tangential_poss_odd = false) const=0; + //! Get sinogram + inline Sinogram + get_sinogram(const SinogramIndices&); //! Set sinogram virtual Succeeded set_sinogram(const Sinogram&) = 0; @@ -154,9 +162,16 @@ class ProjData : public ExamData //! Get segment by sinogram virtual SegmentBySinogram get_segment_by_sinogram(const int segment_num) const; + + inline SegmentBySinogram + get_segment_by_sinogram(const SegmentIndices&) const; + //! Get segment by view virtual SegmentByView get_segment_by_view(const int segment_num) const; + inline SegmentByView + get_segment_by_view(const SegmentIndices&) const; + //! Set segment by sinogram virtual Succeeded set_segment(const SegmentBySinogram&); diff --git a/src/include/stir/ProjData.inl b/src/include/stir/ProjData.inl index 7c13787049..168ede9085 100644 --- a/src/include/stir/ProjData.inl +++ b/src/include/stir/ProjData.inl @@ -11,7 +11,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000-2009, Hammersmith Imanet Ltd - Copyright (C) 2013, 2015 University College London + Copyright (C) 2013, 2015, 2023 University College London Copyright (C) 2016, University of Hull This file is part of STIR. @@ -24,6 +24,30 @@ START_NAMESPACE_STIR +SegmentBySinogram +ProjData::get_segment_by_sinogram(const SegmentIndices& si) const +{ + return this->get_segment_by_sinogram(si.segment_num()); +} + +SegmentByView +ProjData::get_segment_by_view(const SegmentIndices& si) const +{ + return this->get_segment_by_view(si.segment_num()); +} + +Viewgram +ProjData::get_viewgram(const ViewgramIndices& vi) +{ + return this->get_viewgram(vi.view_num(), vi.segment_num()); +} + +Sinogram +ProjData::get_sinogram(const SinogramIndices& vi) +{ + return this->get_sinogram(vi.axial_pos_num(), vi.segment_num()); +} + shared_ptr ProjData::get_proj_data_info_sptr() const { diff --git a/src/include/stir/SegmentIndices.h b/src/include/stir/SegmentIndices.h new file mode 100644 index 0000000000..20beec19fd --- /dev/null +++ b/src/include/stir/SegmentIndices.h @@ -0,0 +1,63 @@ +// +// +/*! + \file + \ingroup projdata + + \brief Definition of class stir::SegmentIndices + + \author Kris Thielemans + +*/ +/* + Copyright (C) 2023, University College London + This file is part of STIR. + + SPDX-License-Identifier: Apache-2.0 + + See STIR/LICENSE.txt for details +*/ + +#ifndef __stir_SegmentIndices_h__ +#define __stir_SegmentIndices_h__ + +#include "stir/common.h" + +START_NAMESPACE_STIR + +/*! + \brief A very simple class to store segment numbers and any other + indices that define a segment + \ingroup projdata +*/ +class SegmentIndices +{ +public: + //! constructor segment number as arguments + explicit inline SegmentIndices(const int segment_num = 0); + + //! get segment number for const objects + inline int segment_num() const; + + //! get reference to segment number + inline int& segment_num(); + + //! comparison operator, only useful for sorting + /*! In future, there will be multiple indices, and order will then be based as in + (0,1) < (0,-1) < (1,1) ... + */ + inline bool operator<(const SegmentIndices& other) const; + + //! test for equality + inline bool operator==(const SegmentIndices& other) const; + inline bool operator!=(const SegmentIndices& other) const; + +private: + int _segment; +}; + +END_NAMESPACE_STIR + +#include "stir/SegmentIndices.inl" + +#endif diff --git a/src/include/stir/SegmentIndices.inl b/src/include/stir/SegmentIndices.inl new file mode 100644 index 0000000000..4e9989464c --- /dev/null +++ b/src/include/stir/SegmentIndices.inl @@ -0,0 +1,58 @@ +/*! + \file + \ingroup projdata + + \brief inline implementations for class stir::SegmentIndices + + \author Kris Thielemans + \author Sanida Mustafovic + \author PARAPET project + + +*/ +/* + Copyright (C) 2000 PARAPET partners + Copyright (C) 2000- 2009, Hammersmith Imanet Ltd + This file is part of STIR. + + SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license + + See STIR/LICENSE.txt for details +*/ + +START_NAMESPACE_STIR + +SegmentIndices::SegmentIndices(const int segment_num) + : _segment(segment_num) +{} + +int +SegmentIndices::segment_num() const +{ + return _segment; +} + +int& +SegmentIndices::segment_num() +{ + return _segment; +} + +bool +SegmentIndices::operator<(const SegmentIndices& other) const +{ + return (_segment < other._segment); +} + +bool +SegmentIndices::operator==(const SegmentIndices& other) const +{ + return (_segment == other._segment); +} + +bool +SegmentIndices::operator!=(const SegmentIndices& other) const +{ + return !(*this == other); +} +END_NAMESPACE_STIR diff --git a/src/include/stir/SinogramIndices.h b/src/include/stir/SinogramIndices.h new file mode 100644 index 0000000000..62c84043bd --- /dev/null +++ b/src/include/stir/SinogramIndices.h @@ -0,0 +1,68 @@ +// +// +/*! + \file + \ingroup projdata + + \brief Definition of class stir::SinogramIndices + + \author Kris Thielemans + +*/ +/* + Copyright (C) 2023, University College London + This file is part of STIR. + + SPDX-License-Identifier: Apache-2.0 + + See STIR/LICENSE.txt for details +*/ + + + +#ifndef __stir_SinogramIndices_h__ +#define __stir_SinogramIndices_h__ + +#include "stir/SegmentIndices.h" + +START_NAMESPACE_STIR + +/*! + \brief A very simple class to store all dincies to get a (2D) Sinogram + \ingroup projdata +*/ +class SinogramIndices : public SegmentIndices +{ + typedef SegmentIndices base_type; +public: + + //! an empty constructor (sets everything to 0) + inline SinogramIndices(); + //! constructor taking view and segment number as arguments + inline SinogramIndices( const int axial_pos_num,const int segment_num); + + //! get view number for const objects + inline int axial_pos_num() const; + + //! get reference to view number + inline int& axial_pos_num(); + + + //! comparison operator, only useful for sorting + /*! order : (0,1) < (0,-1) < (1,1) ...*/ + inline bool operator<(const SinogramIndices& other) const; + + //! test for equality + inline bool operator==(const SinogramIndices& other) const; + inline bool operator!=(const SinogramIndices& other) const; + +private: + int _axial_pos; + +}; + +END_NAMESPACE_STIR + +#include "stir/SinogramIndices.inl" + +#endif diff --git a/src/include/stir/SinogramIndices.inl b/src/include/stir/SinogramIndices.inl new file mode 100644 index 0000000000..df98ca0d62 --- /dev/null +++ b/src/include/stir/SinogramIndices.inl @@ -0,0 +1,65 @@ +/*! + \file + \ingroup projdata + + \brief inline implementations for class stir::SinogramIndices + + \author Kris Thielemans + \author Sanida Mustafovic + \author PARAPET project + + +*/ +/* + Copyright (C) 2000 PARAPET partners + Copyright (C) 2000- 2009, Hammersmith Imanet Ltd + This file is part of STIR. + + SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license + + See STIR/LICENSE.txt for details +*/ + + +START_NAMESPACE_STIR + +SinogramIndices::SinogramIndices() +:SegmentIndices(),_axial_pos(0) + {} + +SinogramIndices::SinogramIndices( const int axial_pos_num,const int segment_num) + : SegmentIndices(segment_num),_axial_pos(axial_pos_num) + {} + +int +SinogramIndices::axial_pos_num() const +{ + return _axial_pos;} + + +int& +SinogramIndices::axial_pos_num() +{ return _axial_pos;} + +bool +SinogramIndices:: +operator<(const SinogramIndices& other) const +{ + return (_axial_pos< other._axial_pos) || + ((_axial_pos == other._axial_pos) && base_type::operator<(other)); +} + +bool +SinogramIndices:: +operator==(const SinogramIndices& other) const +{ + return (_axial_pos == other._axial_pos) && base_type::operator==(other); +} + +bool +SinogramIndices:: +operator!=(const SinogramIndices& other) const +{ + return !(*this == other); +} +END_NAMESPACE_STIR diff --git a/src/include/stir/ViewSegmentNumbers.h b/src/include/stir/ViewSegmentNumbers.h index 3f4b38fa5f..40bdb6c8c6 100644 --- a/src/include/stir/ViewSegmentNumbers.h +++ b/src/include/stir/ViewSegmentNumbers.h @@ -4,72 +4,38 @@ \file \ingroup projdata - \brief Definition of class stir::ViewSegmentNumbers + \brief Definition of class stir::ViewSegmentNumbers, alias to stir::ViewgramIndices \author Kris Thielemans - \author Sanida Mustafovic - \author PARAPET project - + */ /* - Copyright (C) 2000 PARAPET partners - Copyright (C) 2000- 2009, Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. - SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license + SPDX-License-Identifier: Apache-2.0 See STIR/LICENSE.txt for details */ - - #ifndef __stir_ViewSegmentNumbers_h__ #define __stir_ViewSegmentNumbers_h__ -#include "stir/common.h" +#include "stir/ViewgramIndices.h" START_NAMESPACE_STIR - +//! alias for ViewgramIndices /*! - \brief A very simple class to store view and segment numbers - \ingroup projdata + For backwards compatibility only. + + \deprecated */ -class ViewSegmentNumbers +// Note: needs to be a class due to forward declarations +class ViewSegmentNumbers : public ViewgramIndices { -public: - - //! an empty constructor (sets everything to 0) - inline ViewSegmentNumbers(); - //! constructor taking view and segment number as arguments - inline ViewSegmentNumbers( const int view_num,const int segment_num); - - //! get segment number for const objects - inline int segment_num() const; - //! get view number for const objects - inline int view_num() const; - - //! get reference to segment number - inline int& segment_num(); - //! get reference to view number - inline int& view_num(); - - - //! comparison operator, only useful for sorting - /*! order : (0,1) < (0,-1) < (1,1) ...*/ - inline bool operator<(const ViewSegmentNumbers& other) const; - - //! test for equality - inline bool operator==(const ViewSegmentNumbers& other) const; - inline bool operator!=(const ViewSegmentNumbers& other) const; - -private: - int segment; - int view; - + using ViewgramIndices::ViewgramIndices; }; END_NAMESPACE_STIR -#include "stir/ViewSegmentNumbers.inl" - #endif diff --git a/src/include/stir/ViewSegmentNumbers.inl b/src/include/stir/ViewSegmentNumbers.inl deleted file mode 100644 index c19c0ee63c..0000000000 --- a/src/include/stir/ViewSegmentNumbers.inl +++ /dev/null @@ -1,73 +0,0 @@ -/*! - \file - \ingroup projdata - - \brief inline implementations for class stir::ViewSegmentNumbers - - \author Kris Thielemans - \author Sanida Mustafovic - \author PARAPET project - - -*/ -/* - Copyright (C) 2000 PARAPET partners - Copyright (C) 2000- 2009, Hammersmith Imanet Ltd - This file is part of STIR. - - SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license - - See STIR/LICENSE.txt for details -*/ - - -START_NAMESPACE_STIR - -ViewSegmentNumbers::ViewSegmentNumbers() -:segment(0),view(0) - {} - -ViewSegmentNumbers::ViewSegmentNumbers( const int view_num,const int segment_num) - : segment(segment_num),view(view_num) - {} - -int -ViewSegmentNumbers::segment_num() const -{ - return segment;} -int -ViewSegmentNumbers::view_num() const -{ - return view;} - - -int& -ViewSegmentNumbers::segment_num() -{ return segment;} - -int& -ViewSegmentNumbers::view_num() -{ return view;} - -bool -ViewSegmentNumbers:: -operator<(const ViewSegmentNumbers& other) const -{ - return (view< other.view) || - ((view == other.view) && (segment > other.segment)); -} - -bool -ViewSegmentNumbers:: -operator==(const ViewSegmentNumbers& other) const -{ - return (view == other.view) && (segment == other.segment); -} - -bool -ViewSegmentNumbers:: -operator!=(const ViewSegmentNumbers& other) const -{ - return !(*this == other); -} -END_NAMESPACE_STIR diff --git a/src/include/stir/ViewgramIndices.h b/src/include/stir/ViewgramIndices.h new file mode 100644 index 0000000000..f8a8fdfc36 --- /dev/null +++ b/src/include/stir/ViewgramIndices.h @@ -0,0 +1,64 @@ +// +// +/*! + \file + \ingroup projdata + + \brief Definition of class stir::ViewgramIndices + + \author Kris Thielemans + +*/ +/* + Copyright (C) 2023, University College London + This file is part of STIR. + + SPDX-License-Identifier: Apache-2.0 + + See STIR/LICENSE.txt for details +*/ + +#ifndef __stir_ViewgramIndices_h__ +#define __stir_ViewgramIndices_h__ + +#include "stir/SegmentIndices.h" + +START_NAMESPACE_STIR + +/*! + \brief A very simple class to store all dincies to get a (2D) Viewgram + \ingroup projdata +*/ +class ViewgramIndices : public SegmentIndices +{ + typedef SegmentIndices base_type; + +public: + //! an empty constructor (sets everything to 0) + inline ViewgramIndices(); + //! constructor taking view and segment number as arguments + inline ViewgramIndices(const int view_num, const int segment_num); + + //! get view number for const objects + inline int view_num() const; + + //! get reference to view number + inline int& view_num(); + + //! comparison operator, only useful for sorting + /*! order : (0,1) < (0,-1) < (1,1) ...*/ + inline bool operator<(const ViewgramIndices& other) const; + + //! test for equality + inline bool operator==(const ViewgramIndices& other) const; + inline bool operator!=(const ViewgramIndices& other) const; + +private: + int _view; +}; + +END_NAMESPACE_STIR + +#include "stir/ViewgramIndices.inl" + +#endif diff --git a/src/include/stir/ViewgramIndices.inl b/src/include/stir/ViewgramIndices.inl new file mode 100644 index 0000000000..8ef0cce182 --- /dev/null +++ b/src/include/stir/ViewgramIndices.inl @@ -0,0 +1,64 @@ +/*! + \file + \ingroup projdata + + \brief inline implementations for class stir::ViewgramIndices + + \author Kris Thielemans + \author Sanida Mustafovic + \author PARAPET project + + +*/ +/* + Copyright (C) 2000 PARAPET partners + Copyright (C) 2000- 2009, Hammersmith Imanet Ltd + This file is part of STIR. + + SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license + + See STIR/LICENSE.txt for details +*/ + +START_NAMESPACE_STIR + +ViewgramIndices::ViewgramIndices() + : SegmentIndices(), + _view(0) +{} + +ViewgramIndices::ViewgramIndices(const int view_num, const int segment_num) + : SegmentIndices(segment_num), + _view(view_num) +{} + +int +ViewgramIndices::view_num() const +{ + return _view; +} + +int& +ViewgramIndices::view_num() +{ + return _view; +} + +bool +ViewgramIndices::operator<(const ViewgramIndices& other) const +{ + return (_view < other._view) || ((_view == other._view) && base_type::operator<(other)); +} + +bool +ViewgramIndices::operator==(const ViewgramIndices& other) const +{ + return (_view == other._view) && base_type::operator==(other); +} + +bool +ViewgramIndices::operator!=(const ViewgramIndices& other) const +{ + return !(*this == other); +} +END_NAMESPACE_STIR From c8bce5e3954d858cea425ba7ef4aa3b512d34a38 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sun, 15 Oct 2023 00:06:51 +0100 Subject: [PATCH 2/6] Add constructors and get* members using *Indices classes --- src/buildblock/ProjData.cxx | 38 +++++++++++++---- src/buildblock/ProjDataInfo.cxx | 50 ++++++++++++++++++---- src/buildblock/SegmentBySinogram.cxx | 35 ++++++++++++---- src/buildblock/SegmentByView.cxx | 35 +++++++++++----- src/include/stir/ProjData.h | 57 +++++++++++++++++++++----- src/include/stir/ProjDataInfo.h | 21 +++++++++- src/include/stir/RelatedViewgrams.h | 5 ++- src/include/stir/RelatedViewgrams.inl | 15 ++++++- src/include/stir/Segment.h | 9 ++-- src/include/stir/Segment.inl | 12 ++++-- src/include/stir/SegmentBySinogram.h | 18 +++++++- src/include/stir/SegmentBySinogram.inl | 1 + src/include/stir/SegmentByView.h | 19 ++++++++- src/include/stir/SegmentByView.inl | 1 + src/include/stir/Sinogram.h | 27 +++++++++--- src/include/stir/Sinogram.inl | 50 +++++++++++++++------- src/include/stir/ViewSegmentNumbers.h | 7 +++- src/include/stir/Viewgram.h | 25 +++++++++-- src/include/stir/Viewgram.inl | 47 +++++++++++++++------ src/swig/stir_projdata.i | 11 ++++- 20 files changed, 384 insertions(+), 99 deletions(-) diff --git a/src/buildblock/ProjData.cxx b/src/buildblock/ProjData.cxx index 0a8067fe87..57db175355 100644 --- a/src/buildblock/ProjData.cxx +++ b/src/buildblock/ProjData.cxx @@ -58,7 +58,7 @@ #include "stir/IO/GEHDF5Wrapper.h" #endif #include "stir/IO/stir_ecat7.h" -#include "stir/ViewSegmentNumbers.h" +#include "stir/ViewgramIndices.h" #include "stir/is_null_ptr.h" #include #include @@ -261,7 +261,19 @@ ProjData::get_subset(const std::vector& views) const } -Viewgram +Viewgram +ProjData::get_empty_viewgram(const ViewgramIndices& ind) const +{ + return proj_data_info_sptr->get_empty_viewgram(ind); +} + +Sinogram +ProjData::get_empty_sinogram(const SinogramIndices& ind) const +{ + return proj_data_info_sptr->get_empty_sinogram(ind); +} + +Viewgram ProjData::get_empty_viewgram(const int view_num, const int segment_num, const bool make_num_tangential_poss_odd) const { @@ -296,9 +308,20 @@ ProjData::get_empty_segment_by_view(const int segment_num, } -RelatedViewgrams -ProjData::get_empty_related_viewgrams(const ViewSegmentNumbers& view_segmnet_num, - //const int view_num, const int segment_num, +SegmentBySinogram +ProjData::get_empty_segment_by_sinogram(const SegmentIndices& ind) const +{ + return proj_data_info_sptr->get_empty_segment_by_sinogram(ind); +} + +SegmentByView +ProjData::get_empty_segment_by_view(const SegmentIndices& ind) const +{ + return proj_data_info_sptr->get_empty_segment_by_view(ind); +} + +RelatedViewgrams +ProjData::get_empty_related_viewgrams(const ViewgramIndices& view_segmnet_num, const shared_ptr& symmetries_used, const bool make_num_tangential_poss_odd) const { @@ -308,15 +331,14 @@ ProjData::get_empty_related_viewgrams(const ViewSegmentNumbers& view_segmnet_num RelatedViewgrams -ProjData::get_related_viewgrams(const ViewSegmentNumbers& view_segmnet_num, - //const int view_num, const int segment_num, +ProjData::get_related_viewgrams(const ViewgramIndices& viewgram_indices, const shared_ptr& symmetries_used, const bool make_num_bins_odd) const { vector pairs; symmetries_used->get_related_view_segment_numbers( pairs, - ViewSegmentNumbers(view_segmnet_num.view_num(),view_segmnet_num.segment_num()) + viewgram_indices ); vector > viewgrams; diff --git a/src/buildblock/ProjDataInfo.cxx b/src/buildblock/ProjDataInfo.cxx index 4b5bfc87ce..0a0823dc8b 100644 --- a/src/buildblock/ProjDataInfo.cxx +++ b/src/buildblock/ProjDataInfo.cxx @@ -4,7 +4,7 @@ Copyright (C) 2000 PARAPET partners Copyright (C) 2000 - 2009-05-13, Hammersmith Imanet Ltd Copyright (C) 2011-07-01 - 2011, Kris Thielemans - Copyright (C) 2018, 2022, University College London + Copyright (C) 2018, 2022, 2023, University College London Copyright (C) 2018, University of Leeds This file is part of STIR. @@ -262,6 +262,15 @@ ProjDataInfo::get_empty_viewgram(const int view_num, return v; } +Viewgram +ProjDataInfo::get_empty_viewgram(const ViewgramIndices& ind) const +{ + // we can't access the shared ptr, so we have to clone 'this'. + shared_ptr proj_data_info_sptr(this->clone()); + Viewgram v(proj_data_info_sptr, ind); + return v; +} + Sinogram ProjDataInfo::get_empty_sinogram(const int axial_pos_num, const int segment_num, @@ -278,6 +287,15 @@ ProjDataInfo::get_empty_sinogram(const int axial_pos_num, const int segment_num, return s; } +Sinogram +ProjDataInfo::get_empty_sinogram(const SinogramIndices& ind) const +{ + // we can't access the shared ptr, so we have to clone 'this'. + shared_ptr proj_data_info_sptr(this->clone()); + Sinogram s(proj_data_info_sptr, ind); + return s; +} + SegmentBySinogram ProjDataInfo::get_empty_segment_by_sinogram(const int segment_num, const bool make_num_tangential_poss_odd) const @@ -296,6 +314,14 @@ ProjDataInfo::get_empty_segment_by_sinogram(const int segment_num, return s; } +SegmentBySinogram +ProjDataInfo::get_empty_segment_by_sinogram(const SegmentIndices& ind) const +{ + // we can't access the shared ptr, so we have to clone 'this'. + shared_ptr proj_data_info_sptr(this->clone()); + SegmentBySinogram s(proj_data_info_sptr, ind); + return s; +} SegmentByView ProjDataInfo::get_empty_segment_by_view(const int segment_num, @@ -315,17 +341,24 @@ ProjDataInfo::get_empty_segment_by_view(const int segment_num, return s; } +SegmentByView +ProjDataInfo::get_empty_segment_by_view(const SegmentIndices& ind) const +{ + // we can't access the shared ptr, so we have to clone 'this'. + shared_ptr proj_data_info_sptr(this->clone()); + SegmentByView s(proj_data_info_sptr, ind); + return s; +} + RelatedViewgrams -ProjDataInfo::get_empty_related_viewgrams(const ViewSegmentNumbers& view_segmnet_num, - //const int view_num, const int segment_num, +ProjDataInfo::get_empty_related_viewgrams(const ViewgramIndices& viewgram_indices, const shared_ptr& symmetries_used, const bool make_num_tangential_poss_odd) const { + if (make_num_tangential_poss_odd) + error("make_num_tangential_poss_odd is no longer supported"); vector pairs; - symmetries_used->get_related_view_segment_numbers( - pairs, - ViewSegmentNumbers(view_segmnet_num.view_num(),view_segmnet_num.segment_num()) - ); + symmetries_used->get_related_view_segment_numbers(pairs, viewgram_indices); vector > viewgrams; viewgrams.reserve(pairs.size()); @@ -333,8 +366,7 @@ ProjDataInfo::get_empty_related_viewgrams(const ViewSegmentNumbers& view_segmnet for (unsigned int i=0; i(viewgrams, symmetries_used); diff --git a/src/buildblock/SegmentBySinogram.cxx b/src/buildblock/SegmentBySinogram.cxx index 88a53d460a..336790a971 100644 --- a/src/buildblock/SegmentBySinogram.cxx +++ b/src/buildblock/SegmentBySinogram.cxx @@ -35,15 +35,15 @@ template SegmentBySinogram :: SegmentBySinogram(const Array<3,elemT>& v, const shared_ptr& pdi_ptr, - const int segment_num) + const SegmentIndices& ind) : - Segment(pdi_ptr, segment_num), + Segment(pdi_ptr, ind), Array<3,elemT>(v) { assert( get_min_view_num() == pdi_ptr->get_min_view_num()); assert( get_max_view_num() == pdi_ptr->get_max_view_num()); - assert( get_min_axial_pos_num() == pdi_ptr->get_min_axial_pos_num(segment_num)); - assert( get_max_axial_pos_num() == pdi_ptr->get_max_axial_pos_num(segment_num)); + assert( get_min_axial_pos_num() == pdi_ptr->get_min_axial_pos_num(ind.segment_num())); + assert( get_max_axial_pos_num() == pdi_ptr->get_max_axial_pos_num(ind.segment_num())); assert( get_min_tangential_pos_num() == pdi_ptr->get_min_tangential_pos_num()); assert( get_max_tangential_pos_num() == pdi_ptr->get_max_tangential_pos_num()); } @@ -51,22 +51,39 @@ SegmentBySinogram(const Array<3,elemT>& v, template SegmentBySinogram :: SegmentBySinogram(const shared_ptr& pdi_ptr, - const int segment_num) + const SegmentIndices& ind) : - Segment(pdi_ptr, segment_num), - Array<3,elemT>(IndexRange3D(pdi_ptr->get_min_axial_pos_num(segment_num), - pdi_ptr->get_max_axial_pos_num(segment_num), + Segment(pdi_ptr, ind), + Array<3,elemT>(IndexRange3D(pdi_ptr->get_min_axial_pos_num(ind.segment_num()), + pdi_ptr->get_max_axial_pos_num(ind.segment_num()), pdi_ptr->get_min_view_num(), pdi_ptr->get_max_view_num(), pdi_ptr->get_min_tangential_pos_num(), pdi_ptr->get_max_tangential_pos_num())) {} +template +SegmentBySinogram:: +SegmentBySinogram(const Array<3,elemT>& v, + const shared_ptr& pdi_sptr, + int segment_num) + : + SegmentBySinogram(v, pdi_sptr, SegmentIndices(segment_num)) +{} + +template +SegmentBySinogram:: +SegmentBySinogram(const shared_ptr& pdi_sptr, + const int segment_num) + : + SegmentBySinogram(pdi_sptr, SegmentIndices(segment_num)) +{} + template SegmentBySinogram:: SegmentBySinogram(const SegmentByView& s_v ) : Segment(s_v.get_proj_data_info_sptr()->create_shared_clone(), - s_v.get_segment_num()), + s_v.get_segment_indices()), Array<3,elemT> (IndexRange3D (s_v.get_min_axial_pos_num(), s_v.get_max_axial_pos_num(), s_v.get_min_view_num(), s_v.get_max_view_num(), s_v.get_min_tangential_pos_num(), s_v.get_max_tangential_pos_num())) diff --git a/src/buildblock/SegmentByView.cxx b/src/buildblock/SegmentByView.cxx index 5543239884..f08fc61ae4 100644 --- a/src/buildblock/SegmentByView.cxx +++ b/src/buildblock/SegmentByView.cxx @@ -33,15 +33,15 @@ template SegmentByView:: SegmentByView(const Array<3,elemT>& v, const shared_ptr& pdi_ptr, - const int segment_num) + const SegmentIndices& ind) : - Segment(pdi_ptr, segment_num), + Segment(pdi_ptr, ind), Array<3,elemT>(v) { assert( get_min_view_num() == pdi_ptr->get_min_view_num()); assert( get_max_view_num() == pdi_ptr->get_max_view_num()); - assert( get_min_axial_pos_num() == pdi_ptr->get_min_axial_pos_num(segment_num)); - assert( get_max_axial_pos_num() == pdi_ptr->get_max_axial_pos_num(segment_num)); + assert( get_min_axial_pos_num() == pdi_ptr->get_min_axial_pos_num(ind.segment_num())); + assert( get_max_axial_pos_num() == pdi_ptr->get_max_axial_pos_num(ind.segment_num())); assert( get_min_tangential_pos_num() == pdi_ptr->get_min_tangential_pos_num()); assert( get_max_tangential_pos_num() == pdi_ptr->get_max_tangential_pos_num()); @@ -50,22 +50,37 @@ SegmentByView(const Array<3,elemT>& v, template SegmentByView:: SegmentByView(const shared_ptr& pdi_ptr, - const int segment_num) + const SegmentIndices& ind) : - Segment(pdi_ptr, segment_num), + Segment(pdi_ptr, ind), Array<3,elemT>(IndexRange3D(pdi_ptr->get_min_view_num(), pdi_ptr->get_max_view_num(), - pdi_ptr->get_min_axial_pos_num(segment_num), - pdi_ptr->get_max_axial_pos_num(segment_num), + pdi_ptr->get_min_axial_pos_num(ind.segment_num()), + pdi_ptr->get_max_axial_pos_num(ind.segment_num()), pdi_ptr->get_min_tangential_pos_num(), pdi_ptr->get_max_tangential_pos_num())) {} +template +SegmentByView:: +SegmentByView(const Array<3,elemT>& v, + const shared_ptr& pdi_sptr, + const int segment_num) + : + SegmentByView(v, pdi_sptr, SegmentIndices(segment_num)) +{} + +template +SegmentByView:: +SegmentByView(const shared_ptr& pdi_sptr, + const int segment_num) + : SegmentByView(pdi_sptr, SegmentIndices(segment_num)) +{} + template SegmentByView::SegmentByView(const SegmentBySinogram& s_s) : Segment(s_s.get_proj_data_info_sptr()->create_shared_clone(), - s_s.get_segment_num()), - + s_s.get_segment_indices()), Array<3,elemT> (IndexRange3D(s_s.get_min_view_num(),s_s.get_max_view_num(), s_s.get_min_axial_pos_num(),s_s.get_max_axial_pos_num(), s_s.get_min_tangential_pos_num(), s_s.get_max_tangential_pos_num())) diff --git a/src/include/stir/ProjData.h b/src/include/stir/ProjData.h index 722c045acd..e97f41e6f5 100644 --- a/src/include/stir/ProjData.h +++ b/src/include/stir/ProjData.h @@ -44,7 +44,6 @@ template class SegmentBySinogram; template class SegmentByView; template class Viewgram; template class Sinogram; -class ViewSegmentNumbers; class Succeeded; class ProjDataInMemory; //class ExamInfo; @@ -119,14 +118,21 @@ class ProjData : public ExamData inline shared_ptr get_proj_data_info_sptr() const; //! Get viewgram + /*! + \deprecated Use get_viewgram(const ViewgramIndices&) instead. + */ virtual Viewgram get_viewgram(const int view, const int segment_num,const bool make_num_tangential_poss_odd = false) const=0; + //! Get viewgram inline Viewgram get_viewgram(const ViewgramIndices&); //! Set viewgram virtual Succeeded set_viewgram(const Viewgram&) = 0; //! Get sinogram + /*! + \deprecated Use get_sinogram(const SinogramIndices&) instead . + */ virtual Sinogram get_sinogram(const int ax_pos_num, const int segment_num,const bool make_num_tangential_poss_odd = false) const=0; //! Get sinogram @@ -141,34 +147,66 @@ class ProjData : public ExamData get_subset(const std::vector& views) const; //! Get empty viewgram + Viewgram get_empty_viewgram(const ViewgramIndices&) const; + + //! Get empty viewgram + /*! + \deprecated Use get_viewgram(const ViewgramIndices&) instead. + */ Viewgram get_empty_viewgram(const int view, const int segment_num, const bool make_num_tangential_poss_odd = false) const; //! Get empty_sinogram + Sinogram + get_empty_sinogram(const SinogramIndices&) const; + + //! Get empty_sinogram + /*! + \deprecated Use get_sinogram(const SinogramIndices&) instead . + */ Sinogram get_empty_sinogram(const int ax_pos_num, const int segment_num, const bool make_num_tangential_poss_odd = false) const; - //! Get empty segment sino - SegmentByView + //! Get empty segment by view + SegmentByView + get_empty_segment_by_view(const SegmentIndices&) const; + //! Get empty segment by sino + SegmentBySinogram + get_empty_segment_by_sinogram(const SegmentIndices&) const; + //! Get empty segment view + /*! + \deprecated Use get_empty_segment_by_sinogram(const SegmentIndices&) instead . + */ + SegmentByView get_empty_segment_by_view(const int segment_num, const bool make_num_tangential_poss_odd = false) const; - //! Get empty segment view - SegmentBySinogram + //! Get empty segment sino + /*! + \deprecated Use get_empty_segment_by_sinogram(const SegmentIndices&) instead . + */ + SegmentBySinogram get_empty_segment_by_sinogram(const int segment_num, const bool make_num_tangential_poss_odd = false) const; - //! Get segment by sinogram + /*! + \deprecated Use get_segment_by_sinogram(const SegmentIndices&) instead. + */ virtual SegmentBySinogram get_segment_by_sinogram(const int segment_num) const; + //! Get segment by sinogram inline SegmentBySinogram get_segment_by_sinogram(const SegmentIndices&) const; //! Get segment by view - virtual SegmentByView + /*! + \deprecated Use get_segment_by_view(const SegmentIndices&) instead. + */ + virtual SegmentByView get_segment_by_view(const int segment_num) const; + //! Get segment by view inline SegmentByView get_segment_by_view(const SegmentIndices&) const; @@ -181,7 +219,7 @@ class ProjData : public ExamData //! Get related viewgrams virtual RelatedViewgrams - get_related_viewgrams(const ViewSegmentNumbers&, + get_related_viewgrams(const ViewgramIndices&, const shared_ptr&, const bool make_num_tangential_poss_odd = false) const; //! Set related viewgrams @@ -190,8 +228,7 @@ class ProjData : public ExamData //! Get empty related viewgrams, where the symmetries_ptr specifies the symmetries to use RelatedViewgrams - get_empty_related_viewgrams(const ViewSegmentNumbers& view_segmnet_num, - //const int view_num, const int segment_num, + get_empty_related_viewgrams(const ViewgramIndices& viewgram_indices, const shared_ptr& symmetries_ptr, const bool make_num_tangential_poss_odd = false) const; diff --git a/src/include/stir/ProjDataInfo.h b/src/include/stir/ProjDataInfo.h index 64d96cc67d..d0be14fb3b 100644 --- a/src/include/stir/ProjDataInfo.h +++ b/src/include/stir/ProjDataInfo.h @@ -4,7 +4,7 @@ Copyright (C) 2000 PARAPET partners Copyright (C) 2000 - 2011-10-14, Hammersmith Imanet Ltd Copyright (C) 2011-07-01 - 2011, Kris Thielemans - Copyright (C) 2017-2018, 2020, 2022, University College London + Copyright (C) 2017-2018, 2020, 2022, 2023 University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -24,6 +24,9 @@ #ifndef __stir_ProjDataInfo_H__ #define __stir_ProjDataInfo_H__ +#include "stir/SegmentIndices.h" +#include "stir/ViewgramIndices.h" +#include "stir/SinogramIndices.h" #include "stir/VectorWithOffset.h" #include "stir/Scanner.h" #include "stir/shared_ptr.h" @@ -347,23 +350,37 @@ class ProjDataInfo //@{ //! Get empty viewgram + Viewgram get_empty_viewgram(const ViewgramIndices&) const; + //! Get empty_sinogram + Sinogram get_empty_sinogram(const SinogramIndices&) const; + //! Get empty segment sino + SegmentByView get_empty_segment_by_view(const SegmentIndices&) const; + //! Get empty segment view + SegmentBySinogram get_empty_segment_by_sinogram(const SegmentIndices&) const; + + //! Get empty viewgram + /*! \deprecated */ Viewgram get_empty_viewgram(const int view_num, const int segment_num, const bool make_num_tangential_poss_odd = false) const; //! Get empty_sinogram + /*! \deprecated */ Sinogram get_empty_sinogram(const int ax_pos_num, const int segment_num, const bool make_num_tangential_poss_odd = false) const; //! Get empty segment sino + /*! \deprecated */ SegmentByView get_empty_segment_by_view(const int segment_num, const bool make_num_tangential_poss_odd = false) const; //! Get empty segment view + /*! \deprecated */ SegmentBySinogram get_empty_segment_by_sinogram(const int segment_num, const bool make_num_tangential_poss_odd = false) const; //! Get empty related viewgrams, where the symmetries_ptr specifies the symmetries to use - RelatedViewgrams get_empty_related_viewgrams(const ViewSegmentNumbers&, + /*! make_num_tangential_poss_odd has to be \c false */ + RelatedViewgrams get_empty_related_viewgrams(const ViewgramIndices&, const shared_ptr&, const bool make_num_tangential_poss_odd = false) const; //@} diff --git a/src/include/stir/RelatedViewgrams.h b/src/include/stir/RelatedViewgrams.h index 52742b642d..7ad3847bff 100644 --- a/src/include/stir/RelatedViewgrams.h +++ b/src/include/stir/RelatedViewgrams.h @@ -85,8 +85,11 @@ class RelatedViewgrams /*! see DataSymmetriesForViewSegmentNumbers for definition of 'basic' */ inline int get_basic_segment_num() const; //! get 'basic' view_segment_num + /*! \deprecated Use get_basic_viewgram_indices() instead. */ + inline ViewgramIndices get_basic_view_segment_num() const; + //! get 'basic' viewgram indices /*! see DataSymmetriesForViewSegmentNumbers for definition of 'basic' */ - inline ViewSegmentNumbers get_basic_view_segment_num() const; + inline ViewgramIndices get_basic_viewgram_indices() const; //! returns the number of viewgrams in this object inline int get_num_viewgrams() const; diff --git a/src/include/stir/RelatedViewgrams.inl b/src/include/stir/RelatedViewgrams.inl index 084cc68da6..6eee8108f7 100644 --- a/src/include/stir/RelatedViewgrams.inl +++ b/src/include/stir/RelatedViewgrams.inl @@ -71,10 +71,21 @@ int RelatedViewgrams::get_basic_segment_num() const } template -ViewSegmentNumbers RelatedViewgrams:: +ViewgramIndices +RelatedViewgrams:: +get_basic_viewgram_indices() const +{ + assert(viewgrams.size()>0); + check_state(); + return viewgrams[0].get_viewgram_indices(); +} + +template +ViewgramIndices +RelatedViewgrams:: get_basic_view_segment_num() const { - return ViewSegmentNumbers(get_basic_view_num(), get_basic_segment_num()); + return this->get_basic_viewgram_indices(); } template diff --git a/src/include/stir/Segment.h b/src/include/stir/Segment.h index 5583ff4007..7b700e7526 100644 --- a/src/include/stir/Segment.h +++ b/src/include/stir/Segment.h @@ -1,6 +1,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000-2012 Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -21,6 +22,7 @@ #include "stir/ProjDataInfo.h" +#include "stir/SegmentIndices.h" #include "stir/shared_ptr.h" START_NAMESPACE_STIR @@ -33,7 +35,7 @@ template class Viewgram; \ingroup projdata This stores a subset of the data accessible via a ProjData object, - where the segment_num is fixed. + where the SegmentIndices are fixed. At the moment, 2 'storage modes' are supported (and implemented as derived classes). @@ -60,6 +62,7 @@ class Segment get_proj_data_info_sptr() const; virtual StorageOrder get_storage_order() const = 0; + inline SegmentIndices get_segment_indices() const; //! Get the segment number inline int get_segment_num() const; virtual int get_min_axial_pos_num() const = 0; @@ -114,9 +117,9 @@ class Segment protected: shared_ptr proj_data_info_sptr; - int segment_num; + SegmentIndices _indices; - inline Segment(const shared_ptr& proj_data_info_sptr_v,const int s_num); + inline Segment(const shared_ptr& proj_data_info_sptr_v,const SegmentIndices&); }; END_NAMESPACE_STIR diff --git a/src/include/stir/Segment.inl b/src/include/stir/Segment.inl index 7e32fe1b68..80d31d210f 100644 --- a/src/include/stir/Segment.inl +++ b/src/include/stir/Segment.inl @@ -3,6 +3,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2007, IRSL + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -25,16 +26,21 @@ START_NAMESPACE_STIR template Segment:: -Segment( const shared_ptr& proj_data_info_sptr_v,const int s_num) +Segment( const shared_ptr& proj_data_info_sptr_v,const SegmentIndices& ind) : proj_data_info_sptr(proj_data_info_sptr_v), - segment_num(s_num) + _indices(ind) {} +template +SegmentIndices +Segment:: get_segment_indices() const +{ return _indices; } + template int Segment:: get_segment_num() const -{ return segment_num; } +{ return _indices.segment_num(); } template shared_ptr diff --git a/src/include/stir/SegmentBySinogram.h b/src/include/stir/SegmentBySinogram.h index 25c420b5f4..a4c8399a68 100644 --- a/src/include/stir/SegmentBySinogram.h +++ b/src/include/stir/SegmentBySinogram.h @@ -3,6 +3,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2012, Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -38,7 +39,7 @@ template class SegmentByView; /*! \ingroup projdata - \brief A class for storing (3d) projection data with a fixed segment_num. + \brief A class for storing (3d) projection data with fixed SegmentIndices. Storage order is as follows: \code @@ -56,11 +57,26 @@ class SegmentBySinogram : public Segment, public Array<3,elemT> typedef typename Segment::StorageOrder StorageOrder; //! Constructor that sets the data to a given 3d Array + SegmentBySinogram(const Array<3,elemT>& v, + const shared_ptr& proj_data_info_ptr_v, + const SegmentIndices& ind); + + //! Constructor that sets sizes via the ProjDataInfo object, initialising data to 0 + SegmentBySinogram(const shared_ptr& proj_data_info_ptr_v, + const SegmentIndices& ind); + + //! Constructor that sets the data to a given 3d Array + /*! + \deprecated Use version with SegmentIndices instead + */ SegmentBySinogram(const Array<3,elemT>& v, const shared_ptr& proj_data_info_ptr_v, const int segment_num); //! Constructor that sets sizes via the ProjDataInfo object, initialising data to 0 + /*! + \deprecated Use version with SegmentIndices instead + */ SegmentBySinogram(const shared_ptr& proj_data_info_ptr_v, const int segment_num); diff --git a/src/include/stir/SegmentBySinogram.inl b/src/include/stir/SegmentBySinogram.inl index 2500a7e1e5..eb25fc66a6 100644 --- a/src/include/stir/SegmentBySinogram.inl +++ b/src/include/stir/SegmentBySinogram.inl @@ -3,6 +3,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2007, Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license diff --git a/src/include/stir/SegmentByView.h b/src/include/stir/SegmentByView.h index e0e858d829..231a172461 100644 --- a/src/include/stir/SegmentByView.h +++ b/src/include/stir/SegmentByView.h @@ -3,6 +3,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2007, Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -37,7 +38,7 @@ template class Sinogram; /*! \ingroup projdata - \brief A class for storing (3d) projection data with a fixed segment_num. + \brief A class for storing (3d) projection data with fixed SegmentIndices. Storage order is as follows: \code @@ -55,14 +56,28 @@ template class SegmentByView : public Segment, public Ar typedef typename Segment::StorageOrder StorageOrder; //! Constructor that sets the data to a given 3d Array + SegmentByView(const Array<3,elemT>& v, + const shared_ptr& proj_data_info_sptr, + const SegmentIndices&); + + //! Constructor that sets sizes via the ProjDataInfo object, initialising data to 0 + SegmentByView(const shared_ptr& proj_data_info_sptr, + const SegmentIndices&); + + //! Constructor that sets the data to a given 3d Array + /*! + \deprecated Use version with SegmentIndices instead + */ SegmentByView(const Array<3,elemT>& v, const shared_ptr& proj_data_info_ptr, const int segment_num); //! Constructor that sets sizes via the ProjDataInfo object, initialising data to 0 + /*! + \deprecated Use version with SegmentIndices instead + */ SegmentByView(const shared_ptr& proj_data_info_ptr, const int segment_num); - //! Conversion from 1 storage order to the other SegmentByView(const SegmentBySinogram& ); diff --git a/src/include/stir/SegmentByView.inl b/src/include/stir/SegmentByView.inl index 2ec586ffc6..d222e6a63e 100644 --- a/src/include/stir/SegmentByView.inl +++ b/src/include/stir/SegmentByView.inl @@ -16,6 +16,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2011, Hammersmtih Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license diff --git a/src/include/stir/Sinogram.h b/src/include/stir/Sinogram.h index 1661c685cc..f523dceb13 100644 --- a/src/include/stir/Sinogram.h +++ b/src/include/stir/Sinogram.h @@ -4,6 +4,7 @@ Copyright (C) 2000 PARAPET partners Copyright (C) 2000 - 2007-10-08, Hammersmith Imanet Ltd Copyright (C) 2011-07-01 - 2012, Kris Thielemans + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -29,6 +30,7 @@ #include "stir/Array.h" #include "stir/ProjDataInfo.h" +#include "stir/SinogramIndices.h" #include "stir/shared_ptr.h" @@ -40,7 +42,7 @@ START_NAMESPACE_STIR \ingroup projdata \brief A class for 2d projection data. - This represents a subset of the full projection. segment_num and axial_pos_num + This represents a subset of the full projection. SegmentIndices and axial_pos_num are fixed. */ @@ -60,14 +62,30 @@ class Sinogram : public Array<2,elemT> #endif public: - //! Construct sinogram from proj_data_info pointer, ring and segment number. Data are set to 0. + //! Construct sinogram from proj_data_info pointe and indices. Data are set to 0. + inline Sinogram(const shared_ptr& proj_data_info_sptr, + const SinogramIndices&); + + //! Construct sinogram with data set to the array. + inline Sinogram(const Array<2,elemT>& p,const shared_ptr& proj_data_info_sptr, + const SinogramIndices&); + + //! Construct sinogram from proj_data_info pointer, axial position and segment number. Data are set to 0. + /*! + \deprecated Use version with SinogramIndices instead. + */ inline Sinogram(const shared_ptr& proj_data_info_ptr, const int ax_pos_num, const int segment_num); //! Construct sinogram with data set to the array. + /*! + \deprecated Use version with SinogramIndices instead. + */ inline Sinogram(const Array<2,elemT>& p,const shared_ptr& proj_data_info_ptr, const int ax_pos_num, const int segment_num); - + + //! Get indices + inline SinogramIndices get_sinogram_indices() const; //! Get segment number inline int get_segment_num() const; //! Get number of axial positions @@ -129,8 +147,7 @@ class Sinogram : public Array<2,elemT> private: shared_ptr proj_data_info_ptr; - int axial_pos_num; - int segment_num; + SinogramIndices _indices; }; diff --git a/src/include/stir/Sinogram.inl b/src/include/stir/Sinogram.inl index 637f9d6bac..e381c6de94 100644 --- a/src/include/stir/Sinogram.inl +++ b/src/include/stir/Sinogram.inl @@ -3,6 +3,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2007,Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -28,15 +29,22 @@ START_NAMESPACE_STIR +template +SinogramIndices +Sinogram::get_sinogram_indices() const +{ + return this->_indices; +} + template int Sinogram::get_segment_num() const -{ return segment_num; } +{ return this->_indices.segment_num(); } template int Sinogram::get_axial_pos_num() const -{ return axial_pos_num; } +{ return this->_indices.axial_pos_num(); } template int @@ -74,8 +82,8 @@ template Sinogram Sinogram::get_empty_copy(void) const { - Sinogram copy(proj_data_info_ptr, get_axial_pos_num(), get_segment_num()); - return copy; + Sinogram copy(proj_data_info_ptr, get_sinogram_indices()); + return copy; } template @@ -89,15 +97,14 @@ template Sinogram:: Sinogram(const Array<2,elemT>& p, const shared_ptr& pdi_ptr, - const int ax_pos_num, const int s_num) + const SinogramIndices& ind) : - Array<2,elemT>(p), + Array<2,elemT>(p), proj_data_info_ptr(pdi_ptr), - axial_pos_num(ax_pos_num), - segment_num(s_num) + _indices(ind) { - assert(axial_pos_num <= proj_data_info_ptr->get_max_axial_pos_num(segment_num)); - assert(axial_pos_num >= proj_data_info_ptr->get_min_axial_pos_num(segment_num)); + assert(axial_pos_num <= proj_data_info_ptr->get_max_axial_pos_num(ind.segment_num())); + assert(axial_pos_num >= proj_data_info_ptr->get_min_axial_pos_num(ind.segment_num())); // segment_num is already checked by doing get_max_axial_pos_num(s_num) assert( get_min_view_num() == pdi_ptr->get_min_view_num()); @@ -111,20 +118,33 @@ Sinogram(const Array<2,elemT>& p, template Sinogram:: Sinogram(const shared_ptr& pdi_ptr, - const int ax_pos_num, const int s_num) + const SinogramIndices& ind) : Array<2,elemT>(IndexRange2D (pdi_ptr->get_min_view_num(), pdi_ptr->get_max_view_num(), pdi_ptr->get_min_tangential_pos_num(), pdi_ptr->get_max_tangential_pos_num())), proj_data_info_ptr(pdi_ptr), - axial_pos_num(ax_pos_num), - segment_num(s_num) + _indices(ind) { - assert(axial_pos_num <= proj_data_info_ptr->get_max_axial_pos_num(segment_num)); - assert(axial_pos_num >= proj_data_info_ptr->get_min_axial_pos_num(segment_num)); + assert(axial_pos_num <= proj_data_info_ptr->get_max_axial_pos_num(ind.segment_num())); + assert(axial_pos_num >= proj_data_info_ptr->get_min_axial_pos_num(ind.segment_num())); // segment_num is already checked by doing get_max_axial_pos_num(s_num) } +template +Sinogram:: +Sinogram(const Array<2,elemT>& p, + const shared_ptr& pdi_sptr, + const int ax_pos_num, const int s_num) + : Sinogram(p, pdi_sptr, SinogramIndices(ax_pos_num, s_num)) +{} + +template +Sinogram:: +Sinogram(const shared_ptr& pdi_sptr, + const int ax_pos_num, const int s_num) + : Sinogram(pdi_sptr, SinogramIndices(ax_pos_num, s_num)) +{} END_NAMESPACE_STIR diff --git a/src/include/stir/ViewSegmentNumbers.h b/src/include/stir/ViewSegmentNumbers.h index 40bdb6c8c6..2b359d0b2a 100644 --- a/src/include/stir/ViewSegmentNumbers.h +++ b/src/include/stir/ViewSegmentNumbers.h @@ -30,10 +30,15 @@ START_NAMESPACE_STIR \deprecated */ -// Note: needs to be a class due to forward declarations class ViewSegmentNumbers : public ViewgramIndices { +public: using ViewgramIndices::ViewgramIndices; + // default constructor (needed for Visual Studio) + ViewSegmentNumbers() : ViewgramIndices() {} + ViewSegmentNumbers(const ViewgramIndices& ind) + : ViewgramIndices(ind) + {} }; END_NAMESPACE_STIR diff --git a/src/include/stir/Viewgram.h b/src/include/stir/Viewgram.h index c6dcce6b14..faaf9f7b16 100644 --- a/src/include/stir/Viewgram.h +++ b/src/include/stir/Viewgram.h @@ -4,6 +4,7 @@ Copyright (C) 2000 PARAPET partners Copyright (C) 2000 - 2007-10-08, Hammersmith Imanet Ltd Copyright (C) 2011-07-01 - 2012, Kris Thielemans + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -28,7 +29,8 @@ #include "stir/Array.h" -#include "stir/ProjDataInfo.h" +#include "stir/ProjDataInfo.h" +#include "stir/ViewgramIndices.h" #include "stir/IndexRange.h" #include "stir/shared_ptr.h" @@ -39,7 +41,7 @@ START_NAMESPACE_STIR \ingroup projdata \brief A class for 2d projection data. - This represents a subset of the full projection. segment_num and view_num + This represents a subset of the full projection. SegmentIndices and view_num are fixed. */ @@ -60,15 +62,31 @@ class Viewgram : public Array<2,elemT> #endif public: + //! Construct from proj_data_info pointer and indices. Data are set to 0. + inline Viewgram(const shared_ptr& proj_data_info_ptr, + const ViewgramIndices& ind); + + //! Construct with data set to the array. + inline Viewgram(const Array<2,elemT>& p,const shared_ptr& proj_data_info_sptr, + const ViewgramIndices& ind); + //! Construct from proj_data_info pointer, view and segment number. Data are set to 0. + /*! + \deprecated Use version with ViewgramIndices instead + */ inline Viewgram(const shared_ptr& proj_data_info_ptr, const int v_num, const int s_num); //! Construct with data set to the array. + /*! + \deprecated Use version with ViewgramIndices instead + */ inline Viewgram(const Array<2,elemT>& p,const shared_ptr& proj_data_info_ptr, const int v_num, const int s_num); + //! Get indices + inline ViewgramIndices get_viewgram_indices() const; //! Get segment number inline int get_segment_num() const; //! Get number of views @@ -128,8 +146,7 @@ class Viewgram : public Array<2,elemT> private: shared_ptr proj_data_info_sptr; - int view_num; - int segment_num; + ViewgramIndices _indices; }; END_NAMESPACE_STIR diff --git a/src/include/stir/Viewgram.inl b/src/include/stir/Viewgram.inl index 7dd8838934..d8327d9f64 100644 --- a/src/include/stir/Viewgram.inl +++ b/src/include/stir/Viewgram.inl @@ -16,6 +16,7 @@ /* Copyright (C) 2000 PARAPET partners Copyright (C) 2000- 2009, Hammersmith Imanet Ltd + Copyright (C) 2023, University College London This file is part of STIR. SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license @@ -27,15 +28,22 @@ START_NAMESPACE_STIR +template +ViewgramIndices +Viewgram::get_viewgram_indices() const +{ + return this->_indices; +} + template int Viewgram::get_segment_num() const -{ return segment_num; } +{ return this->_indices.segment_num(); } template int Viewgram::get_view_num() const -{ return view_num; } +{ return this->_indices.view_num(); } template int @@ -74,7 +82,7 @@ template Viewgram Viewgram::get_empty_copy(void) const { - Viewgram copy(proj_data_info_sptr, get_view_num(), get_segment_num()); + Viewgram copy(proj_data_info_sptr, get_viewgram_indices()); return copy; } @@ -90,17 +98,17 @@ template Viewgram:: Viewgram(const Array<2,elemT>& p, const shared_ptr& pdi_sptr, - const int v_num, const int s_num) + const ViewgramIndices& ind) : Array<2,elemT>(p), proj_data_info_sptr(pdi_sptr), - view_num(v_num), segment_num(s_num) + _indices(ind) { assert(view_num <= proj_data_info_sptr->get_max_view_num()); assert(view_num >= proj_data_info_sptr->get_min_view_num()); // segment_num is already checked by doing get_max_axial_pos_num(s_num) - assert( get_min_axial_pos_num() == pdi_sptr->get_min_axial_pos_num(s_num)); - assert( get_max_axial_pos_num() == pdi_sptr->get_max_axial_pos_num(s_num)); + assert( get_min_axial_pos_num() == pdi_sptr->get_min_axial_pos_num(ind.segment_num())); + assert( get_max_axial_pos_num() == pdi_sptr->get_max_axial_pos_num(ind.segment_num())); assert( get_min_tangential_pos_num() == pdi_sptr->get_min_tangential_pos_num()); assert( get_max_tangential_pos_num() == pdi_sptr->get_max_tangential_pos_num()); } @@ -108,20 +116,35 @@ Viewgram(const Array<2,elemT>& p, template Viewgram:: Viewgram(const shared_ptr& pdi_sptr, - const int v_num, const int s_num) + const ViewgramIndices& ind) : - Array<2,elemT>(IndexRange2D (pdi_sptr->get_min_axial_pos_num(s_num), - pdi_sptr->get_max_axial_pos_num(s_num), + Array<2,elemT>(IndexRange2D (pdi_sptr->get_min_axial_pos_num(ind.segment_num()), + pdi_sptr->get_max_axial_pos_num(ind.segment_num()), pdi_sptr->get_min_tangential_pos_num(), pdi_sptr->get_max_tangential_pos_num())), proj_data_info_sptr(pdi_sptr), - view_num(v_num), - segment_num(s_num) + _indices(ind) { assert(view_num <= proj_data_info_sptr->get_max_view_num()); assert(view_num >= proj_data_info_sptr->get_min_view_num()); // segment_num is already checked by doing get_max_axial_pos_num(s_num) } +template +Viewgram:: +Viewgram(const Array<2,elemT>& p, + const shared_ptr& pdi_sptr, + const int v_num, const int s_num) + : + Viewgram(p, pdi_sptr, ViewgramIndices(v_num, s_num)) +{} + +template +Viewgram:: +Viewgram(const shared_ptr& pdi_sptr, + const int v_num, const int s_num) + : + Viewgram(pdi_sptr, ViewgramIndices(v_num, s_num)) +{} END_NAMESPACE_STIR diff --git a/src/swig/stir_projdata.i b/src/swig/stir_projdata.i index be38c4f0f3..e49a52721e 100644 --- a/src/swig/stir_projdata.i +++ b/src/swig/stir_projdata.i @@ -54,12 +54,19 @@ ADD_REPR(stir::DetectionPosition, %arg(*$self)) #endif %template(DetectionPositionPair) stir::DetectionPositionPair; -%attributeref(stir::Bin, int, segment_num); +%attributeref(stir::SegmentIndices, int, segment_num); +#ifdef STIR_TOF +%attributeref(stir::SegmentIndices, int, timing_pos_num); +#endif +%attributeref(stir::ViewgramIndices, int, view_num); +%attributeref(stir::SinogramIndices, int, axial_pos_num); %attributeref(stir::Bin, int, axial_pos_num); -%attributeref(stir::Bin, int, view_num); %attributeref(stir::Bin, int, tangential_pos_num); %attributeref(stir::Bin, int, time_frame_num); %attribute(stir::Bin, float, bin_value, get_bin_value, set_bin_value); +%include "stir/SegmentIndices.h" +%include "stir/ViewgramIndices.h" +%include "stir/SinogramIndices.h" %include "stir/Bin.h" #ifdef STIR_TOF ADD_REPR(stir::Bin, %arg(*$self)) From 1e1a89c558cce2e3639cb968d51ec8a807065368 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sun, 15 Oct 2023 01:10:33 +0100 Subject: [PATCH 3/6] update release notes --- documentation/release_5.2.htm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/documentation/release_5.2.htm b/documentation/release_5.2.htm index cf8075eb27..631b121222 100644 --- a/documentation/release_5.2.htm +++ b/documentation/release_5.2.htm @@ -75,6 +75,17 @@

New functionality

but you could use it to optimise the number of OpenMP threads to use for your data.
PR #1237. +
  • New classes SegmentIndices, ViewgramIndices and SinogramIndices, used by ProjData related classes, as opposed + to having to specify all the elements directly, e.g. in C++ +
    +      auto sinogram = proj_data.get_sinogram(sinogram_indices);
    +    
    + This makes these functions more future proof, in particular for TOF. The older functions are now deprecated. + Note that as Bin is now derived from ViewgramIndices, instantations of Bin can now be used to specify the indices as well in most places. +
    + There is still more work to do here, mostly related to the symmetries. +
    PR #1273. +
  • Python (and MATLAB)

    @@ -124,6 +135,9 @@

    Deprecated functionality

  • The following functions (previously used for upsampling the scatter estimate) have been made obsolete or replaced, and will be removed in STIR version 6.0.0: interpolate_axial_position, extend_sinogram_in_views and extend_segment_in_views
  • +
  • Constructors/functions in ProjData related classes that explicitly use axial_pos_num, view_num in their arguments are now deprecated, + and should be replaced by their respective versions that use SegmentIndices, ViewgramIndices and SinogramIndices. +
  • Build system and dependencies

    From 4b5bae0c602ce12c687121b1025e10db34676bac Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Mon, 16 Oct 2023 12:27:04 +0100 Subject: [PATCH 4/6] minimal update to work with ViewgramIndices A lot of work to be done here, but that has to be after the next release. --- .../DataSymmetriesForViewSegmentNumbers.h | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/include/stir/DataSymmetriesForViewSegmentNumbers.h b/src/include/stir/DataSymmetriesForViewSegmentNumbers.h index a3e6cf0e13..c557b4c9de 100644 --- a/src/include/stir/DataSymmetriesForViewSegmentNumbers.h +++ b/src/include/stir/DataSymmetriesForViewSegmentNumbers.h @@ -22,13 +22,11 @@ #ifndef __DataSymmetriesForViewSegmentNumbers_H__ #define __DataSymmetriesForViewSegmentNumbers_H__ -#include "stir/common.h" +#include "stir/ViewSegmentNumbers.h" #include START_NAMESPACE_STIR -class ViewSegmentNumbers; - #if 0 class ViewSegmentIndexRange; #endif @@ -46,6 +44,8 @@ class ViewSegmentIndexRange; The class mainly defines members to find \c basic ViewSegmentNumbers. These form a 'basis' for all ViewSegmentNumbers in the sense that all ViewSegmentNumbers can be obtained by using symmetry operations on the 'basic' ones. + + \par Warning: This class wil be renamed/revised to work with \c ViewgramIndices instead. */ class DataSymmetriesForViewSegmentNumbers { @@ -74,12 +74,26 @@ class DataSymmetriesForViewSegmentNumbers virtual void get_related_view_segment_numbers(std::vector&, const ViewSegmentNumbers& v_s) const = 0; +#if 0 + // not yet, as would need copying of vector + //! fills in a vector with all the view/segments that are related to 'v_s' (including itself) + virtual std::vector + get_related_view_segment_numbers(const ViewgramIndices& ind) const + { + } +#endif + //! returns the number of view_segment_numbers related to 'v_s' /*! The default implementation is in terms of get_related_view_segment_numbers, which will be slow of course */ virtual int num_related_view_segment_numbers(const ViewSegmentNumbers& v_s) const; + std::size_t num_related_viewgram_indices(const ViewgramIndices& ind) const + { + return static_cast(num_related_view_segment_numbers(ind)); + } + /*! \brief given an arbitrary view/segment, find the basic view/segment sets 'v_s' to the corresponding 'basic' view/segment and returns true if From 266a025104ce6727d2363b3eb49dd122bbe661d3 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Mon, 16 Oct 2023 20:49:23 +0100 Subject: [PATCH 5/6] fix assert statement after updating to *Indices --- src/include/stir/Sinogram.inl | 8 ++++---- src/include/stir/Viewgram.inl | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/include/stir/Sinogram.inl b/src/include/stir/Sinogram.inl index e381c6de94..90c3a28590 100644 --- a/src/include/stir/Sinogram.inl +++ b/src/include/stir/Sinogram.inl @@ -103,8 +103,8 @@ Sinogram(const Array<2,elemT>& p, proj_data_info_ptr(pdi_ptr), _indices(ind) { - assert(axial_pos_num <= proj_data_info_ptr->get_max_axial_pos_num(ind.segment_num())); - assert(axial_pos_num >= proj_data_info_ptr->get_min_axial_pos_num(ind.segment_num())); + assert(ind.axial_pos_num() <= proj_data_info_ptr->get_max_axial_pos_num(ind.segment_num())); + assert(ind.axial_pos_num() >= proj_data_info_ptr->get_min_axial_pos_num(ind.segment_num())); // segment_num is already checked by doing get_max_axial_pos_num(s_num) assert( get_min_view_num() == pdi_ptr->get_min_view_num()); @@ -127,8 +127,8 @@ Sinogram(const shared_ptr& pdi_ptr, proj_data_info_ptr(pdi_ptr), _indices(ind) { - assert(axial_pos_num <= proj_data_info_ptr->get_max_axial_pos_num(ind.segment_num())); - assert(axial_pos_num >= proj_data_info_ptr->get_min_axial_pos_num(ind.segment_num())); + assert(ind.axial_pos_num() <= proj_data_info_ptr->get_max_axial_pos_num(ind.segment_num())); + assert(ind.axial_pos_num() >= proj_data_info_ptr->get_min_axial_pos_num(ind.segment_num())); // segment_num is already checked by doing get_max_axial_pos_num(s_num) } diff --git a/src/include/stir/Viewgram.inl b/src/include/stir/Viewgram.inl index d8327d9f64..d675a471cb 100644 --- a/src/include/stir/Viewgram.inl +++ b/src/include/stir/Viewgram.inl @@ -103,8 +103,8 @@ Viewgram(const Array<2,elemT>& p, Array<2,elemT>(p), proj_data_info_sptr(pdi_sptr), _indices(ind) { - assert(view_num <= proj_data_info_sptr->get_max_view_num()); - assert(view_num >= proj_data_info_sptr->get_min_view_num()); + assert(ind.view_num() <= proj_data_info_sptr->get_max_view_num()); + assert(ind.view_num() >= proj_data_info_sptr->get_min_view_num()); // segment_num is already checked by doing get_max_axial_pos_num(s_num) assert( get_min_axial_pos_num() == pdi_sptr->get_min_axial_pos_num(ind.segment_num())); @@ -125,8 +125,8 @@ Viewgram(const shared_ptr& pdi_sptr, proj_data_info_sptr(pdi_sptr), _indices(ind) { - assert(view_num <= proj_data_info_sptr->get_max_view_num()); - assert(view_num >= proj_data_info_sptr->get_min_view_num()); + assert(ind.view_num() <= proj_data_info_sptr->get_max_view_num()); + assert(ind.view_num() >= proj_data_info_sptr->get_min_view_num()); // segment_num is already checked by doing get_max_axial_pos_num(s_num) } From 0e48ad5b32d3c961098b605f8cbc76cc6caaec6f Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Wed, 18 Oct 2023 22:20:57 +0100 Subject: [PATCH 6/6] minor updates to release notes for v5.2 - fixes to text on SegmentIndices etc - flag that we will require C++ 14 in the next major version --- documentation/release_5.2.htm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/documentation/release_5.2.htm b/documentation/release_5.2.htm index 631b121222..3f06a7bd1a 100644 --- a/documentation/release_5.2.htm +++ b/documentation/release_5.2.htm @@ -135,9 +135,11 @@

    Deprecated functionality

  • The following functions (previously used for upsampling the scatter estimate) have been made obsolete or replaced, and will be removed in STIR version 6.0.0: interpolate_axial_position, extend_sinogram_in_views and extend_segment_in_views
  • -
  • Constructors/functions in ProjData related classes that explicitly use axial_pos_num, view_num in their arguments are now deprecated, - and should be replaced by their respective versions that use SegmentIndices, ViewgramIndices and SinogramIndices. +
  • Constructors/functions in ProjData related classes that explicitly use axial_pos_num, view_num etc in their arguments are now deprecated, + and should be replaced by their respective versions that use SegmentIndices, ViewgramIndices or SinogramIndices. The former will not be + compatible with TOF information that will be introduced in version 6.0.0.
  • +
  • STIR version 6.0.0 will likely require C++ 14 (currently we require C++ 11, but already support C++ 20).
  • Build system and dependencies