1 / 40

Optimization of an external beam radiotherapy treatment using GAMOS/Geant4 Pedro Arce

Optimization of an external beam radiotherapy treatment using GAMOS/Geant4 Pedro Arce Juan Ignacio Lagares Daniel Pérez-Astudillo (CIEMAT, Madrid) John Apostolakis Gabriele Cosmo (CERN, Geneva) World Congress 2009, Munich, 12 September 2009. Outline. 3. GAMOS usage Documentation

tibor
Download Presentation

Optimization of an external beam radiotherapy treatment using GAMOS/Geant4 Pedro Arce

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Optimization of an external beam radiotherapy treatment using GAMOS/Geant4 Pedro Arce Juan Ignacio Lagares Daniel Pérez-Astudillo (CIEMAT, Madrid) John Apostolakis Gabriele Cosmo (CERN, Geneva) World Congress 2009, Munich, 12 September 2009

  2. Outline 3. GAMOS usage • Documentation • Tutorials • Installation • Summary • Future prospects 1. GAMOS radiotherapy framework • RT simulation in Geant4 • GAMOS RT: geometry • GAMOS RT: source • GAMOS RT: scoring • GAMOS RT: phase space files • GAMOS RT: dose in phantoms 2. OPTIMISATION • Automatic optim. physics cuts • Geant4 EM physics parameters • Fast navigation in phantoms • CPU time comparison BEAMnrc / DOSXYZnrc • CPU time reports • Particle spliting

  3. GAMOS Radiotherapy framework

  4. Radiotherapy simulation with GEANT4 • GEANT4 is a very powerful and flexible toolkit • Outstanding geometry and visualisation • Well proven physics • Big flexibility • Many thousands of users… • But it is not easy for a beginner to simulate a radiotherapy treatment • Everything requires writing C++, and a good knowledge of GEANT4 details • Very few tools specific for radiotherapy • No optimisation specific for radiotherapy • GAMOS provides a Geant4-based framework easy to use and flexible • EASY: With a few simple commands you can simulate a full radiotherapy treatment using a text file • FLEXIBLE: Based on plug-in technology. • No predefined components, they are selected ‘on the fly’, by the user commands • If you have a new requirement not covered by GAMOS, it is very easy to plug your code into the GAMOS framework and select your code with a user command • + several tools have been developed to optimise a radiotherapy application

  5. GAMOS Radiotherapy framework Geometry Any accelerator geometry can be built with a simple geometry format • Based on solids (box, tube, polycone, ..) + their union/substraction/intersection • Any material can be used (+400 predefined for user convenience) • Several modules to simplify complicated elements (jaws, applicators, MLCs) // PRIMARY COLLIMATOR :P PC_ZMIN 1.6*cm :P PC_ZMAX 7.6*cm :VOLU “primary collimator" TUBE 0 10*cm ($PC_ZMAX-$PC_ZMIN)/2. G4_W :VOLU "primary collimator_hole" CONE 0. 4. 0. 20. ($PC_ZMAX-$PC_ZMIN)/2. G4_AIR // continuation line :PLACE "primary collimator" 1 expHall RM0 0. 0. $PC_ZMIN+$PC_ZMAX)/2. :PLACE "primary collimator_hole" 1 "primary collimator" RM0 0. 0. 0. :COLOR "primary collimator" 1. 0. 1. // RGB color Movements: • Any volume can be moved with a user command

  6. GAMOS Radiotherapy framework Source (primary generator) Flexible source generator: • One or several particles of any type: photon, electron, positron, proton, neutron, isotopes, ... • Each one can be assigned a distribution of position, direction, energy and time • The usual medical physics distributions are available • Users can easily add a new one (plug-in’s) /gamos/generator/directionDist my_source GmGenerPositionDiscGaussian 1*mm /gamos/generator/timeDist my_source GmGenerTimeDecay

  7. GAMOS Radiotherapy framework Scoring • Scoring is an important part of your simulation  powerful and flexible framework: • Many possible quantities can be scored in one or several volumes • ● Dose ● Deposited energy ● Flux (in/out/passage) • ● Current (in/out/passage) ● Charge ● Step length • ● Number of particles ● Number of interactions ● Number of 2ary particles • ● Number of steps ● Minimum kinetic energy ● … • For each scored quantity one or several filters can be used (almost 100 available) • Only electrons, only particles in a certain energy range, … • Several ways to classify the different scores • One different score for each different volume name, or volume copy, or energy bin, … • Results can be printed in one or several formats for each scored quantity • Standard output, text file, binary file, histograms • All scored quantities can be calculated with/without errors • All scored quantities can be calculated per event or per job • Taking into account correlations from particles from same event • Everything managed with user commands

  8. GAMOS Radiotherapy framework Phase space files VRML view of VARIAN 6000 accelerator Write phase space files at one or several Z planes • Energy, position, direction • Save extra info: • Regions particle traversed • Regions particle created • Regions particle interacted • Particle origin Z • BIG FLEXIBILITY • More can be easily added (they are plug-in’s) • User selects which infos and how many bytes each one occupies Use phase space files as generator • Displace or rotate phase space particles • Reuse phase space particles • Optional automatic calculation of reuse number • Optional mirroring in X, Y or XY • Recycle phase space files • Command for skipping of first N events • Command for optional histograms of particles read • Filter particles by extra info • Also read EGSnrc phase space format

  9. GAMOS Radiotherapy framework Dose scoring in phantoms • Simple voxelised phantoms ones with a few user commands • Read DICOM files • Read GEANT4 format (example advanced/medical/DICOM) • Read EGS format • Several outputs • standard output • text file • binary file • histograms • Displace or rotate read-in phantom geometry • PTV/CTV/GTV management • Many filters to write several dose files in the same job • We have developed a tool that allows to insert objects in phantom geometries and produce the interactions in them • Realistic simulation of brachytherapy sources or ionisation chambers inside phantoms! gMocren visualisation of DICOM geometry and tracks

  10. Dose visualisation IMRT dose visualisation with CIEMAT’s tool (MIRAS) gMocren view of GEANT4 geometry and tracks transported with the new algorithm gMocren view of GEANT4 geometry and tracks transported with the new algorithm gMocren view of GEANT4 geometry and tracks transported with the new algorithm gMocren view of GEANT4 geometry and tracks transported with the new algorithm gMocren view of GEANT4 geometry and tracks transported with the new algorithm

  11. Optimisation: physics cuts

  12. Optimisation: physics cuts • Two kind of physics cuts in Geant4: • Production cuts • Limit secondary production for ionisation and bremsstrahlung • User Limits: • Limit step size: better done tuning EM physics parameters • Limit track length: not relevant in accelerator simulation • Limit time of flight: not relevant in accelerator simulation • Kinetic energy/range minimum (stop particle if kinE/range below a limit): useful to kill particles when energy not enough to reach target • Better use range as more uniform for different regions • Better use kinetic energy as more efficient calculation • GAMOS solution: use kinetic energy inside but user provides it as range through a command • Different physics cuts per particle and region (group of volumes) can be defined through user commands

  13. Optimisation: setting best cuts • Normally people want that optimising the cuts produces only few % (or less) difference in results • need to run very big statistics • Cuts can be very different for different particle/regions, and a cut in one particle/region may affect another • need to run many sets of cut values RESULT: usually people think it is too complicated • Do not optimise cuts • Just copy the cuts from someone, which usually are not the best one for them In GAMOS we propose an Automatic determination ofbest production cuts or user limits in one job

  14. Accelerator: Automatic optim. prod cuts Which is the highest cuts we can use without decreasing the number of particles reaching the phase space plane? In GAMOS we use an ‘inverse reasoning’: • For each particle reaching the plane • Get range of particle when it was created • Get range of mother particle where it was created • Do it consecutively for all ancestors • Make statistics of all these ranges, per particle, region and process • At EndOfRun print statistics of which is the minimum range per particle, region and process • You know that if you use a bigger production cut at least one particle would be killed and this particle or one of its children would not reach the phase space

  15. Accelerator: Automatic optim. prod cuts • Often you allow some small % loss of particles.. • Make histograms of all ranges per particle, region and proces • Provide an script so that for a given cut it gives you the proportion of particles killed • Be aware of double counting (very low: < 1%) • Make histogram of minimum range (one entry per particle + particle ancestors) and use it for statistics of % particles killed • Check distributions of killed particles How to use it in GAMOS: • Add one user command in one job /gamos/userAction GmProdCutsStudy RTPhaseSpaceFilter Similar approach for user limits… log10(range) of gammas created at target that reach the patient or produce a secondary that reaches the patient CUT

  16. Dose: Automatic optim. prod cuts In GAMOS we use an ‘inverse reasoning’: • Compute dose due to particles that would be killed with a certain cut (and all their daughters) • When a particle is killed dose is deposited locally  only count dose in voxels different that where particle is killed by cut • GAMOS can estimate in one job the dose with several different cut values • Use GAMOS filters /gamos/filter ProdCutFilter GmProdCutOutsideVoxelFilter 10.*mm 1.*mm /gamos/scoring/addFilter2Scorer ProdCutFilter PDDscorerPC10.1. • It may happen that dose is small but distributed in a different manner than total dose (produces bias) • Use GAMOS dose histograms to check dose shape Similar approach for user limits… Percent Depth Dose curve for all particles and particles rejected by cut 1mm/e- 10 mm/gamma

  17. RESULTS: Optim. production cuts We have simulated a VARIAN accelerator • Plane at 100 cm from the source and of halfwidth 100 cm in X and Y. We have computed the dose in a water phantom of 104 voxel • Select the maximum cut values that change the total dose << 1 % A command serves to apply production cuts to other processes, not only ionisation & bremsstrahlung (not needed but useful) • We gain an extra 3% in CPU time RANGE REJECTION: • Automatic procedure gives you also information on number of particles that would be killed by range rejection • Does not improve CPU significatively (few particles are killed by it) CPU gain Accelerator: 20% w.r..t cuts ‘standard’ in BEAMnrc/DOSXYZnrc(700 keV for e-/e+, 10 keV for gamma) Dose: 0-30% w.r..t cuts ‘standard’ in BEAMnrc/DOSXYZnrc

  18. Optimisation: Geant4 electromagnetic physics parameters

  19. Select EM physics parameters In Geant4 there is a long list of parameters that a user can change... METHOD: • Start with default values which have been found good for radiotherapy simulations • They are quite conservative • Except dE/dx and lambda tables bin size • Change values to less precision and watch CPU time • Only consider those for which CPU gain is not neglibible • Try also higher precision to check • Watch for change in dose (look also at change in phase space) • OUTCOME: • Increase number of bins in dE/dx and lambda tables • Switch off energy loss fluctuations • Parameters that change charged particles step size vs precision • Option 1: msc range factor = 0.05 • Option2: Rover range = 0.8 • Lambda factor = 0.2 • Msc step limitation = Minimal Detailed study can be found at http://fismed.ciemat.es/GAMOS/RToptim

  20. Number of bins dE/dx and lambda tables Number of bins of dE/dx and lambda tables: 120  1200 • No change in Emax (for 10 MeV 500 bins would have same effect) PDD: new/old Phase space change: About 1 % less particles, uniformly distributed in E and space Dose change: 0.6 – 0.8 % decrease in dose, increasing with energy CPU gain: -1 % default cuts 0% optimised cuts CONCLUSIONS:we recommend using new values

  21. No energy loss fluctuations • Phase space: • Reduces substantially number of low energy (< 0.2 MeV particles) • Dose: • Increases dose by 0.2 - 0.3 % quite uniformly • CPU gain: 13 % default cuts • 1 % optimised cuts • CONCLUSIONS:acceptable, but not really needed phase space E: new/old PDD: new/old

  22. Fewer e-/e+ steps option 1 • Phase space: • About 1.5 % more particles, uniformly distributed in E and space • Dose: • 1.3 – 1.4 % increase in dose, quite uniformly • CPU gain: 29 % default cuts • 12 % optimised cuts • CONCLUSIONS:acceptable, with caution • (if change in dose is fully uniform it does not matter) PDD: new/old

  23. Fewer e-/e+ steps option 2 • Phase space: • About 1.8 % more particles, uniformly distributed in E and space • Dose: • ~2 % increase in dose, bigger at low Z • CPU gain: 47 % default cuts • 20 % optimised cuts • CONCLUSIONS:not acceptable, too big change, not uniform PDD: new/old

  24. Optimisation: Fast dose calculation in phantom voxels

  25. Fast voxel navigation algorithm • Indexes voxels and voxel materials • Takes profit of regular geometry to quickly locate distance to next voxel and next voxel ID • Voxel frontiers are skipped ‘on the fly’ if voxels share same material • Distributes dose along voxels traversed taking into account correcctions in energy loss and multiple scattering due to energy loss along path • 4-6 times faster than other Geant4 algorithm • - Depends on number of voxels and number of materials CPU Time spent on transporting 1000 PARTICLES in 4.5 million-voxel phantom using diffferent Geant4 algorithms

  26. Optimisation: CPU time comparison with BEAMnrc/DOSXYZnrc

  27. CPU time comparison with BEAMnrc VARIAN 2100 gamma accelerator: 106 events on Pentium Dual-Core 3 GHz * Same parameters as for 6MeV

  28. CPU time comparison with DOSZXYnrc Dose in 104 5x5x3 mm water phantom: 106 events on Pentium Dual-Core 3 GHz Dose in 4.5 106 patient, 23 materials: 106 events on Pentium Dual-Core 3 GHz Dependency with number of materials • DOSXYZnrc: • Only 4 densities: 297 s • All densities: 300 s • GEANT4: • 4 materials: 166 s • 23 materials: 274 s • 68 materials: 360 s • 196 materials: 454 s • Need to implement density-changing materials in Geant4…

  29. Optimisation: time reports • User commands to get CPU time report • By particle, energy bins, volume, region (or combination of them) Just add a user command, for example: /gamos/userAction GmTimeStudyUA GmClassifierByParticle GmClassifierByEnergy • gamma/0.001-0.01: User=0.01 Real=0 Sys=0 • gamma/0.01-0.1: User=2.01 Real=2.45 Sys=0.27 • gamma/0.1-1: User=19.12 Real=22.05 Sys=1.51 • gamma/1-10: User=4.25 Real=5.4 Sys=0.3 • e-/0.0001-0.001: User=0.07 Real=0.1 Sys=0 • e-/0.001-0.01: User=0.54 Real=0.69 Sys=0.06 • e-/0.01-0.1: User=4.71 Real=5.41 Sys=0.38 • e-/0.1-1: User=15.59 Real=18.19 Sys=1.79 • e-/1-10: User=82.83 Real=98.62 Sys=7.45 • Example to get detailed gprof profiling about where (in which methods) the time is spent • Time spent in a method and integrated time in all the methods called by it

  30. Optimisation: Particle splitting

  31. Particle splitting UNIFORM BREMSSTRAHLUNG SPLITTING • All bremmstrahlung photons are replicated the same number of times Z-PLANE DIRECTION BREMSSTRAHLUNG SPLITTING • User defines a Z plane with limits in X & Y (represents entrance of phantom) • Same as uniform BS, but if gamma does not aim at Z plane, Russian roulette is played EQUAL-WEIGHT SPLITTING • Similar as Z-plane direction BS, but splits every gamma produced, not only from bremsstrahlung • Russian roulette is played with e-/e+, so that very few reach Z plane • Aim is that all particles that reach phantom have the same weight • Based on EGSnrc DBS technique

  32. Particle splitting: RESULTS UNIFORM BREMSSTRAHLUNG SPLITTING • Maximum efficiency gain: 2.2 Z-PLANE DIRECTION BREMSSTRAHLUNG SPLITTING • Maximum efficiency gain: 6.5 EQUAL-WEIGHT SPLITTING • Maximum efficiency gain:45 • EGSnrc results with same accelerator: gain 80 • Algorithm in GAMOS is not fully implemented yet…

  33. Documentation, installation, usage

  34. Documentation • User’s Guide: • Installation • All available functionality • How to provide new functionality by creating a plug-in • Examples: • A simple one and a few more complicated ones /gamos/setParam GmGeometryFromText:FileName mygeom.txt /gamos/geometry GmGeometryFromText /gamos/physics GmEMPhysics /gamos/generator GmGenerator /run/initialize /gamos/generator/addSingleParticleSource my_source gamma 6.*MeV /run/beamOn 1000

  35. Tutorials • Four tutorials • Radiotherapy tutorial • PET tutorial • Histograms and scorers tutorial • plug-in tutorial • Propose about 15 exercises each • Explained in detail • Increasing in difficulty • Reference output provided • Solutions provided • 4 GAMOS tutorial courses have been given in Europe and America • About 70 attendees • Next tutorial in European School of Medical Physics (October-November 2009)

  36. Installation • GAMOS is freely available from CIEMAT web • User registers and downloads installation scripts • We provide a no-choice but very easy way: one-line installation • sh installGamos.csh/sh $HOME/gamos • No need to manually download and install packages • No need to define enviromental variables • Checks that your system has the needed components • Downloads, installs and compiles CLHEP, Geant4, (optionally) ROOT and GAMOS in one directory • GAMOS compiles = Geant4 • Optionally an expert user can make several choices • Current installation tested on Scientific Linux, Fedora Core, Debian and Ubuntu, and on MacOS • > 50 tests are run to check each new release

  37. Summary And Future prospects

  38. Summary • We have implemented in GAMOS many user commands & analysis tools to make easy an radiotherapy accelerator simulation • many GAMOS tools are already being used for other fields (PET, brachytherapy, microdosimetry, damage in electronics, …) • We have developed several tools to optimise the CPU time of an radiotherapy simulation • Automatically optimise production cuts and user limits • Optimisation of Geant4 electromagnetic physics parameters • Do detailed time studies with a user command • Algorithm for fast navigation in voxelised phantoms • Particle splitting techniques for acceleartor simulation • We improve CPU time by a factor of 100 w.r.t. ‘bare’ Geant4 • We get similar CPU times as BEAMnrc / DOSXYZnrc

  39. Future prospects • Improve particle splitting (factor ~ 2 - 3) • Implement history repetition (factor ~ 2 - 5) • Fast Monte Carlo (factor ~ 10 - 100) • Provide standard and fast Monte Carlo in the same framework • Thanks to Geant4 flexibility • Everybody is invited to contribute!

  40. http://fismed.ciemat.es/GAMOS

More Related