STIR  6.2.0
CylindersWithLineSource.h
1 /*
2  Copyright (C) 2000- 2002, IRSL
3  See STIR/LICENSE.txt for details
4 */
5 
8 
9 START_NAMESPACE_STIR
10 
11 class LineSource_phantom
12 {
13 public:
14  inline LineSource_phantom();
15 
16  inline const shared_ptr<Shape3D>& get_A_ptr() const { return A_ptr; }
17 
18  inline shared_ptr<Shape3D> make_union_ptr(const float fraction) const;
19 
20  inline void translate(const CartesianCoordinate3D<float>& direction);
21  inline void scale(const CartesianCoordinate3D<float>& scale3D);
22 
23 private:
24  shared_ptr<Shape3D> A_ptr;
25 };
26 
27 LineSource_phantom::LineSource_phantom()
28 {
29  A_ptr = new EllipsoidalCylinder(150, 0, 0, CartesianCoordinate3D<float>(0, 0, 0), 0, 0, 0);
30 }
31 
32 void
33 LineSource_phantom::translate(const CartesianCoordinate3D<float>& direction)
34 {
35  A_ptr->translate(direction);
36 }
37 
38 void
39 LineSource_phantom::scale(const CartesianCoordinate3D<float>& scale3D)
40 {
41  // check this!!!
42  A_ptr->scale_around_origin(scale3D);
43 }
44 
45 shared_ptr<Shape3D>
46 LineSource_phantom::make_union_ptr(const float fraction) const
47 {
48  shared_ptr<Shape3D> full_A = get_A_ptr()->clone();
49 
50  return full_A;
51 }
52 
53 class CylindersWithLineSource_phantom
54 {
55 public:
56  inline CylindersWithLineSource_phantom();
57 
58  // inline const shared_ptr<Shape3D>& get_A_ptr() const
59  //{ return A_ptr; }
60 
61  inline const shared_ptr<Shape3D>& get_B_ptr() const { return B_ptr; }
62 
63  inline const shared_ptr<Shape3D>& get_C_ptr() const { return C_ptr; }
64 
65  // inline const shared_ptr<Shape3D>& get_B1_ptr() const
66  //{ return B1_ptr; }
67 
68  // inline const shared_ptr<Shape3D>& get_C1_ptr() const
69  //{ return C1_ptr; }
70 
71  inline shared_ptr<Shape3D> make_union_ptr(const float fraction) const;
72 
73  inline void translate(const CartesianCoordinate3D<float>& direction);
74  inline void scale(const CartesianCoordinate3D<float>& scale3D);
75 
76 private:
77  // shared_ptr<Shape3D> A_ptr;
78  shared_ptr<Shape3D> B_ptr;
79  shared_ptr<Shape3D> C_ptr;
80  // shared_ptr<Shape3D> B1_ptr;
81  // shared_ptr<Shape3D> C1_ptr;
82 };
83 
84 CylindersWithLineSource_phantom::CylindersWithLineSource_phantom()
85 {
86  // A_ptr = new EllipsoidalCylinder (150,19,19,
87  // CartesianCoordinate3D<float>(0,0,0),
88  // 0,0,0);
89 
90  // for 966
91  // B_ptr = new EllipsoidalCylinder (500,60,60,
92  // CartesianCoordinate3D<float>(0,0,0),
93  // 0,0,0);
94 
95  // two planes only
96  /* B_ptr = new EllipsoidalCylinder (1,6,6,
97  CartesianCoordinate3D<float>(0,-14,0),
98  0,0,0);
99 
100  C_ptr = new EllipsoidalCylinder (1,6,6,
101  CartesianCoordinate3D<float>(0,14,0),
102  0,0,0);*/
103  // off centre
104 
105  // this is to check the bloody arthifacts in new filters
106 
107  /*B_ptr = new EllipsoidalCylinder (1,6,6,
108  CartesianCoordinate3D<float>(0,-13,4),
109  0,0,0);
110 
111  C_ptr = new EllipsoidalCylinder (1,6,6,
112  CartesianCoordinate3D<float>(0,13,4),
113  0,0,0);*/
114 
115  // these are the ones noramly used
116  B_ptr = new EllipsoidalCylinder(1, 8, 8, CartesianCoordinate3D<float>(0, -14, 5), 0, 0, 0);
117 
118  C_ptr = new EllipsoidalCylinder(1, 8, 8, CartesianCoordinate3D<float>(0, 14, 5), 0, 0, 0);
119 
120  // the one that I use for resolution
121  /* B_ptr = new EllipsoidalCylinder (100,8,8,
122  CartesianCoordinate3D<float>(0,-14,0),
123  0,0,0);
124 
125  C_ptr = new EllipsoidalCylinder (100,8,8,
126  CartesianCoordinate3D<float>(0,14,0),
127  0,0,0);*/
128 
129  // the one that I use for resolution
130  /* B1_ptr = new EllipsoidalCylinder (1,6,6,
131  CartesianCoordinate3D<float>(0,0,-14),
132  0,0,0);
133 
134  C1_ptr = new EllipsoidalCylinder (1,6,6,
135  CartesianCoordinate3D<float>(0,0,14),
136  0,0,0);*/
137  // off centre
138 
139  /*B1_ptr = new EllipsoidalCylinder (1,6,6,
140  CartesianCoordinate3D<float>(0,-2,-14),
141  0,0,0);
142 
143  C1_ptr = new EllipsoidalCylinder (1,6,6,
144  CartesianCoordinate3D<float>(0,-2,14),
145  0,0,0);*/
146 }
147 void
148 CylindersWithLineSource_phantom::translate(const CartesianCoordinate3D<float>& direction)
149 {
150  // A_ptr->translate(direction);
151  B_ptr->translate(direction);
152  C_ptr->translate(direction);
153  // B1_ptr->translate(direction);
154  // C1_ptr->translate(direction);
155 }
156 
157 void
158 CylindersWithLineSource_phantom::scale(const CartesianCoordinate3D<float>& scale3D)
159 {
160  // check this!!!
161  // A_ptr->scale_around_origin(scale3D);
162  B_ptr->scale_around_origin(scale3D);
163  C_ptr->scale_around_origin(scale3D);
164  // B1_ptr->scale_around_origin(scale3D);
165  // C1_ptr->scale_around_origin(scale3D);
166 }
167 
168 shared_ptr<Shape3D>
169 CylindersWithLineSource_phantom::make_union_ptr(const float fraction) const
170 {
171  // shared_ptr<Shape3D> full_A = get_A_ptr()->clone();
172  shared_ptr<Shape3D> full_B = get_B_ptr()->clone();
173  shared_ptr<Shape3D> full_C = get_C_ptr()->clone();
174 
175  // shared_ptr<Shape3D> full_B1 = get_B1_ptr()->clone();
176  // shared_ptr<Shape3D> full_C1 = get_C1_ptr()->clone();
177 
178  shared_ptr<Shape3D> AB_union = new CombinedShape3D<logical_and<bool>>(full_C, full_B);
179 
180  // shared_ptr<Shape3D> AB1_union =
181  // new CombinedShape3D <logical_and<bool> >( full_C1,full_B1);
182 
183  // shared_ptr<Shape3D> AB1_AB_union =
184  // new CombinedShape3D <logical_and<bool> >( AB_union, AB1_union);
185 
186  // shared_ptr<Shape3D> ABC_union =
187  // new CombinedShape3D <logical_and<bool> >( AB_union,full_C);
188 
189  // return AB1_AB_union;
190  return AB_union;
191  // return full_B;
192 }
193 
194 // OLD
195 #if 0
196 
197 class CylindersWithLineSource_phantom
198 {
199 public:
200 
201 
202  inline CylindersWithLineSource_phantom();
203 
204  inline const shared_ptr<Shape3D>& get_A_ptr() const
205  { return A_ptr; }
206 
207  //inline const shared_ptr<Shape3D>& get_B_ptr() const
208  // { return B_ptr; }
209 
210  /* inline const shared_ptr<Shape3D>& get_C_ptr() const
211  { return C_ptr; }
212 
213  inline const shared_ptr<Shape3D>& get_D_ptr() const
214  { return D_ptr; }*/
215 
216  inline shared_ptr<Shape3D> make_union_ptr(const float fraction) const;
217 
218  inline void translate(const CartesianCoordinate3D<float>& direction);
219  inline void scale(const CartesianCoordinate3D<float>& scale3D);
220 
221 private:
222  shared_ptr<Shape3D> A_ptr;
223  // shared_ptr<Shape3D> B_ptr;
224  // shared_ptr<Shape3D> C_ptr;
225  //shared_ptr<Shape3D> D_ptr;
226 
227 
228 
229 };
230 
231 
232 CylindersWithLineSource_phantom::CylindersWithLineSource_phantom()
233 {
234 
235  A_ptr = new EllipsoidalCylinder (100,1,1,
236  CartesianCoordinate3D<float>(0,0,0),
237  0,0,0);
238 
239 
240  // A_ptr = new EllipsoidalCylinder (170,10,10,
241  // CartesianCoordinate3D<float>(0,15,-10),
242  // 0,0,0);
243 
244  // B_ptr = new EllipsoidalCylinder (100,10,10,
245  // CartesianCoordinate3D<float>(0,-15,-10),
246  // 0,0,0);
247 
248  /* A_ptr = new EllipsoidalCylinder (100,90,90,
249  CartesianCoordinate3D<float>(0,15,-25),
250  0,0,0);
251 
252  B_ptr = new EllipsoidalCylinder (150,1,1,
253  CartesianCoordinate3D<float>(0,0,0),
254  0,0,0);*/
255 
256 
257  /* C_ptr = new EllipsoidalCylinder (170,1,1,
258  CartesianCoordinate3D<float>(0,0,-25),
259  0,0,0);*/
260 
261  /* D_ptr = new EllipsoidalCylinder (170,1,1,
262  CartesianCoordinate3D<float>(0,0,20),
263  0,0,0);*/
264 
265 
266 }
267 
268 
269 void
270 CylindersWithLineSource_phantom::translate(const CartesianCoordinate3D<float>& direction)
271 {
272 
273  A_ptr->translate(direction);
274  // B_ptr->translate(direction);
275  // C_ptr->translate(direction);
276 // D_ptr->translate(direction);
277 
278 }
279 
280 void
281 CylindersWithLineSource_phantom::scale(const CartesianCoordinate3D<float>& scale3D)
282 {
283  //check this!!!
284  A_ptr->scale_around_origin(scale3D);
285  // B_ptr->scale_around_origin(scale3D);
286  //C_ptr->scale_around_origin(scale3D);
287  // D_ptr->scale_around_origin(scale3D);
288 
289 }
290 
291 shared_ptr<Shape3D>
292 CylindersWithLineSource_phantom::make_union_ptr(const float fraction) const
293 {
294  shared_ptr<Shape3D> full_A = get_A_ptr()->clone();
295  // shared_ptr<Shape3D> full_B = get_B_ptr()->clone();
296  //shared_ptr<Shape3D> full_C = get_C_ptr()->clone();
297  // shared_ptr<Shape3D> full_D = get_D_ptr()->clone();
298 
299  //shared_ptr<Shape3D> AB_union =
300 
301  return full_A ;
302 
303  // new CombinedShape3D <logical_and<bool> >( full_A,full_B);
304 
305 
306 
307  /* shared_ptr<Shape3D> ABC_union =
308  new CombinedShape3D <logical_and<bool> >( AB_union,full_C);*/
309 
310  // return
311  // new CombinedShape3D< logical_and<bool> >( AB_union,full_D);
312 
313 }
314 
315 #endif
316 END_NAMESPACE_STIR
Declaration of class stir::EllipsoidalCylinder.
Declaration of class stir::CombinedShape3D.