gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
TissueMaterial.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2013-2023, Dr Franck P. Vidal, Bangor University, All rights reserved.
4 Copyright (c) 2023-present, Prof Franck P. Vidal (franck.vidal@stfc.ac.uk),
5 UK Research and Innovation, 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 __TissueMaterial_h
36 #define __TissueMaterial_h
37 
38 
71 //******************************************************************************
72 // Include
73 //******************************************************************************
74 #ifndef __gVirtualXRayConfig_h
76 #endif
77 
78 #ifndef __Mixture_h
79 #include "gVirtualXRay/Mixture.h"
80 #endif
81 
82 #include <iostream>
83 #include <map>
84 #include <string>
85 
86 
87 //******************************************************************************
88 // define
89 //******************************************************************************
90 
91 
92 //******************************************************************************
93 // namespace
94 //******************************************************************************
95 namespace gVirtualXRay {
96 
97 
98 //******************************************************************************
99 // Class declaration
100 //******************************************************************************
101 class ElementSet;
102 
103 
104 //==============================================================================
109 //==============================================================================
111 //------------------------------------------------------------------------------
112 {
113 //******************************************************************************
114 public:
115  //--------------------------------------------------------------------------
117  /*
118  * @param aMinHUValue: the minimum Hounsfield unit of the material
119  * @param aMaxHUValue: the maximum Hounsfield unit of the material
120  * @param H: the amount of H in the material
121  * @param C: the amount of C in the material
122  * @param N: the amount of N in the material
123  * @param O: the amount of O in the material
124  * @param Na: the amount of Na in the material
125  * @param Mg: the amount of Mg in the material
126  * @param P: the amount of P in the material
127  * @param S: the amount of S in the material
128  * @param Cl: the amount of Cl in the material
129  * @param Ar: the amount of Ar in the material
130  * @param K: the amount of K in the material
131  * @param Ca: the amount of Ca in the material
132  * @param Ti: the amount of Ti in the material
133  * @param Cu: the amount of Cu in the material
134  * @param Zn: the amount of Zn in the material
135  * @param Ag: the amount of Ag in the material
136  * @param Sn: the amount of Sn in the material
137  * @param Fe: the amount of Fe in the material
138  * @param I: the amount of I in the material
139  */
140  //--------------------------------------------------------------------------
141  TissueMaterial(short aMinHUValue = 0,
142  short aMaxHUValue = 0,
143  double H = 0,
144  double C = 0,
145  double N = 0,
146  double O = 0,
147  double Na = 0,
148  double Mg = 0,
149  double P = 0,
150  double S = 0,
151  double Cl = 0,
152  double Ar = 0,
153  double K = 0,
154  double Ca = 0,
155  double Ti = 0,
156  double Cu = 0,
157  double Zn = 0,
158  double Ag = 0,
159  double Sn = 0,
160  double Fe = 0,
161  double I = 0);
162 
163 
164  //--------------------------------------------------------------------------
166  /*
167  * @param aMaterial: the material to copy
168  */
169  //--------------------------------------------------------------------------
170  TissueMaterial(const TissueMaterial& aMaterial);
171 
172 
173  //--------------------------------------------------------------------------
175  //--------------------------------------------------------------------------
176  void clear();
177 
178 
179  //--------------------------------------------------------------------------
181  /*
182  * @return the weight of each atomic element
183  */
184  //--------------------------------------------------------------------------
185  const std::map<int, double>& getWeightSet() const;
186 
187 
188  //--------------------------------------------------------------------------
190  /*
191  * @return the minimum HU
192  */
193  //--------------------------------------------------------------------------
194  short getMinHUValue() const;
195 
196 
197  //--------------------------------------------------------------------------
199  /*
200  * @return the maximum HU
201  */
202  //--------------------------------------------------------------------------
203  short getMaxHUValue() const;
204 
205 
206  //--------------------------------------------------------------------------
208  /*
209  * @return the molar mass of the element
210  */
211  //--------------------------------------------------------------------------
212  double getMolarMass() const;
213 
214 
215  //--------------------------------------------------------------------------
217  /*
218  * @param aDensity: the density of the material
219  */
220  //--------------------------------------------------------------------------
221  void setDensity(double aDensity);
222 
223 
224  //--------------------------------------------------------------------------
226  /*
227  * @param aHounsfieldValue: the material (HU) value
228  * @return the material (HU) density
229  */
230  //--------------------------------------------------------------------------
231  static double getDensity(short aHounsfieldValue);
232 
233 
234  //--------------------------------------------------------------------------
237  /*
238  * @param aHounsfieldValue: the material (HU) value
239  * @param anEnergy: the energy
240  * @return the corresponding linear attenuation coefficient
241  */
242  //--------------------------------------------------------------------------
243  double getMassAttenuationTotal(double anEnergy) const;
244 
245 
246  //--------------------------------------------------------------------------
249  /*
250  * @param aHounsfieldValue: the material (HU) value
251  * @param anEnergy: the energy
252  * @return the corresponding linear attenuation coefficient
253  */
254  //--------------------------------------------------------------------------
255  double getLinearAttenuationTotal(short aHounsfieldValue, double anEnergy) const;
256 
257 
258  //--------------------------------------------------------------------------
261  /*
262  * @param aHounsfieldValue: the material (HU) value
263  * @param anEnergy: the energy
264  * @return the corresponding linear attenuation coefficient
265  */
266  //--------------------------------------------------------------------------
267  double getMu(short aHounsfieldValue, double anEnergy) const;
268 
269 
270  //--------------------------------------------------------------------------
274  /*
275  * @param anEnergy: the energy
276  * @return the corresponding linear attenuation coefficient
277  */
278  //--------------------------------------------------------------------------
279  double getLinearAttenuationTotal(double anEnergy) const;
280 
281 
282  //--------------------------------------------------------------------------
286  /*
287  * @param anEnergy: the energy
288  * @return the corresponding linear attenuation coefficient
289  */
290  //--------------------------------------------------------------------------
291  double getMu(double anEnergy) const;
292 
293 
294  //--------------------------------------------------------------------------
297  /*
298  * @param x: the sample
299  * @return the Compton scattering cross section value
300  */
301  //--------------------------------------------------------------------------
302  double getS(double x) const;
303 
304 
305  //--------------------------------------------------------------------------
307  /*
308  * @param aMaterial: the material to copy
309  * @return the newly created material
310  */
311  //--------------------------------------------------------------------------
312  TissueMaterial& operator=(const TissueMaterial& aMaterial);
313 
314 
315  //--------------------------------------------------------------------------
317  /*
318  * @param aMaterial: the material to check against
319  * @return true if the materials are the same, else return false
320  */
321  //--------------------------------------------------------------------------
322  bool operator==(const TissueMaterial& aMaterial) const;
323 
324 
325  //--------------------------------------------------------------------------
327  /*
328  * @param aMaterial: the material to check against
329  * @return true if the materials are different, else return false
330  */
331  //--------------------------------------------------------------------------
332  bool operator!=(const TissueMaterial& aMaterial) const;
333 
334 
335  //--------------------------------------------------------------------------
337  /*
338  * @param anOutputSream: the output stream
339  * @param aTissueMaterial: the material to output
340  * @return the output stream
341  */
342  //--------------------------------------------------------------------------
343  friend std::ostream & operator << (std::ostream& anOutputSream,
344  const TissueMaterial& aTissueMaterial);
345 
346 
347  //--------------------------------------------------------------------------
349  /*
350  * @param anInputSream: the input stream
351  * @param aTissueMaterial: the material to read
352  * @return the input stream
353  */
354  //--------------------------------------------------------------------------
355  friend std::istream & operator >> (std::istream& anInputSream,
356  TissueMaterial& aTissueMaterial);
357 
358 //******************************************************************************
359 protected:
360  void setMixture(const std::map<int, double>& aWeightSet);
361 
362 
363 //******************************************************************************
364 private:
365  // The minimum HU value of the material
366  short m_min_HU_value;
367 
368 
369  // The maximum HU value of the material
370  short m_max_HU_value;
371 
372 
373  // The mixture
374  Mixture m_mixture;
375 };
376 
377 
378 } // namespace gVirtualXRay
379 
380 
381 //******************************************************************************
382 #include "TissueMaterial.inl"
383 
384 
385 #endif // __TissueMaterial_h
double getMu(short aHounsfieldValue, double anEnergy) const
TissueMaterial(short aMinHUValue=0, short aMaxHUValue=0, double H=0, double C=0, double N=0, double O=0, double Na=0, double Mg=0, double P=0, double S=0, double Cl=0, double Ar=0, double K=0, double Ca=0, double Ti=0, double Cu=0, double Zn=0, double Ag=0, double Sn=0, double Fe=0, double I=0)
Default Constructor.
short getMinHUValue() const
Accessor on the minimum HU.
double getS(double x) const
double getMolarMass() const
Accessor on the molar mass of the material.
double getLinearAttenuationTotal(short aHounsfieldValue, double anEnergy) const
short getMaxHUValue() const
Accessor on the maximum HU.
friend std::istream & operator>>(std::istream &anInputSream, TissueMaterial &aTissueMaterial)
operator <<
void clear()
Remove all the atomic elements from the material.
TissueMaterial & operator=(const TissueMaterial &aMaterial)
Copy operator.
const std::map< int, double > & getWeightSet() const
Accessor on the weight of each atomic element.
bool operator!=(const TissueMaterial &aMaterial) const
Operator !=.
void setMixture(const std::map< int, double > &aWeightSet)
void setDensity(double aDensity)
Set the density for the mixture regardless of the HU value.
double getMassAttenuationTotal(double anEnergy) const
TissueMaterial is a class to manage a material.
Class to manage a material database. It implements the method as follows: Schneider W...
static double getDensity(short aHounsfieldValue)
Get the density for a given material (in HU).
bool operator==(const TissueMaterial &aMaterial) const
Operator ==.
Mixture is a class to manage a mixture (e.g. Ti90Al6V4).
Definition: Mixture.h:101
Class to manage a mixture (e.g. Ti90Al6V4).
friend std::ostream & operator<<(std::ostream &anOutputSream, const TissueMaterial &aTissueMaterial)
operator <<