gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
PhotonCrossSection.h
Go to the documentation of this file.
1 /*
2 
3  Copyright (c) 2017, 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 
35 #ifndef __PhotonCrossSection_h
36 #define __PhotonCrossSection_h
37 
38 
67 //******************************************************************************
68 // Include
69 //******************************************************************************
70 #ifndef __gVirtualXRayConfig_h
72 #endif
73 
74 #ifndef __Mixture_h
75 #include "gVirtualXRay/Mixture.h"
76 #endif
77 
78 //#include <iostream>
79 //#include <vector>
80 //#include <string>
81 
82 
83 //******************************************************************************
84 // defines
85 //******************************************************************************
86 
87 
88 //******************************************************************************
89 // namespace
90 //******************************************************************************
91 namespace gVirtualXRay {
92 
93 class PhotonCrossSection;
94 
95 std::ostream& operator<<(std::ostream& anOuputStream,
96  const PhotonCrossSection& anInstance);
97 
98 
99  //==============================================================================
105  //==============================================================================
107  //------------------------------------------------------------------------------
108  {
109  //******************************************************************************
110  public:
112  PhotonCrossSection(unsigned short Z);
113  PhotonCrossSection(const Mixture& aMixture);
114  PhotonCrossSection(const std::map<int, double>& aWeightSet);
115  PhotonCrossSection(const std::map<std::string, double>& aWeightSet);
116 
117  void reset();
118 
119  void useHU(short HU);
120  void useHounsfieldUnit(short HU);
121  void useHounsfieldValue(short HU);
122 
123  void useElement(unsigned short Z);
124  void useElement(const std::string& aName);
125 
126  void useMixture(const Mixture& aMixture);
127  void useMixture(const std::map<int, double>& aMixture);
128  void useMixture(const std::map<std::string, double>& aMixture);
129  void useMixture(const std::string& aName);
130 
131  void useCompound(const std::string& aName);
132 
133  void useMassAttenuationCoefficient(double aCoefficient);
134  void useLinearAttenuationCoefficient(double aCoefficient);
135 
136  void setDensity(double aDensity);
137 
138  double getMassAttenuationCoefficient(double anEnergy) const;
139  double getLinearAttenuationCoefficient(double anEnergy) const;
140  double getMu(double anEnergy) const;
141  double getDensity() const;
142  double getMolarMass() const;
143  const std::string& getLabel() const;
144 
145  bool operator==(const PhotonCrossSection& aTestData) const;
146  bool operator!=(const PhotonCrossSection& aTestData) const;
147 
148  static std::map<int, double> getMixtureWeightSet(const std::string& aName);
149  static std::map<int, double> getCompoundWeightSet(const std::string& aName);
150 
151 
152  bool useHU() const;
153  bool useHounsfieldUnit() const;
154  bool useHounsfieldValue() const;
155  bool useElement() const;
156  bool useMixture() const;
157  bool useMassAttenuationCoefficient() const;
158  bool useLinearAttenuationCoefficient() const;
159 
160 
161  //------------------------------------------------------------------------------
163 
166  //------------------------------------------------------------------------------
167  std::string getCompound() const;
168 
169 
170  //------------------------------------------------------------------------------
172 
175  //------------------------------------------------------------------------------
176  std::vector<int> getMixtureElementSet() const;
177 
178 
179  //------------------------------------------------------------------------------
181 
184  //------------------------------------------------------------------------------
185  std::vector<double> getMixtureWeightSet() const;
186 
187 
188  friend std::ostream& operator<<(std::ostream& anOuputStream,
189  const PhotonCrossSection& anInstance);
190 
191 
192  //*****************************************************************************
193  protected:
194  static void processElement(std::string& aSymbol,
195  std::string& aWeight,
196  std::map<int, double>& aWeightSet);
197 
198 
199  bool m_use_HU;
204 
205  short m_HU;
206  unsigned short m_Z_number;
210  double m_density;
211  std::string m_label;
212  };
213 
214 
215 } // namespace gVirtualXRay
216 
217 
218 //******************************************************************************
219 #include "PhotonCrossSection.inl"
220 
221 
222 #endif // __PhotonCrossSection_h
bool operator==(const PhotonCrossSection &aTestData) const
std::vector< int > getMixtureElementSet() const
Accessor on the element Z number set of the mixture of the polygon mesh.
friend std::ostream & operator<<(std::ostream &anOuputStream, const PhotonCrossSection &anInstance)
static void processElement(std::string &aSymbol, std::string &aWeight, std::map< int, double > &aWeightSet)
std::string getCompound() const
Accessor on the compound description of the polygon mesh.
void useCompound(const std::string &aName)
double getLinearAttenuationCoefficient(double anEnergy) const
double getMassAttenuationCoefficient(double anEnergy) const
const std::string & getLabel() const
bool operator!=(const PhotonCrossSection &aTestData) const
PhotonCrossSection is a class to manage photon cross sections of elements, compounds and mixtures...
std::ostream & operator<<(std::ostream &anOutputSream, const gVirtualXRay::AtomicElement &anElement)
operator <<
std::vector< double > getMixtureWeightSet() const
Accessor on the element weight set of the mixture of the polygon mesh.
Mixture is a class to manage a mixture (e.g. Ti90Al6V4).
Definition: Mixture.h:101
Class to manage a mixture (e.g. Ti90Al6V4).
double getMu(double anEnergy) const
static std::map< int, double > getCompoundWeightSet(const std::string &aName)
Class to manage photon cross sections of elements, compounds and mixtures.