STIR  6.2.0
ListModeData.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2011-06-24, Hammersmith Imanet Ltd
3  Copyright (C) 2011-07-01 - 2014, Kris Thielemans
4  Copyright (C) 2019, National Physical Laboratory
5  Copyright (C) 2019, University College of London
6  This file is part of STIR.
7 
8  SPDX-License-Identifier: Apache-2.0
9 
10  See STIR/LICENSE.txt for details
11 */
21 #ifndef __stir_listmode_ListModeData_H__
22 #define __stir_listmode_ListModeData_H__
23 
24 #include <string>
25 #include <ctime>
26 #include "stir/ProjDataInfo.h"
27 #include "stir/ExamData.h"
30 #include "stir/error.h"
31 #ifdef BOOST_NO_STDC_NAMESPACE
32 namespace std
33 {
34 using ::time_t;
35 }
36 #endif
37 
38 START_NAMESPACE_STIR
39 class ListRecord;
40 class Succeeded;
41 class ExamInfo;
42 
123 class ListModeData : public ExamData
124 {
125 public:
128 
130  typedef unsigned int SavedPosition;
131 
133  ListModeData();
134 
135  ~ListModeData() override;
136 
138 
146  virtual std::string get_name() const = 0;
147 
148  // //! Get const pointer to exam info
149  // const ExamInfo*
150  // get_exam_info_ptr() const;
151  // //! Get shared pointer to exam info
152  // /*! \warning Use with care. If you modify the object pointer to by a shared ptr, all objects using the same
153  // shared pointer will be affected. */
154  // shared_ptr<ExamInfo>
155  // get_exam_info_sptr() const;
156 
157 #if 0
158 
165  virtual
166  std::time_t
167  get_scan_start_time_in_secs_since_1970() const;
168 #endif
169 
171 
175  shared_ptr<ListRecord> get_empty_record_sptr() const
176  {
177  return this->get_empty_record_helper_sptr();
178  }
179 
181  virtual Succeeded get_next_record(ListRecord& event) const
182  {
183  return get_next(event);
184  }
185 
187  virtual Succeeded reset() = 0;
188 
190 
207  virtual SavedPosition save_get_position() = 0;
208 
210 
211  virtual Succeeded set_get_position(const SavedPosition&) = 0;
212 
214 
217  const Scanner& get_scanner() const;
218 
220  virtual bool has_delayeds() const = 0;
224  virtual inline unsigned long int get_total_number_of_events() const
225  {
226  error("ListModeData: The function get_total_number_of_events() is currently not supported for this file format.");
227  return 0;
228  }
229 
230  virtual shared_ptr<const ProjDataInfo> get_proj_data_info_sptr() const;
231 
232 protected:
233  virtual shared_ptr<ListRecord> get_empty_record_helper_sptr() const = 0;
234  virtual Succeeded get_next(ListRecord& event) const = 0;
235  virtual void set_proj_data_info_sptr(shared_ptr<const ProjDataInfo>);
237  // shared_ptr<ExamInfo> exam_info_sptr;
239  shared_ptr<const ProjDataInfo> proj_data_info_sptr;
240 };
241 
242 END_NAMESPACE_STIR
243 
244 #endif
virtual Succeeded get_next_record(ListRecord &event) const
Gets the next record in the listmode sequence.
Definition: ListModeData.h:181
Declaration of class stir::ProjDataInfo.
declaration of stir::ExamData
STL namespace.
shared_ptr< ListRecord > get_empty_record_sptr() const
Get a pointer to an empty record.
Definition: ListModeData.h:175
unsigned int SavedPosition
Use this typedef for save/set_get_position.
Definition: ListModeData.h:130
The base class for reading list mode data.
Definition: ListModeData.h:123
Declaration of stir::error()
A class for storing some info on the scanner.
Definition: Scanner.h:107
A class for a general element of a list mode file.
Definition: ListRecord.h:44
shared_ptr< const ProjDataInfo > proj_data_info_sptr
Has to be set by the derived class.
Definition: ListModeData.h:239
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition: error.cxx:42
Declarations of classes stir::ListRecord which is used for list mode data.
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
Declaration of class stir::RegisteredParsingObject.
ListModeData hierarchy_base_type
typedef used by read_from_file
Definition: ListModeData.h:127
virtual unsigned long int get_total_number_of_events() const
Returns the total number of events in the listmode file.
Definition: ListModeData.h:224
base class for data objects such as ProjData etcProvides an ExamInfo member.
Definition: ExamData.h:33