STIR 6.5.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
26#include "stir/Succeeded.h"
27#include "stir/round.h"
28#include "boost/static_assert.hpp"
30#include <boost/cstdint.hpp>
31#include "stir/warning.h"
32
33START_NAMESPACE_STIR
34
35class CListEventROOT : public CListEventScannerWithDiscreteDetectors<ProjDataInfoPETScannerWithDiscreteDetectors>
36{
37private:
38 using base_type = CListEventScannerWithDiscreteDetectors<ProjDataInfoPETScannerWithDiscreteDetectors>;
39
40public:
42 CListEventROOT(const shared_ptr<const ProjDataInfo>& proj_data_info);
43
45 void get_detection_position(DetectionPositionPair<>&) const override;
46
48 void set_detection_position(const DetectionPositionPair<>&) override;
49
51 void init_from_data(const int& _ring1, const int& _ring2, const int& crystal1, const int& crystal2, const double& _delta_time);
52
53 inline bool is_prompt() const override { return true; }
54
55 double get_delta_time() const { return delta_time; }
56
57private:
59 int ring1;
61 int ring2;
63 int det1;
65 int det2;
67 double delta_time;
68#ifdef STIR_ROOT_ROTATION_AS_V4
71 int quarter_of_detectors;
72#endif
73};
74
76
78class CListTimeROOT : public ListTime
79{
80public:
81 void init_from_data(double time1) { timeA = time1; }
82
84 bool is_time() const { return true; }
87 inline unsigned long get_time_in_millisecs() const override { return static_cast<unsigned long>(timeA * 1e3); }
88 inline Succeeded set_time_in_millisecs(const unsigned long time_in_millisecs) override
89 {
90 warning("set_time_in_millisecs: Not implemented for ROOT files. Aborting.");
91 return Succeeded::no;
92 }
93
94private:
98 double timeA;
99};
100
102class CListRecordROOT : public CListRecord // currently no gating yet
103{
104public:
106 bool inline is_time() const override;
108 bool inline is_event() const override;
109
110 CListEventROOT& event() override { return this->event_data; }
111
112 const CListEventROOT& event() const override { return this->event_data; }
113
114 CListTimeROOT& time() override { return this->time_data; }
115
116 const CListTimeROOT& time() const override { return this->time_data; }
117
118 bool operator==(const CListRecord& e2) const
119 {
120 return dynamic_cast<CListRecordROOT const*>(&e2) != 0 && raw[0] == dynamic_cast<CListRecordROOT const&>(e2).raw[0]
121 && raw[1] == dynamic_cast<CListRecordROOT const&>(e2).raw[1];
122 }
123
124 CListRecordROOT(const shared_ptr<const ProjDataInfo>& proj_data_info_sptr)
125 : event_data(proj_data_info_sptr)
126 {}
127
128 virtual Succeeded init_from_data(const int& ring1,
129 const int& ring2,
130 const int& crystal1,
131 const int& crystal2,
132 const double& time1,
133 const double& delta_time,
134 const int& event1,
135 const int& event2)
136 {
138
139 this->event_data.init_from_data(ring1, ring2, crystal1, crystal2, delta_time);
140
141 this->time_data.init_from_data(time1);
142
143 // We can make a singature raw based on the two events IDs.
144 // It is pretty unique.
145 raw[0] = event1;
146 raw[1] = event2;
147
148 return Succeeded::yes;
149 }
150
151private:
152 CListEventROOT event_data;
153 CListTimeROOT time_data;
154 boost::int32_t raw[2]; // this raw field isn't strictly necessary, get rid of it?
155};
156
157END_NAMESPACE_STIR
159#endif
Declarations of class stir::CListEventScannerWithDiscreteDetectors.
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::ProjDataInfoPETScannerWithDiscreteDetectors.
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:128
bool is_event() const override
Returns always true.
Definition CListRecordROOT.inl:29
Class for records in a PET list mode file.
Definition CListRecord.h:68
A class for storing and using a timing 'event' from a listmode file from the ECAT 8_32bit scanner.
Definition CListRecordROOT.h:79
unsigned long get_time_in_millisecs() const override
Returns the detection time of the first photon in milliseconds.
Definition CListRecordROOT.h:87
bool is_time() const
Returns always true.
Definition CListRecordROOT.h:84
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().