gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
SpectrumRecord.inl
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2014, Dr Franck P. Vidal (franck.p.vidal@fpvidal.net),
4 http://www.fpvidal.net/
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation and/or
15 other materials provided with the distribution.
16 
17 3. Neither the name of the Bangor University nor the names of its contributors
18 may be used to endorse or promote products derived from this software without
19 specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 */
33 
34 
64 //******************************************************************************
65 // Include
66 //******************************************************************************
67 #ifndef GVXR_UNITS_H
68 #include "gVirtualXRay/Units.h"
69 #endif
70 
71 
72 //******************************************************************************
73 // namespace
74 //******************************************************************************
75 namespace gVirtualXRay {
76 
77 
78 //-----------------------------------------------------------------------------
79 inline SpectrumRecord::SpectrumRecord(const RATIONAL_NUMBER& aPhotonNumber,
80  const RATIONAL_NUMBER& anIncidentEnergy):
81 //-----------------------------------------------------------------------------
82  m_photon_number(aPhotonNumber),
83  m_energy(anIncidentEnergy)
84 //-----------------------------------------------------------------------------
85 {}
86 
87 
88 //------------------------------------------------------------
90 //------------------------------------------------------------
91 {
92  return (m_photon_number);
93 }
94 
95 
96 //------------------------------------------------------------
98 //------------------------------------------------------------
99 {
100  return (m_energy);
101 }
102 
103 
104 //---------------------------------------------------
105 inline std::istream& operator >>(std::istream &is,
106  SpectrumRecord &obj)
107 //---------------------------------------------------
108 {
109  is >> obj.m_energy;
110  is >> obj.m_photon_number;
111 
112  return (is);
113 }
114 
115 
116 //---------------------------------------------------------
117 inline std::ostream& operator <<(std::ostream &os,
118  const SpectrumRecord &obj)
119 //---------------------------------------------------------
120 {
121  os << obj.getPhotonNumber() << " photons of " << obj.getPhotonEnergy() / keV << " keV";
122  return (os);
123 }
124 
125 
126 //------------------------------------------------------------------------
127 inline bool SpectrumRecord::operator<(const SpectrumRecord& aRecord) const
128 //------------------------------------------------------------------------
129 {
130  return (m_energy < aRecord.m_energy);
131 }
132 
133 
134 } // namespace gVirtualXRay
RATIONAL_NUMBER getPhotonEnergy() const
Accessor on the energy of photons.
SpectrumRecord is a class to handle a record of the X-Ray beam, i.e. an energy bin (number of photons...
RATIONAL_NUMBER m_energy
The energy of the photons.
RATIONAL_NUMBER m_photon_number
The number of photons.
std::istream & operator>>(std::istream &anInputSream, gVirtualXRay::AtomicElement &anElement)
operator >>
bool operator<(const SpectrumRecord &aRecord) const
operator<.
float RATIONAL_NUMBER
Type of data used to store real numbers.
Definition: Types.h:107
const double keV
kiloelectron volt
Definition: Units.h:133
std::ostream & operator<<(std::ostream &anOutputSream, const gVirtualXRay::AtomicElement &anElement)
operator <<
RATIONAL_NUMBER getPhotonNumber() const
Accessor on the number of photons in the bin.
Units, such as meters, etc.
SpectrumRecord(const RATIONAL_NUMBER &aPhotonNumber=0, const RATIONAL_NUMBER &anIncidentEnergy=0)
Default constructor.