18 #ifndef __stir_listmode_CListRecordGEHDF5_H__ 19 #define __stir_listmode_CListRecordGEHDF5_H__ 26 #include <boost/static_assert.hpp> 27 #include <boost/cstdint.hpp> 65 TIME_MARKER_EVT = 0x0,
66 COINC_COUNT_EVT = 0x1,
67 EXTERN_TRIG_EVT = 0x2,
82 #if STIRIsNativeByteOrderBigEndian 86 boost::uint16_t eventLength : 2;
87 boost::uint16_t eventType : 1;
88 boost::uint16_t eventTypeExt : 4;
89 boost::uint16_t dummy : 9;
101 inline bool is_prompt()
const {
return true; }
102 inline Succeeded set_prompt(
const bool prompt =
true)
105 return Succeeded::no;
107 inline bool is_event()
const 109 return (eventType == COINC_EVT) ;
112 inline int get_tof_bin()
const {
return static_cast<int>(-deltaTime); }
113 #if STIRIsNativeByteOrderBigEndian 117 boost::uint16_t eventLength : 2;
118 boost::uint16_t eventType : 1;
119 boost::uint16_t hiXtalShortInteg : 1;
120 boost::uint16_t loXtalShortInteg : 1;
121 boost::uint16_t hiXtalScatterRec : 1;
122 boost::uint16_t loXtalScatterRec : 1;
123 boost::int16_t deltaTime : 9;
124 boost::uint16_t hiXtalAxialID : 6;
125 boost::uint16_t hiXtalTransAxID : 10;
126 boost::uint16_t loXtalAxialID : 6;
127 boost::uint16_t loXtalTransAxID : 10;
139 inline unsigned long get_time_in_millisecs()
const {
return (time_hi() << 16) | time_lo(); }
140 inline Succeeded set_time_in_millisecs(
const unsigned long time_in_millisecs)
142 data.timeMarkerLS = ((1UL << 16) - 1) & (time_in_millisecs);
143 data.timeMarkerMS = (time_in_millisecs) >> 16;
145 return Succeeded::yes;
147 inline bool is_time()
const 149 return (data.eventType == EXTENDED_EVT) && (data.eventTypeExt == TIME_MARKER_EVT);
157 #if STIRIsNativeByteOrderBigEndian 160 boost::uint16_t eventLength : 2;
161 boost::uint16_t eventType : 1;
162 boost::uint16_t eventTypeExt : 4;
163 boost::uint16_t unused1 : 5;
164 boost::uint16_t externEvt3 : 1;
165 boost::uint16_t externEvt2 : 1;
166 boost::uint16_t externEvt1 : 1;
167 boost::uint16_t externEvt0 : 1;
168 boost::uint16_t timeMarkerLS : 16;
169 boost::uint16_t timeMarkerMS : 16;
175 unsigned long time_lo()
const 177 return data.timeMarkerLS;
179 unsigned long time_hi()
const 181 return data.timeMarkerMS;
208 CListRecordGEHDF5(
const shared_ptr<const ProjDataInfo>& proj_data_info_sptr,
const unsigned long first_time_stamp)
210 first_time_stamp(first_time_stamp)
213 bool is_time()
const override {
return this->time_data.is_time(); }
215 bool is_gating_input()
const 217 return this->gating_data.is_gating_input();
221 bool is_event()
const override 223 return this->event_data.is_event();
237 const ListTime& time()
const override 242 virtual CListGatingInput& gating_input()
244 virtual const CListGatingInput& gating_input()
const 253 raw[0] == static_cast<CListRecordGEHDF5 const &>(e2).raw[0] &&
254 (this->is_event() || (raw[1] ==
static_cast<CListRecordGEHDF5 const &
>(e2).raw[1]));
259 inline unsigned long get_time_in_millisecs()
const override 261 return time_data.get_time_in_millisecs() - first_time_stamp;
264 inline Succeeded set_time_in_millisecs(
const unsigned long time_in_millisecs)
override 266 return time_data.set_time_in_millisecs(time_in_millisecs);
269 inline unsigned int get_gating()
const 270 {
return gating_data.get_gating(); }
271 inline Succeeded set_gating(
unsigned int g)
272 {
return gating_data.set_gating(g); }
275 inline bool is_prompt()
const override 277 return event_data.is_prompt();
281 return event_data.set_prompt(prompt);
286 det_pos.pos1().tangential_coord()
287 = this->get_uncompressed_proj_data_info_sptr()->get_scanner_sptr()->get_num_detectors_per_ring() - 1
288 - event_data.loXtalTransAxID;
289 det_pos.pos1().axial_coord() = event_data.loXtalAxialID;
290 det_pos.pos2().tangential_coord()
291 = this->get_uncompressed_proj_data_info_sptr()->get_scanner_sptr()->get_num_detectors_per_ring() - 1
292 - event_data.hiXtalTransAxID;
293 det_pos.pos2().axial_coord() = event_data.hiXtalAxialID;
294 det_pos.timing_pos() = event_data.get_tof_bin();
303 virtual std::size_t size_of_record_at_ptr(
const char*
const data_ptr,
const std::size_t,
const bool do_byte_swap)
const 306 assert(do_byte_swap ==
false);
312 boost::uint16_t raw[4];
314 std::copy(data_ptr, data_ptr + 2, &raw[0]);
315 switch (rec.eventLength)
317 case detail::LENGTH_6_EVT:
318 return std::size_t(6);
319 case detail::LENGTH_8_EVT:
320 return std::size_t(8);
321 case detail::LENGTH_16_EVT:
322 return std::size_t(16);
324 error(
"ClistRecordGEHDF5: error decoding event (eventLength bits are incorrect)");
325 return std::size_t(0);
329 virtual Succeeded init_from_data_ptr(
const char*
const data_ptr,
const std::size_t size,
const bool do_byte_swap)
333 std::copy(data_ptr, data_ptr + size, reinterpret_cast<char*>(&this->raw[0]));
337 error(
"ClistRecordGEHDF5: byte-swapping not supported yet. sorry");
341 return Succeeded::yes;
345 unsigned long first_time_stamp;
351 boost::int32_t raw[16 / 4];
353 BOOST_STATIC_ASSERT(
sizeof(boost::int32_t) == 4);
354 BOOST_STATIC_ASSERT(
sizeof(DataType) == 6);
355 BOOST_STATIC_ASSERT(
sizeof(TimeType) == 6);
Class for storing and using a coincidence event from a list mode file for a cylindrical scanner...
Definition: CListEventCylindricalScannerWithDiscreteDetectors.h:31
CListRecordGEHDF5(const shared_ptr< const ProjDataInfo > &proj_data_info_sptr, const unsigned long first_time_stamp)
constructor
Definition: CListRecordGEHDF5.h:208
This file declares the stir::ByteOrder class.
Declaration of class stir::Succeeded.
Class for storing and using a coincidence event from a GE RDF9 listmode file.
Definition: CListRecordGEHDF5.h:98
Class for finding out what the event/size-type is in a GE RDF9 listmode file.
Definition: CListRecordGEHDF5.h:79
Declaration of stir::error()
Class for records in a PET list mode file.
Definition: CListRecord.h:66
void set_detection_position(const DetectionPositionPair<> &) override
This routine sets in a coincidence event from detector "indices".
Definition: CListRecordGEHDF5.h:298
Class for storing and using a coincidence event from a list mode file.
Definition: CListRecord.h:52
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition: error.cxx:42
void get_detection_position(DetectionPositionPair<> &det_pos) const override
This routine returns the corresponding detector pair.
Definition: CListRecordGEHDF5.h:284
Definition of STIRIsNativeByteOrderBigEndian and STIRIsNativeByteOrderLittleEndian preprocessor symbo...
A class for a general element (or "record") of a GE RDF9 listmode file.
Definition: CListRecordGEHDF5.h:193
Succeeded set_prompt(const bool prompt=true) override
Changes the event from prompt to delayed or vice versa.
Definition: CListRecordGEHDF5.h:279
Declarations of class stir::CListEventCylindricalScannerWithDiscreteDetectors.
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
A class for storing and using a timing 'event' from a GE RDF9 listmode file.
Definition: CListRecordGEHDF5.h:136
Declarations of classes stir::CListRecord, and stir::CListEvent which are used for list mode data...
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