3 #ifndef __stir_LORCoordinates_H__ 4 #define __stir_LORCoordinates_H__ 33 template <
class coordT>
35 template <
class coordT>
37 template <
class coordT>
39 template <
class coordT>
41 template <
class coordT>
57 template <
class coordT>
63 virtual LOR* clone()
const = 0;
66 virtual bool is_swapped()
const = 0;
79 template <
class coordT>
84 void check_state()
const 87 assert(_psi < static_cast<coordT>(2 *
_PI));
101 coordT z()
const {
return _z; }
102 coordT& z() {
return _z; }
116 template <
class coordT>
121 void check_state()
const { assert(_radius > 0); }
158 coordT radius()
const 164 inline void set_radius_no_check(
const coordT new_radius)
167 assert(new_radius > 0);
168 _z1 *= new_radius / _radius;
169 _z2 *= new_radius / _radius;
170 _radius = new_radius;
183 template <
class coordT>
193 void check_state()
const 224 void reset(coordT radius = 1)
228 _p2.psi() =
static_cast<coordT
>(
_PI);
231 coordT radius()
const 244 assert(new_radius > 0);
245 if (_radius == new_radius)
246 return Succeeded::yes;
248 const coordT min_radius = _radius * fabs(cos((_p1.psi() - _p2.psi()) / 2));
249 if (new_radius >= min_radius)
250 return Succeeded::no;
251 _p1.z() *= new_radius / _radius;
252 _p2.z() *= new_radius / _radius;
253 _radius = new_radius;
254 return Succeeded::yes;
271 self_type* clone()
const override 273 return new self_type(*
this);
294 template <
class coordT>
340 self_type* clone()
const override 342 return new self_type(*
this);
365 template <
class coordT>
378 void check_state()
const 380 assert(private_base_type::_radius > 0);
381 assert(_s > -private_base_type::_radius);
382 assert(_s < private_base_type::_radius);
383 assert(_phi < static_cast<coordT>(
_PI));
391 return private_base_type::z1();
396 return private_base_type::z1();
401 return private_base_type::z2();
406 return private_base_type::z2();
432 return asin(_s / private_base_type::_radius);
452 const coordT z1,
const coordT z2,
const coordT phi,
const coordT s,
const coordT radius = 1,
const bool swapped =
false);
463 self_type* clone()
const override 465 return new self_type(*
this);
468 void reset(coordT radius = 1)
472 private_base_type::_radius = radius;
474 coordT radius()
const 477 return private_base_type::_radius;
480 inline Succeeded set_radius(
const coordT new_radius)
482 if (private_base_type::_radius == new_radius)
483 return Succeeded::yes;
484 assert(new_radius > 0);
485 if (fabs(s()) >= new_radius)
486 return Succeeded::no;
487 this->set_radius_no_check(new_radius);
488 return Succeeded::yes;
509 template <
class coordT>
521 void check_state()
const 523 assert(private_base_type::_radius > 0);
524 assert(_beta >= static_cast<coordT>(-
_PI / 2));
525 assert(_beta < static_cast<coordT>(
_PI / 2));
526 assert(_phi < static_cast<coordT>(
_PI));
534 return private_base_type::z1();
539 return private_base_type::z1();
544 return private_base_type::z2();
549 return private_base_type::z2();
585 return private_base_type::_radius * sin(_beta);
588 void reset(coordT radius = 1)
592 private_base_type::_radius = radius;
594 coordT radius()
const 597 return private_base_type::_radius;
600 inline Succeeded set_radius(
const coordT new_radius)
602 if (private_base_type::_radius == new_radius)
603 return Succeeded::yes;
604 assert(new_radius > 0);
605 if (fabs(s()) >= new_radius)
606 return Succeeded::no;
607 this->set_radius_no_check(new_radius);
608 return Succeeded::yes;
619 const coordT z1,
const coordT z2,
const coordT phi,
const coordT beta,
const coordT radius = 1,
const bool swapped =
false);
630 self_type* clone()
const override 632 return new self_type(*
this);
654 template <
class coordT1,
class coordT2>
661 template <
class coordT1,
class coordT2>
664 const double radius);
669 template <
class coordT1,
class coordT2>
672 const double radius);
678 template <
class coordT1,
class coordT2>
681 const double radius);
Declaration of class stir::Succeeded.
#define _PI
The constant pi to high precision.
Definition: common.h:134
An internal class for LORs. Do not use.
Definition: LORCoordinates.h:117
a templated class for 3-dimensional coordinates.
Definition: CartesianCoordinate3D.h:52
Succeeded set_radius(coordT new_radius)
Changes the radius of the LOR.
Definition: LORCoordinates.h:241
bool is_swapped() const override
Return if the LOR direction is opposite from normal.
Definition: LORCoordinates.h:220
A class for a point on a cylinder.
Definition: LORCoordinates.h:80
bool is_swapped() const override
Return if the LOR direction is opposite from normal.
Definition: LORCoordinates.h:335
A class for LORs.
Definition: LORCoordinates.h:38
A class for LORs.
Definition: CListRecord.h:39
bool is_swapped() const override
Return if the LOR direction is opposite from normal.
Definition: LORCoordinates.h:434
bool is_swapped() const override
Return if the LOR direction is opposite from normal.
Definition: LORCoordinates.h:571
A class for LORs.
Definition: LORCoordinates.h:40
Succeeded find_LOR_intersections_with_cylinder(LORInAxialAndSinogramCoordinates< coordT1 > &lor, const LORAs2Points< coordT2 > &cart_coords, const double radius)
Given an LOR, find its intersection with a (infintely long) cylinder.
Definition: LORCoordinates.inl:392
A class for LORs.
Definition: LORCoordinates.h:36
Implementations for LORCoordinates.h.
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
defines the stir::CartesianCoordinate3D<coordT> class
A base class for specifying an LOR with geometric coordinates.
Definition: LORCoordinates.h:34