EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
EB_Phantom Class Reference

A class to represent a single phantom for scoring dose in egs_brachy. More...

#include <phantom.h>

Inheritance diagram for EB_Phantom:
Inheritance graph
[legend]
Collaboration diagram for EB_Phantom:
Collaboration graph
[legend]

Public Types

enum  GeomDirections { XDIR , YDIR , ZDIR }
 

Public Member Functions

 EB_Phantom (EGS_Application *, EGS_BaseGeometry *, set< int > global_regions, int nsource, Publisher *publisher)
 EB_Phantom constructor.
 
 ~EB_Phantom ()
 EB_Phantom destructor.
 
void scoreTlen (int ir, EGS_Float dose, EGS_Particle *p)
 add tracklength dose to region ir
 
void scoreEdep (int ir, EGS_Float dose)
 add energy deposition dose to region ir
 
void getCurrentScore (int ireg, double &sum, double &sum2)
 get current tlen score for region
 
double getTlenNorm (int ireg)
 
void setDoseScale (EGS_Float)
 set dose scaling factor for output
 
void update (EB_Message message, void *data)
 
bool hasVolCor (int ireg)
 
EGS_Float getCorrectedVolume (int ireg)
 get uncorrected volume for a given region
 
EGS_Float getVolumeUncertainty (int ireg)
 get volume unc
 
EGS_Float getUncorrectedVolume (int ireg)
 get corrected volume for a given region
 
vector< int > getRegionsWithCorrections ()
 return a vector of all regions which were corrected
 
void setCorrectedVolume (int ir, double fraction, double unc=0)
 Allow user to tell phantom what the actual volume of a region is.
 
void enableTLenScoring ()
 enableTLenScoring must be called before simulation begins if you want to score dose with tracklength estimator in addition to tracklength scoring
 
void enableInteractionScoring ()
 enableInteractionScoring must be called before simulation begins if you want to score dose with interaction scoring in addition to tracklength scoring
 
void enableScatterScoring ()
 enableInteractionScoring must be called before simulation begins if you want to score dose with interaction scoring in addition to tracklength scoring
 
void setHistory (EGS_I64 current_case)
 set current history on scoring arrays for proper statistics
 
void setEffectiveHistories (EGS_Float current_case)
 set number of effective histories for normalizing scoring arrays
 
EGS_Float avgVoxelVol ()
 return average voxel volume
 
void outputVoxelInfo (string format)
 write voxel volumes, mass, desnity etc
 
void writeVoxelInfo (ostream &)
 write voxel info file
 
void outputVolumeCorrection (string format)
 intialize and output write voxel volumes to file
 
void writeVolumeCorrection (ostream &)
 write voxel volumes to file
 
void outputResults (int top_n=20, string output_3ddose="text", string output_egsphant="text", string output_voxinfo="text", string output_volcor="text")
 tell phantom to output its results.
 
bool globalRegIsInPhant (int global_reg)
 check whether a global region falls within this phantom
 
int globalToLocal (int global_reg)
 convert global region to local phantom region
 
int outputData (ostream *ofile)
 
int readData (istream *ifile)
 
void resetCounter ()
 
int addState (istream &ifile)
 
EGS_Float getRealRho (int ireg)
 return actual density for region
 
EGS_Float getRealMass (int ireg)
 return (corrected) real mass for region
 
EGS_Float getUncorrectedMass (int ireg)
 return uncorrected for region
 
void getResult (EGS_ScoringArray *, int ireg, string type, EGS_Float &r, EGS_Float &dr)
 get result for region from scoring array and normalize based on the type requested.
 
- Public Member Functions inherited from Subscriber
virtual ~Subscriber ()
 

Static Public Member Functions

static bool needsUserVolumes (const string &geom_type)
 function for checking whether a given geometry type requires user specified volumes
 
static bool canWrite3ddose (const string &geom_type)
 function for checking whether a given geometry type can output 3ddose files
 

Public Attributes

EGS_BaseGeometry * geometry
 the phantom geometry object
 
set< int > global_regions
 the set of all global regions contained in this phantom
 
int global_reg_start
 starting global region index for this phantom
 
int global_reg_stop
 ending global region index for this phantom
 
bool needs_user_geoms
 this phantom requires user specified geometries
 
bool can_write_3ddose
 this phantom can output 3ddose files
 

Private Member Functions

void outputDoseStats (EGS_ScoringArray *score, string type)
 write some stats about dose arrays
 
void outputTopDoses (int top_n, vector< RegionResult > region_results)
 write the top_n doses to console
 
void output3ddoseResults (string)
 write the phantom boundaries, doses and uncertainties to 3ddose file
 
void output3DDoses (ostream &out, EGS_ScoringArray *score, string type)
 write input scoring array to 3ddose file
 
void output3DBounds (ostream &out)
 write the phantom bounds to 3ddose file
 
void outputEGSPhant (string)
 initialize and write an egsphant file for this phantom
 
void writeEGSPhant (ostream &)
 write actual egsphant data to file for this phantom
 
string medIndex (int medium)
 get medium index 1-9A-Z
 
vector< RegionResultgetRegionResults ()
 create a vector of RegionResult structs which can then be sorted by dose value. used for output routines
 
void getScoringArrays (vector< EGS_ScoringArray * > &scores, vector< string > &types, vector< string > &descriptions)
 get all active scoring arrays, their types and descriptions
 
void getEGSdatScoringArrays (vector< EGS_ScoringArray * > &scores)
 get all active scoring arrays for writing to egsdat file
 

Private Attributes

EGS_Application * app
 Parent application instance. Required for constructing filenames.
 
EGS_ScoringArray * tlen_score
 Tracklength dose scoring array.
 
EGS_ScoringArray * edep_score
 Interaction scored dose scoring array.
 
EGS_ScoringArray * prim_score
 Tracklenth scored dose from primary particles.
 
EGS_ScoringArray * sscat_score
 Tracklenth scored dose from single scattered particles.
 
EGS_ScoringArray * mscat_score
 Tracklenth scored dose from multiple scattered particles.
 
int nsources
 
EGS_Float dose_scale
 
EGS_Float total_radiant_e
 
EGS_I64 cur_history
 
EGS_Float effective_histories
 
Publisherpublisher
 
std::map< int, double > corrected_volumes
 Corrected volume in a given region.
 
std::map< int, double > volume_uncertainty
 

Static Private Attributes

static const string autovol_phantom_geom_types [] = {"EGS_cSpheres", "EGS_cSphericalShell", "EGS_XYZGeometry", "EGS_XYZGeometryT", "EGS_RZ"}
 
static const string threeddose_geom_types [] = {"EGS_cSpheres", "EGS_cSphericalShell", "EGS_XYZGeometry", "EGS_XYZGeometryT", "EGS_RZ"}
 

Detailed Description

A class to represent a single phantom for scoring dose in egs_brachy.

A simulation may have an arbitrary number of these phantoms. This class handles scoring both tracklength and interaction scoring, outputing the top N doses to the console and output to 3ddose files.

Region numbers are all 'local' region numbers. That is the phantom does not know anything about its global region number. egs_brachy should convert to local region number before calling any method taking a region number as input.

Definition at line 71 of file phantom.h.

Member Enumeration Documentation

◆ GeomDirections

Enumerator
XDIR 

XDIR=0 x dir for rectilinear, r dir for spherical, z dir for cylindrical.

YDIR 

YDIR=1 y dir for rectilinear, r dir for cylindrical.

ZDIR 

ZDIR=2 z dir for rectilinear.

Definition at line 135 of file phantom.h.

Constructor & Destructor Documentation

◆ EB_Phantom()

EB_Phantom::EB_Phantom ( EGS_Application *  parent,
EGS_BaseGeometry *  geom,
set< int >  global_regions,
int  nsource,
Publisher publisher 
)

EB_Phantom constructor.

Definition at line 104 of file phantom.cpp.

◆ ~EB_Phantom()

EB_Phantom::~EB_Phantom ( )
inline

EB_Phantom destructor.

Definition at line 145 of file phantom.h.

Member Function Documentation

◆ addState()

int EB_Phantom::addState ( istream &  ifile)

Definition at line 996 of file phantom.cpp.

◆ avgVoxelVol()

EGS_Float EB_Phantom::avgVoxelVol ( )

return average voxel volume

Definition at line 855 of file phantom.cpp.

◆ canWrite3ddose()

bool EB_Phantom::canWrite3ddose ( const string &  geom_type)
static

function for checking whether a given geometry type can output 3ddose files

Definition at line 180 of file phantom.cpp.

◆ enableInteractionScoring()

void EB_Phantom::enableInteractionScoring ( )

enableInteractionScoring must be called before simulation begins if you want to score dose with interaction scoring in addition to tracklength scoring

Definition at line 215 of file phantom.cpp.

◆ enableScatterScoring()

void EB_Phantom::enableScatterScoring ( )

enableInteractionScoring must be called before simulation begins if you want to score dose with interaction scoring in addition to tracklength scoring

Definition at line 222 of file phantom.cpp.

◆ enableTLenScoring()

void EB_Phantom::enableTLenScoring ( )

enableTLenScoring must be called before simulation begins if you want to score dose with tracklength estimator in addition to tracklength scoring

Definition at line 208 of file phantom.cpp.

◆ getCorrectedVolume()

EGS_Float EB_Phantom::getCorrectedVolume ( int  ireg)

get uncorrected volume for a given region

Definition at line 314 of file phantom.cpp.

◆ getCurrentScore()

void EB_Phantom::getCurrentScore ( int  ireg,
double &  sum,
double &  sum2 
)

get current tlen score for region

Definition at line 332 of file phantom.cpp.

◆ getEGSdatScoringArrays()

void EB_Phantom::getEGSdatScoringArrays ( vector< EGS_ScoringArray * > &  scores)
private

get all active scoring arrays for writing to egsdat file

Definition at line 668 of file phantom.cpp.

◆ getRealMass()

EGS_Float EB_Phantom::getRealMass ( int  ireg)

return (corrected) real mass for region

Definition at line 291 of file phantom.cpp.

◆ getRealRho()

EGS_Float EB_Phantom::getRealRho ( int  ireg)

return actual density for region

Definition at line 285 of file phantom.cpp.

◆ getRegionResults()

vector< RegionResult > EB_Phantom::getRegionResults ( )
private

create a vector of RegionResult structs which can then be sorted by dose value. used for output routines

Definition at line 377 of file phantom.cpp.

◆ getRegionsWithCorrections()

vector< int > EB_Phantom::getRegionsWithCorrections ( )

return a vector of all regions which were corrected

Definition at line 194 of file phantom.cpp.

◆ getResult()

void EB_Phantom::getResult ( EGS_ScoringArray *  score,
int  ireg,
string  type,
EGS_Float &  r,
EGS_Float &  dr 
)

get result for region from scoring array and normalize based on the type requested.

Definition at line 349 of file phantom.cpp.

◆ getScoringArrays()

void EB_Phantom::getScoringArrays ( vector< EGS_ScoringArray * > &  scores,
vector< string > &  types,
vector< string > &  descriptions 
)
private

get all active scoring arrays, their types and descriptions

Definition at line 636 of file phantom.cpp.

◆ getTlenNorm()

double EB_Phantom::getTlenNorm ( int  ireg)

Definition at line 344 of file phantom.cpp.

◆ getUncorrectedMass()

EGS_Float EB_Phantom::getUncorrectedMass ( int  ireg)

return uncorrected for region

Definition at line 298 of file phantom.cpp.

◆ getUncorrectedVolume()

EGS_Float EB_Phantom::getUncorrectedVolume ( int  ireg)

get corrected volume for a given region

Definition at line 302 of file phantom.cpp.

◆ getVolumeUncertainty()

EGS_Float EB_Phantom::getVolumeUncertainty ( int  ireg)

get volume unc

Definition at line 323 of file phantom.cpp.

◆ globalRegIsInPhant()

bool EB_Phantom::globalRegIsInPhant ( int  global_reg)
inline

check whether a global region falls within this phantom

Definition at line 249 of file phantom.h.

◆ globalToLocal()

int EB_Phantom::globalToLocal ( int  global_reg)
inline

convert global region to local phantom region

Definition at line 254 of file phantom.h.

◆ hasVolCor()

bool EB_Phantom::hasVolCor ( int  ireg)

Definition at line 310 of file phantom.cpp.

◆ medIndex()

string EB_Phantom::medIndex ( int  medium)
private

get medium index 1-9A-Z

Definition at line 823 of file phantom.cpp.

◆ needsUserVolumes()

bool EB_Phantom::needsUserVolumes ( const string &  geom_type)
static

function for checking whether a given geometry type requires user specified volumes

Definition at line 166 of file phantom.cpp.

◆ output3DBounds()

void EB_Phantom::output3DBounds ( ostream &  out)
private

write the phantom bounds to 3ddose file

Definition at line 735 of file phantom.cpp.

◆ output3ddoseResults()

void EB_Phantom::output3ddoseResults ( string  format)
private

write the phantom boundaries, doses and uncertainties to 3ddose file

Definition at line 688 of file phantom.cpp.

◆ output3DDoses()

void EB_Phantom::output3DDoses ( ostream &  out,
EGS_ScoringArray *  score,
string  type 
)
private

write input scoring array to 3ddose file

Definition at line 758 of file phantom.cpp.

◆ outputData()

int EB_Phantom::outputData ( ostream *  ofile)

Definition at line 958 of file phantom.cpp.

◆ outputDoseStats()

void EB_Phantom::outputDoseStats ( EGS_ScoringArray *  score,
string  type 
)
private

write some stats about dose arrays

Definition at line 408 of file phantom.cpp.

◆ outputEGSPhant()

void EB_Phantom::outputEGSPhant ( string  format)
private

initialize and write an egsphant file for this phantom

Definition at line 833 of file phantom.cpp.

◆ outputResults()

void EB_Phantom::outputResults ( int  top_n = 20,
string  output_3ddose = "text",
string  output_egsphant = "text",
string  output_voxinfo = "text",
string  output_volcor = "text" 
)

tell phantom to output its results.

Definition at line 259 of file phantom.cpp.

◆ outputTopDoses()

void EB_Phantom::outputTopDoses ( int  top_n,
vector< RegionResult region_results 
)
private

write the top_n doses to console

Definition at line 567 of file phantom.cpp.

◆ outputVolumeCorrection()

void EB_Phantom::outputVolumeCorrection ( string  format)

intialize and output write voxel volumes to file

Definition at line 934 of file phantom.cpp.

◆ outputVoxelInfo()

void EB_Phantom::outputVoxelInfo ( string  format)

write voxel volumes, mass, desnity etc

Definition at line 897 of file phantom.cpp.

◆ readData()

int EB_Phantom::readData ( istream *  ifile)

Definition at line 977 of file phantom.cpp.

◆ resetCounter()

void EB_Phantom::resetCounter ( )

Definition at line 1022 of file phantom.cpp.

◆ scoreEdep()

void EB_Phantom::scoreEdep ( int  ir,
EGS_Float  dose 
)

add energy deposition dose to region ir

Definition at line 155 of file phantom.cpp.

◆ scoreTlen()

void EB_Phantom::scoreTlen ( int  ir,
EGS_Float  dose,
EGS_Particle *  p 
)

add tracklength dose to region ir

Definition at line 133 of file phantom.cpp.

◆ setCorrectedVolume()

void EB_Phantom::setCorrectedVolume ( int  ir,
double  fraction,
double  unc = 0 
)

Allow user to tell phantom what the actual volume of a region is.

Definition at line 202 of file phantom.cpp.

◆ setDoseScale()

void EB_Phantom::setDoseScale ( EGS_Float  scale)

set dose scaling factor for output

add energy deposition dose to region ir

Definition at line 162 of file phantom.cpp.

◆ setEffectiveHistories()

void EB_Phantom::setEffectiveHistories ( EGS_Float  current_case)

set number of effective histories for normalizing scoring arrays

Definition at line 253 of file phantom.cpp.

◆ setHistory()

void EB_Phantom::setHistory ( EGS_I64  current_case)

set current history on scoring arrays for proper statistics

Definition at line 234 of file phantom.cpp.

◆ update()

void EB_Phantom::update ( EB_Message  message,
void *  data 
)
virtual

Implements Subscriber.

Definition at line 124 of file phantom.cpp.

◆ writeEGSPhant()

void EB_Phantom::writeEGSPhant ( ostream &  out)
private

write actual egsphant data to file for this phantom

Definition at line 781 of file phantom.cpp.

◆ writeVolumeCorrection()

void EB_Phantom::writeVolumeCorrection ( ostream &  out)

write voxel volumes to file

Definition at line 922 of file phantom.cpp.

◆ writeVoxelInfo()

void EB_Phantom::writeVoxelInfo ( ostream &  out)

write voxel info file

Definition at line 865 of file phantom.cpp.

Member Data Documentation

◆ app

EGS_Application* EB_Phantom::app
private

Parent application instance. Required for constructing filenames.

Definition at line 78 of file phantom.h.

◆ autovol_phantom_geom_types

const string EB_Phantom::autovol_phantom_geom_types = {"EGS_cSpheres", "EGS_cSphericalShell", "EGS_XYZGeometry", "EGS_XYZGeometryT", "EGS_RZ"}
staticprivate

Definition at line 97 of file phantom.h.

◆ can_write_3ddose

bool EB_Phantom::can_write_3ddose

this phantom can output 3ddose files

Definition at line 297 of file phantom.h.

◆ corrected_volumes

std::map<int, double> EB_Phantom::corrected_volumes
private

Corrected volume in a given region.

Definition at line 95 of file phantom.h.

◆ cur_history

EGS_I64 EB_Phantom::cur_history
private

Definition at line 90 of file phantom.h.

◆ dose_scale

EGS_Float EB_Phantom::dose_scale
private

Definition at line 87 of file phantom.h.

◆ edep_score

EGS_ScoringArray* EB_Phantom::edep_score
private

Interaction scored dose scoring array.

Definition at line 80 of file phantom.h.

◆ effective_histories

EGS_Float EB_Phantom::effective_histories
private

Definition at line 91 of file phantom.h.

◆ geometry

EGS_BaseGeometry* EB_Phantom::geometry

the phantom geometry object

Definition at line 284 of file phantom.h.

◆ global_reg_start

int EB_Phantom::global_reg_start

starting global region index for this phantom

Definition at line 293 of file phantom.h.

◆ global_reg_stop

int EB_Phantom::global_reg_stop

ending global region index for this phantom

Definition at line 294 of file phantom.h.

◆ global_regions

set<int> EB_Phantom::global_regions

the set of all global regions contained in this phantom

Definition at line 291 of file phantom.h.

◆ mscat_score

EGS_ScoringArray* EB_Phantom::mscat_score
private

Tracklenth scored dose from multiple scattered particles.

Definition at line 84 of file phantom.h.

◆ needs_user_geoms

bool EB_Phantom::needs_user_geoms

this phantom requires user specified geometries

Definition at line 296 of file phantom.h.

◆ nsources

int EB_Phantom::nsources
private

Definition at line 86 of file phantom.h.

◆ prim_score

EGS_ScoringArray* EB_Phantom::prim_score
private

Tracklenth scored dose from primary particles.

Definition at line 81 of file phantom.h.

◆ publisher

Publisher* EB_Phantom::publisher
private

Definition at line 93 of file phantom.h.

◆ sscat_score

EGS_ScoringArray* EB_Phantom::sscat_score
private

Tracklenth scored dose from single scattered particles.

Definition at line 82 of file phantom.h.

◆ threeddose_geom_types

const string EB_Phantom::threeddose_geom_types = {"EGS_cSpheres", "EGS_cSphericalShell", "EGS_XYZGeometry", "EGS_XYZGeometryT", "EGS_RZ"}
staticprivate

Definition at line 101 of file phantom.h.

◆ tlen_score

EGS_ScoringArray* EB_Phantom::tlen_score
private

Tracklength dose scoring array.

Definition at line 79 of file phantom.h.

◆ total_radiant_e

EGS_Float EB_Phantom::total_radiant_e
private

Definition at line 89 of file phantom.h.

◆ volume_uncertainty

std::map<int, double> EB_Phantom::volume_uncertainty
private

Definition at line 96 of file phantom.h.


The documentation for this class was generated from the following files: