71 #ifndef __ElementSet_h 75 #ifndef __FileDoesNotExistException_h 79 #ifndef __OutOfBoundsException_h 87 #ifndef __PythonSingleton_h 107 m_bin_total_energy_lower_threshold(1 *
eV),
108 m_use_poisson_noise(false),
109 m_number_of_photons_per_pixel(0),
111 m_tube_angle_in_degrees(12),
114 m_use_xpecgen(false),
115 m_need_to_update_tube_spectrum(false)
252 for (std::vector<SpectrumRecord>::const_iterator ite_beam_spectrum(
m_beam_spectrum.begin());
256 total_energy += ite_beam_spectrum->m_energy * ite_beam_spectrum->m_photon_number;
259 return (total_energy);
294 for (std::vector<SpectrumRecord>::iterator ite_beam_spectrum(
m_beam_spectrum.begin());
298 ite_beam_spectrum->m_photon_number *= old_to_new;
367 for (std::vector<SpectrumRecord>::const_iterator ite_beam_spectrum(
m_beam_spectrum.begin());
396 #ifndef HAS_PythonLibs 397 LOGGER.
logWarning(
"PythonLibs support was disabled when the library was compiled. This function ") <<
398 __FUNCTION__ <<
" in " << __FILE__ <<
" may have no visible effect." << std::endl;
420 #ifndef HAS_PythonLibs 421 LOGGER.
logWarning(
"PythonLibs support was disabled when the library was compiled. This function ") <<
422 __FUNCTION__ <<
" in " << __FILE__ <<
" may have no visible effect." << std::endl;
444 #ifndef HAS_PythonLibs 445 LOGGER.
logWarning(
"PythonLibs support was disabled when the library was compiled. This function ") <<
446 __FUNCTION__ <<
" in " << __FILE__ <<
" may have no visible effect." << std::endl;
468 #ifndef HAS_PythonLibs 469 LOGGER.
logWarning(
"PythonLibs support was disabled when the library was compiled. This function ") <<
470 __FUNCTION__ <<
" in " << __FILE__ <<
" may have no visible effect." << std::endl;
484 #ifndef HAS_PythonLibs 485 LOGGER.
logWarning(
"PythonLibs support was disabled when the library was compiled. This function ") <<
486 __FUNCTION__ <<
" in " << __FILE__ <<
" may have no visible effect." << std::endl;
494 const double& aThickness)
498 std::pair<unsigned int, RATIONAL_NUMBER>(
506 #ifndef HAS_PythonLibs 507 LOGGER.
logWarning(
"PythonLibs support was disabled when the library was compiled. This function ") <<
508 __FUNCTION__ <<
" in " << __FILE__ <<
" may have no visible effect." << std::endl;
516 const double& aThickness)
519 m_filtration.push_back(std::pair<unsigned int, RATIONAL_NUMBER>(aMaterial, aThickness));
523 #ifndef HAS_PythonLibs 524 LOGGER.
logWarning(
"PythonLibs support was disabled when the library was compiled. This function ") <<
525 __FUNCTION__ <<
" in " << __FILE__ <<
" may have no visible effect." << std::endl;
564 LOGGER.
logNow(
"Use Spekpy to generate beam spectrums from tube voltages.") << std::endl;
571 LOGGER.
logWarning(
"Spekpy is not installed, try Xpecgen instead.") << std::endl;
578 LOGGER.
logNow(
"Use Xpecgen to generate beam spectrums from tube voltages.") << std::endl;
603 LOGGER.
logNow(
"Use Xpecgen to generate beam spectrums from tube voltages.") << std::endl;
610 LOGGER.
logWarning(
"Xpecgen is not installed, try Spekpy instead.") << std::endl;
617 LOGGER.
logNow(
"Use Spekpy to generate beam spectrums from tube voltages.") << std::endl;
RATIONAL_NUMBER getVoltage() const
void setTubeAngle(const RATIONAL_NUMBER &anAngle)
unsigned int getNumberOfPhotonCountingBands()
RATIONAL_NUMBER getNumberOfPhotons()
Accessor on the total number of photons per pixel when Poisson noise is enable.
std::vector< std::pair< unsigned int, RATIONAL_NUMBER > > m_filtration
RATIONAL_NUMBER m_number_of_photons_per_pixel
void createSpectrumFromVoltage()
const std::vector< std::pair< unsigned int, RATIONAL_NUMBER > > & getFiltration() const
SpectrumRecord is a class to handle a record of the X-Ray beam, i.e. an energy bin (number of photons...
void setmAs(const RATIONAL_NUMBER &an_mAs)
void setVoltage(const RATIONAL_NUMBER &aVoltage)
RATIONAL_NUMBER m_energy
The energy of the photons.
bool usingXpecgen() const
Singleton to handle the initialisation and release of Python.
bool usePoissonNoise() const
Check if Poisson noise for the energy fluence is enable or disable.
bool addChannel(const RATIONAL_NUMBER &aNumberOfPhotons, const RATIONAL_NUMBER &anIncidentEnergy)
Add an energy channel to the beam.
void enablePoissonNoise()
Enable Poisson noise for the energy fluence.
RATIONAL_NUMBER m_photon_number
The number of photons.
Class to manage a table of elements in material.
RATIONAL_NUMBER m_voltage
void initialise(const char *aFileName, const RATIONAL_NUMBER &aUnit, unsigned int aMergeChannelFlag=1)
Initialise the X-ray beam specturm with a polychromatic spectrum.
void sort()
Sort the spectrum in ascending energy.
void addFilter(const std::string &aMaterial, const double &aThickness)
RATIONAL_NUMBER getmAs() const
Class to handle exceptions when trying to open a read-only file that is not accessible.
RATIONAL_NUMBER m_bin_total_energy_lower_threshold
std::vector< RATIONAL_NUMBER > m_photon_count_bands
void setNumberOfPhotons(RATIONAL_NUMBER aNumberOfPhotons)
Set the total number of photons per pixel when Poisson noise is enable.
RATIONAL_NUMBER getTubeAngle() const
static ElementSet & getInstance()
std::vector< SpectrumRecord > m_beam_spectrum
Set of photon bins.
float RATIONAL_NUMBER
Type of data used to store real numbers.
const double eV
electronvolt
void clear()
Remove all the energy channels from the beam and all its parameters.
std::ostream & logWarning(const std::string &aMessage="")
void clearSpectrumOnly()
Remove all the energy channels from the beam.
void disablePoissonNoise()
Disable Poisson noise for the energy fluence.
RATIONAL_NUMBER getTotalEnergy()
Accessor on a total energy of the beam.
const std::vector< RATIONAL_NUMBER > & getPhotonCountingBands()
XRayBeam()
Default constructor.
std::ostream & logNow(const std::string &aMessage="")
static PythonSingleton & getInstance()
const SpectrumRecord & getEnergyChannel(unsigned int anID)
Accessor on a given energy bin.
void setFiltration(const std::vector< std::pair< unsigned int, RATIONAL_NUMBER > > &aSetOfFilters)
void activatePhotonCountingBand(unsigned int aBand)
Class to handle exceptions when accessing an array cell that is not accessible, i.e. out of bounds memory access.
unsigned int getEnergyChannelNumber()
Accessor on the number of bins in the spectrum.
void setBinTotalEnergyCutoff(const RATIONAL_NUMBER &aThreshold)
Set a threshold to discard energy bins with a tiny amount of energy.
bool m_need_to_update_tube_spectrum
RATIONAL_NUMBER m_tube_angle_in_degrees
std::vector< std::vector< SpectrumRecord > > m_beam_spectrum_for_photon_count_detector
Set of photon bins.