STIR 6.4.0
CListRecordROOT.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2015-2016 University of Leeds
3 Copyright (C) 2016 UCL
4 Copyright (C) 2016-17, University of Hull
5 This file is part of STIR.
6
7 SPDX-License-Identifier: Apache-2.0
8
9 See STIR/LICENSE.txt for details
10*/
19
20#ifndef __stir_listmode_CListRecordROOT_H__
21#define __stir_listmode_CListRecordROOT_H__
22
25#include "stir/Succeeded.h"
26#include "stir/round.h"
27#include "boost/static_assert.hpp"
29#include <boost/cstdint.hpp>
30#include "stir/warning.h"
31
32START_NAMESPACE_STIR
33
34class CListEventROOT : public CListEventCylindricalScannerWithDiscreteDetectors
35{
36public:
37 CListEventROOT(const shared_ptr<const ProjDataInfo>& proj_data_info);
38
40 void get_detection_position(DetectionPositionPair<>&) const override;
41
43 void set_detection_position(const DetectionPositionPair<>&) override;
44
46 void init_from_data(const int& _ring1, const int& _ring2, const int& crystal1, const int& crystal2, const double& _delta_time);
47
48 inline bool is_prompt() const override { return true; }
49
50 double get_delta_time() const { return delta_time; }
51
52private:
54 int ring1;
56 int ring2;
58 int det1;
60 int det2;
62 double delta_time;
63#ifdef STIR_ROOT_ROTATION_AS_V4
66 int quarter_of_detectors;
67#endif
68};
69
71
73class CListTimeROOT : public ListTime
74{
75public:
76 void init_from_data(double time1) { timeA = time1; }
77
79 bool is_time() const { return true; }
82 inline unsigned long get_time_in_millisecs() const override { return static_cast<unsigned long>(timeA * 1e3); }
83 inline Succeeded set_time_in_millisecs(const unsigned long time_in_millisecs) override
84 {
85 warning("set_time_in_millisecs: Not implemented for ROOT files. Aborting.");
86 return Succeeded::no;
87 }
88
89private:
93 double timeA;
94};
95
97class CListRecordROOT : public CListRecord // currently no gating yet
98{
99public:
101 bool inline is_time() const override;
103 bool inline is_event() const override;
104
105 CListEventROOT& event() override { return this->event_data; }
106
107 const CListEventROOT& event() const override { return this->event_data; }
108
109 CListTimeROOT& time() override { return this->time_data; }
110
111 const CListTimeROOT& time() const override { return this->time_data; }
112
113 bool operator==(const CListRecord& e2) const
114 {
115 return dynamic_cast<CListRecordROOT const*>(&e2) != 0 && raw[0] == dynamic_cast<CListRecordROOT const&>(e2).raw[0]
116 && raw[1] == dynamic_cast<CListRecordROOT const&>(e2).raw[1];
117 }
118
119 CListRecordROOT(const shared_ptr<const ProjDataInfo>& proj_data_info_sptr)
120 : event_data(proj_data_info_sptr)
121 {}
122
123 virtual Succeeded init_from_data(const int& ring1,
124 const int& ring2,
125 const int& crystal1,
126 const int& crystal2,
127 const double& time1,
128 const double& delta_time,
129 const int& event1,
130 const int& event2)
131 {
133
134 this->event_data.init_from_data(ring1, ring2, crystal1, crystal2, delta_time);
135
136 this->time_data.init_from_data(time1);
137
138 // We can make a singature raw based on the two events IDs.
139 // It is pretty unique.
140 raw[0] = event1;
141 raw[1] = event2;
142
143 return Succeeded::yes;
144 }
145
146private:
147 CListEventROOT event_data;
148 CListTimeROOT time_data;
149 boost::int32_t raw[2]; // this raw field isn't strictly necessary, get rid of it?
150};
151
152END_NAMESPACE_STIR
154#endif
Declarations of class stir::CListEventCylindricalScannerWithDiscreteDetectors.
Implementation of class stir::InputStreamFromROOTFile.
Declarations of classes stir::CListRecord, and stir::CListEvent which are used for list mode data.
Declaration of class stir::DetectionPositionPair.
Declaration of class stir::Succeeded.
bool is_time() const override
Returns always true.
Definition CListRecordROOT.inl:23
virtual Succeeded init_from_data(const int &ring1, const int &ring2, const int &crystal1, const int &crystal2, const double &time1, const double &delta_time, const int &event1, const int &event2)
Definition CListRecordROOT.h:123
bool is_event() const override
Returns always true.
Definition CListRecordROOT.inl:29
Class for records in a PET list mode file.
Definition CListRecord.h:67
A class for storing and using a timing 'event' from a listmode file from the ECAT 8_32bit scanner.
Definition CListRecordROOT.h:74
unsigned long get_time_in_millisecs() const override
Returns the detection time of the first photon in milliseconds.
Definition CListRecordROOT.h:82
bool is_time() const
Returns always true.
Definition CListRecordROOT.h:79
A class for storing and using a timing record from a listmode file.
Definition ListTime.h:47
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44
void warning(const char *const s,...)
Print warning with format string a la printf.
Definition warning.cxx:41
Declaration of the stir::round functions.
Declaration of stir::warning()