34 #ifndef __stir_listmode_CListRecordSAFIR_H__ 35 #define __stir_listmode_CListRecordSAFIR_H__ 45 #include "boost/static_assert.hpp" 46 #include "boost/cstdint.hpp" 49 #include "boost/make_shared.hpp" 71 template <
class Derived>
84 inline void get_bin(
Bin& bin,
const ProjDataInfo& proj_data_info)
const override;
94 inline bool is_prompt()
const override {
return !(
static_cast<const Derived*
>(
this)->
is_prompt()); }
97 inline void set_map_sptr(shared_ptr<const DetectorCoordinateMap> new_map_sptr) { map_sptr = new_map_sptr; }
100 inline void set_scanner_sptr(shared_ptr<const Scanner> new_scanner_sptr) { scanner_sptr = new_scanner_sptr; }
103 shared_ptr<const DetectorCoordinateMap> map_sptr;
104 shared_ptr<const Scanner> scanner_sptr;
106 const DetectorCoordinateMap& map_to_use()
const {
return map_sptr ? *map_sptr : *this->scanner_sptr->get_detector_map_sptr(); }
127 return Succeeded::yes;
131 #if STIRIsNativeByteOrderBigEndian 133 unsigned isDelayed : 1;
134 unsigned reserved : 6;
148 unsigned reserved : 6;
149 unsigned isDelayed : 1;
172 return Succeeded::yes;
176 #if STIRIsNativeByteOrderBigEndian 178 unsigned isDelayed : 1;
179 unsigned reserved : 8;
193 unsigned reserved : 8;
194 unsigned isDelayed : 1;
204 inline unsigned long get_time_in_millisecs()
const {
return static_cast<unsigned long>(time); }
205 inline Succeeded set_time_in_millisecs(
const unsigned long time_in_millisecs)
207 time = ((boost::uint64_t(1) << 49) - 1) &
static_cast<boost::uint64_t
>(time_in_millisecs);
208 return Succeeded::yes;
210 inline bool is_time()
const {
return type; }
213 #if STIRIsNativeByteOrderBigEndian 214 boost::uint64_t type : 1;
215 boost::uint64_t reserved : 15;
216 boost::uint64_t time : 48;
218 boost::uint64_t time : 48;
219 boost::uint64_t reserved : 15;
220 boost::uint64_t type : 1;
226 template <
class DataType>
231 DataType
get_data()
const {
return this->event_data; }
239 bool is_time()
const override {
return time_data.is_time(); }
241 bool is_event()
const override {
return !time_data.is_time(); }
243 CListEvent& event()
override {
return *
this; }
245 const CListEvent& event()
const override {
return *
this; }
251 ListTime& time()
override {
return *
this; }
253 const ListTime& time()
const override {
return *
this; }
255 virtual bool operator==(
const CListRecord& e2)
const 261 inline unsigned long get_time_in_millisecs()
const override {
return time_data.get_time_in_millisecs(); }
263 inline Succeeded set_time_in_millisecs(
const unsigned long time_in_millisecs)
override 265 return time_data.set_time_in_millisecs(time_in_millisecs);
268 inline bool is_prompt()
const override {
return event_data.is_prompt(); }
270 Succeeded init_from_data_ptr(
const char*
const data_ptr,
const std::size_t size_of_record,
const bool do_byte_swap)
272 assert(size_of_record >= 8);
273 std::copy(data_ptr, data_ptr + 8, reinterpret_cast<char*>(&raw));
275 ByteOrder::swap_order(raw);
276 return Succeeded::yes;
279 std::size_t size_of_record_at_ptr(
const char*
const ,
const std::size_t ,
const bool )
const 295 BOOST_STATIC_ASSERT(
sizeof(boost::uint64_t) == 8);
296 BOOST_STATIC_ASSERT(
sizeof(DataType) == 8);
Class for record with coincidence data using NeuroLF bitfield definition.
Definition: CListRecordSAFIR.h:156
This file declares the stir::ByteOrder class.
Declaration of class stir::Succeeded.
Succeeded set_prompt(const bool prompt=true)
Can be used to set "promptness" of event.
Definition: CListRecordSAFIR.h:124
Class for record with coincidence data using SAFIR bitfield definition.
Definition: CListRecordSAFIR.h:111
bool is_prompt() const
Returns 0 if event is prompt and 1 if delayed.
Definition: CListRecordSAFIR.h:163
DataType get_data() const
Returns event_data (without checking if the type is really event and not time).
Definition: CListRecordSAFIR.h:231
bool is_prompt() const
Returns 0 if event is prompt and 1 if delayed.
Definition: CListRecordSAFIR.h:118
bool is_time() const
Returns 1 if if event is time and 0 if it is prompt.
Definition: CListRecordSAFIR.h:121
Class for records in a PET list mode file.
Definition: CListRecord.h:66
bool is_prompt() const override
Returns 0 if event is prompt and 1 if delayed.
Definition: CListRecordSAFIR.h:94
Definition: CListRecordSAFIR.h:72
Declaration of class stir::DetectorCoordinateMap.
Class for storing and using a coincidence event from a list mode file.
Definition: CListRecord.h:52
Inline implementation of class stir::CListEventSAFIR and stir::CListRecordSAFIR with supporting class...
CListEventSAFIR()
Definition: CListRecordSAFIR.h:78
Definition: DetectorCoordinateMap.h:50
A class for storing coordinates and value of a single projection bin.
Definition: Bin.h:48
bool is_time() const
Returns 1 if if event is time and 0 if it is prompt.
Definition: CListRecordSAFIR.h:166
Class for record with time data using SAFIR bitfield definition.
Definition: CListRecordSAFIR.h:201
Class for general SAFIR record, containing a union of data, time and raw record and providing access ...
Definition: CListRecordSAFIR.h:227
Definition of STIRIsNativeByteOrderBigEndian and STIRIsNativeByteOrderLittleEndian preprocessor symbo...
An (abstract base) class that contains information on the projection data.
Definition: ProjDataInfo.h:69
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
Declarations of classes stir::CListRecord, and stir::CListEvent which are used for list mode data...
Succeeded set_prompt(const bool prompt=true)
Can be used to set "promptness" of event.
Definition: CListRecordSAFIR.h:169
A class for storing and using a timing record from a listmode file.
Definition: ListTime.h:46
A class for storing 2 coordinates-sets of a detection, together with a timing-position index (for TOF...
Definition: DetectionPositionPair.h:40
bool is_valid_template(const ProjDataInfo &) const override
This method checks if the template is valid for LmToProjData.
Definition: CListRecordSAFIR.h:91
void set_scanner_sptr(shared_ptr< const Scanner > new_scanner_sptr)
Definition: CListRecordSAFIR.h:100
void set_map_sptr(shared_ptr< const DetectorCoordinateMap > new_map_sptr)
Function to set map for detector indices to coordinates.
Definition: CListRecordSAFIR.h:97
Declaration of class stir::DetectionPositionPair.