CTL  0.6.1
Computed Tomography Library
systemblueprints.h
1 #ifndef CTL_SYSTEMBLUEPRINTS_H
2 #define CTL_SYSTEMBLUEPRINTS_H
3 
4 #include "components/allcomponents.h"
5 #include "acquisition/ctsystembuilder.h"
6 #include "mat/deg.h"
7 
8 /*
9  * NOTE: This is header only.
10  */
11 
12 namespace CTL {
13 
14 enum class DetectorBinning { Binning1x1, Binning2x2, Binning4x4 };
15 
16 namespace blueprints {
17 
19 {
20 public:
21  AbstractDetector* detector() const override
22  {
24  QSizeF(1.2, 1.0),
25  40,
26  1000.0,
27  45.0_deg));
28  }
29  AbstractGantry* gantry() const override
30  {
31  return new TubularGantry(1000.0, 550.0);
32  }
33  AbstractSource* source() const override
34  {
35  return new XrayTube(QSizeF(1.0,1.0));
36  }
37 
38  QString systemName() const override { return QStringLiteral("Tubular CT system"); }
39 };
40 
42 {
43 public:
44  GenericCarmCT(DetectorBinning binning = DetectorBinning::Binning2x2)
45  : _binning(binning)
46  {
47  }
48 
49  AbstractDetector* detector() const override;
50  AbstractGantry* gantry() const override
51  {
52  return new CarmGantry(1000.0, QStringLiteral("Robot arm"));
53  }
54  AbstractSource* source() const override
55  {
56  return new XrayTube(QSizeF(1.0,1.0));
57  }
58 
59  QString systemName() const override { return QStringLiteral("C-arm CT system"); }
60 
61 private:
62  DetectorBinning _binning;
63 };
64 
66 {
67  QSize nbPixel;
68  QSizeF pixelSize;
69  QString binName;
70  switch(_binning)
71  {
72  case DetectorBinning::Binning1x1:
73  nbPixel = { 2560, 1920 };
74  pixelSize = { 0.125, 0.125 };
75  binName = QStringLiteral("1x1");
76  break;
77  case DetectorBinning::Binning2x2:
78  nbPixel = { 1280, 960 };
79  pixelSize = { 0.25, 0.25 };
80  binName = QStringLiteral("2x2");
81  break;
82  case DetectorBinning::Binning4x4:
83  nbPixel = { 640, 480 };
84  pixelSize = { 0.5, 0.5 };
85  binName = QStringLiteral("4x4");
86  break;
87  }
88  auto detectorName = "flat panel with " + binName + "-binning";
89 
90  return new FlatPanelDetector(nbPixel, pixelSize, detectorName);
91 }
92 
94 {
95 public:
96  ArtisQ(DetectorBinning binning = DetectorBinning::Binning2x2)
97  : _binning(binning)
98  {
99  }
100 
101  AbstractDetector* detector() const override;
102  AbstractGantry* gantry() const override
103  {
104  return new CarmGantry(1200.0, QStringLiteral("Kuka robot arm"));
105  }
106 
107 // AbstractSource* source() const override
108 // {
109 // return new XrayLaser(75.0, 1337.0, QStringLiteral("X-ray laser"));
110 // }
111  AbstractSource* source() const override
112  {
113  return new XrayTube(QSizeF(1.0,1.0));
114  }
115 
116  QString systemName() const override { return QStringLiteral("C-arm ArtisQ system"); }
117 
118 private:
119  DetectorBinning _binning;
120 };
121 
123 {
124  QSize nbPixel;
125  QSizeF pixelSize;
126  QString binName;
127  switch(_binning)
128  {
129  case DetectorBinning::Binning1x1:
130  nbPixel = { 2480, 1920 };
131  pixelSize = { 0.154, 0.154 };
132  binName = QStringLiteral("1x1");
133  break;
134  case DetectorBinning::Binning2x2:
135  nbPixel = { 1240, 960 };
136  pixelSize = { 0.308, 0.308 };
137  binName = QStringLiteral("2x2");
138  break;
139  case DetectorBinning::Binning4x4:
140  nbPixel = { 616, 480 };
141  pixelSize = { 0.616, 0.616 };
142  binName = QStringLiteral("4x4");
143  break;
144  }
145  auto detectorName = "flat panel with " + binName + "-binning";
146 
147  return new FlatPanelDetector(nbPixel, pixelSize, detectorName);
148 }
149 
150 } // namespace blueprints
151 
152 template <typename CTSystemBlueprint, typename... BlueprintCtorArgs>
153 std::unique_ptr<CTSystem> makeCTSystem(BlueprintCtorArgs&&... args)
154 {
155  std::unique_ptr<CTSystem> ret{ CTSystemBuilder::createFromBlueprint(
156  CTSystemBlueprint{
157  std::forward<BlueprintCtorArgs>(args)... }).clone() };
158  return ret;
159 }
160 
161 template <typename CTSystemBlueprint, typename... BlueprintCtorArgs>
162 std::unique_ptr<SimpleCTSystem> makeSimpleCTSystem(BlueprintCtorArgs&&... args)
163 {
164  std::unique_ptr<SimpleCTSystem> ret{ nullptr };
165  bool canConvert;
166  auto simpleSystem
168  std::forward<BlueprintCtorArgs>(args)... }),
169  &canConvert);
170  if(!canConvert)
171  return ret;
172 
173  ret.reset(static_cast<SimpleCTSystem*>(std::move(simpleSystem).clone()));
174 
175  return ret;
176 }
177 
178 } // namespace CTL
179 
180 #endif // CTL_SYSTEMBLUEPRINTS_H
Definition: systemblueprints.h:18
AbstractDetector * detector() const override
Definition: systemblueprints.h:65
Definition: systemblueprints.h:41
Definition: systemblueprints.h:93
AbstractSource * source() const override
Definition: systemblueprints.h:54
AbstractSource * source() const override
Definition: systemblueprints.h:33
static CylindricalDetector fromRadiusAndFanAngle(const QSize &nbPixelPerModule, const QSizeF &pixelSize, uint nbDetectorModules, double radius, double fanAngle, const QString &name=defaultName())
Definition: cylindricaldetector.cpp:71
AbstractGantry * gantry() const override
Definition: systemblueprints.h:29
Definition: xraytube.h:8
static CTSystem createFromBlueprint(const AbstractCTSystemBlueprint &systemBlueprint)
Definition: ctsystembuilder.cpp:10
Base class for gantry components.
Definition: abstractgantry.h:65
Base class for detector components.
Definition: abstractdetector.h:54
QString systemName() const override
Definition: systemblueprints.h:38
Specialized sub-class of AbstractDetector for detector systems with cylindrical arrangement of module...
Definition: cylindricaldetector.h:20
AbstractGantry * gantry() const override
Definition: systemblueprints.h:50
static SimpleCTSystem fromCTSystem(const CTSystem &system, bool *ok=nullptr)
Definition: simplectsystem.cpp:67
QString systemName() const override
Definition: systemblueprints.h:116
AbstractSource * source() const override
Definition: systemblueprints.h:111
AbstractGantry * gantry() const override
Definition: systemblueprints.h:102
AbstractDetector * detector() const override
Definition: systemblueprints.h:122
AbstractDetector * detector() const override
Definition: systemblueprints.h:21
Specialized sub-class of AbstractGantry to represent systems using a C-arm mounting for source and de...
Definition: carmgantry.h:23
QString systemName() const override
Definition: systemblueprints.h:59
Base class for source components.
Definition: abstractsource.h:68
Definition: ctsystembuilder.h:9
Specialized sub-class of AbstractDetector for flat panel detectors.
Definition: flatpaneldetector.h:16
Specialized sub-class of AbstractGantry to represent systems with tube gantries.
Definition: tubulargantry.h:26