11 #ifndef __stir_MultipleProjData__H__ 12 #define __stir_MultipleProjData__H__ 32 class MultipleProjData :
public ExamData
39 MultipleProjData(
const shared_ptr<const ExamInfo>& exam_info_sptr)
40 : ExamData(exam_info_sptr)
50 MultipleProjData(
const shared_ptr<const ExamInfo>& exam_info_sptr,
const int num_gates);
52 static unique_ptr<MultipleProjData>
read_from_file(
const std::string& parameter_file);
69 unsigned get_num_proj_data()
const {
return static_cast<unsigned>(this->_proj_datas.size()); }
75 std::size_t get_proj_data_size()
const {
return _proj_datas.at(0)->size_all(); }
82 void resize(
const unsigned new_size) { this->_proj_datas.resize(new_size); }
88 void set_proj_data_sptr(
const shared_ptr<ProjData>& proj_data_sptr,
const unsigned int index);
92 const ProjData& operator[](
const unsigned int index)
const 95 assert(index <= this->get_num_proj_data());
96 return *this->_proj_datas[index - 1];
101 const ProjData& get_proj_data(
const unsigned int index)
const {
return (*
this)[index]; }
106 shared_ptr<ProjData> get_proj_data_sptr(
const unsigned int index)
const 109 assert(index <= this->get_num_proj_data());
110 return this->_proj_datas[index - 1];
113 const shared_ptr<const ProjDataInfo> get_proj_data_info_sptr()
const;
117 unsigned int get_num_gates()
const {
return static_cast<unsigned int>(_proj_datas.size()); }
124 template <
typename iterT>
125 iterT
copy_to(iterT array_iter)
const 127 for (std::vector<shared_ptr<ProjData>>::const_iterator it = _proj_datas.begin(); it != _proj_datas.end(); ++it)
129 if (is_null_ptr(*(it)))
130 error(
"Dynamic/gated ProjData have not been properly allocated. Abort.");
142 template <
typename iterT>
145 for (std::vector<shared_ptr<ProjData>>::iterator it = _proj_datas.begin(); it != _proj_datas.end(); ++it)
147 if (is_null_ptr(*(it)))
148 error(
"Dynamic ProjData have not been properly allocated.Abort.");
150 array_iter = (*it)->fill_from(array_iter);
157 std::size_t size_all()
const 159 std::size_t size = 0;
160 for (std::size_t i_gate = 0; i_gate < this->get_num_gates(); i_gate++)
161 size += _proj_datas.at(i_gate)->size_all();
167 std::vector<shared_ptr<ProjData>> _proj_datas;
184 template <
typename iterT>
185 static iterT
copy_to(
const MultipleProjData& stir_object, iterT iter)
188 return stir_object.copy_to(iter);
197 template <
typename iterT>
199 fill_from(MultipleProjData& stir_object, iterT iter, iterT )
201 return stir_object.fill_from(iter);
iterT copy_to(const T &stir_object, iterT iter)
Copy all bins to a range specified by a iterator.
Definition: copy_fill.h:133
Helper class for stir::copy_to and stir::fill_from.
Definition: copy_fill.h:35
declaration of stir::ExamData
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
Declaration of class stir::ProjData.
defines the Array class for multi-dimensional (numeric) arrays
Declaration of stir::error()
unique_ptr< DataT > read_from_file(const FileSignature &signature, FileT file)
Function that reads data from file using the default InputFileFormatRegistry, using the provided File...
Definition: read_from_file.h:46
Definition of stir::is_null_ptr functions.
Declaration of stir::copy_to and stir::fill_from templates.
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition: error.cxx:42
void fill_from(MultipleProjData &stir_object, iterT iter, iterT)
set all elements of a MultipleProjData from an iterator
Definition: MultipleProjData.h:199