S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004 Brachytherapy exercise.

27
S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004 http://cern.ch/geant4/ geant4.html http://www.ge.infn.it/geant4 Brachytherapy Brachytherapy exercise exercise

Transcript of S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004 Brachytherapy exercise.

Page 1: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

S. Guatelli,CPS Innovations,

Knoxville, 13th -21st January 2004

http://cern.ch/geant4/geant4.htmlhttp://www.ge.infn.it/geant4

Brachytherapy exerciseBrachytherapy exercise

Page 2: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Plan of this exercise

Learn the basics of how to build a simple user application– Mandatory user classes– Optional user actions

Learn the basics of how to use interactive facilities– User Interface– Visualisation– Histogramming

How we’ll proceed– Illustrate design and implementation basic features– Propose a simple exercise on the same topic– Show the solution

Page 3: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

User requirements (main ones listed only)

The user shall be able to define a radioactive source in a phantom

The user shall be able to define initial position, direction and energy spectra of primary particles

The user shall be able to change the absorber material of the phantom

The user shall be able to define electrons, positrons, photons

The user shall be able to define the electromagnetic processes involved

The user shall be able to calculate the total absorbed energy in the phantom– 3D distribution in the volume– 2D distribution in the plane containing the source

The dose should be collected in 1. mm wide voxels

The user shall be able to visualise the geometry involved and the trajectories of the particles

The application provides the simulation of dose distribution of brachytherapic sources in a phantom

Page 4: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

OOAD

Page 5: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Implementation

Exercise Brachy– header files in include/*.hh, source code in src/ *.cc– main in Brachy.cc– macro: VisualisationMacro.mac

Classes– BrachyDetectorConstruction– BrachyPrimaryGeneratorAction– BrachyPhysicsList– BrachyRunAction– BrachyEventAction- BrachyVisManager- ….

Page 6: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

How to run

Define necessary environment variables

– source setup.csh

Define analysis

– setenv G4ANALYSIS_USE 1

How to compile and link

– gmake

How to run

– $G4WORKDIR/bin/Linux/Brachy Default macro :VisualisationMacro.mac

Page 7: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Part 1Part 1

Use case: Use case: model a radioactive source in a phantommodel a radioactive source in a phantom

1. Use case: model a 192Ir brachytherapy seed

2. Use case: model a water phantom

3. Use case: visualise the geometry

4. Exercise: model a soft tissue phantom

5. Exercise: select phantom material from the UI

6. Exercise: model a 125I brachytherapy seed

7. Use case: model the radioactive source as a primary generator of monochromatic photons

8. Exercise: model the spectrum of a 125I source

Page 8: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.
Page 9: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Run Brachy1

1. It will appear: the visualization of the box2. It will appear: |idle> (interactive mode)3. type /run/beamOn number of events4. The simulation is executed5. Type exit

Default visualization driverOGLIX

defined in VisualisationMacro.mac

About VisualizationOGLIX : Immediate visualization No images saved!

DAWN : Interactive panel images saved

At the |idle> prompt, type help,

information about interactive commands

Page 10: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

More about visualisation

How to change driver:in VisualisationMacro.mac

/vis/open OGLIX#/vis/open DAWNFILE

#/vis/open OGLIX/vis/open DAWNFILE

How to work with OGLIX:At the |idle> prompt• Type help• Type the number corresponding to /vis/• Information about visualization commandsEg. rotation of the geometry magnification…

How to work with DAWN:

The interactive panel appears:• devices: choose the format of the image• camera: choose the geometryparameters (rotation, magnification...)

Page 11: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Model a 192Ir brachytherapy seed

Open BrachyDetectorConstruction in the editor

Follow the guided tour by Susanna

How the geometry is build:3 m m ste e l c a b le

5.0 m m

0.6 m m

3.5 m m

1.1 m m

Ac tive Ir-192 C o re

ExpHall: world volume

Phantom: Box

Capsule of the source

Iridium corethe mother volume is the

containing volume!

Page 12: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.
Page 13: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Before starting

Documentation: http://geant4.web.cern.ch/geant4 click on documentation click on User’s Guide: For Application Developers

very useful !

Page 14: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Exercise: model a soft tissue phantom

Composition of soft tissue material

(from NIST data base)

Guidance– define necessary elementselements– define tissue materialmaterial– associate the tissue material to the phantom

volume

element Fractional mass

H 0.104472

C 0.23219

N 0.02488

O 0.630238

Na 0.00113

Mg 0.00013

P 0.00133

S 0.00199

Cl 0.00134

K 0.00199

Ca 0.00023

Fe 0.00005

Zn 0.00003

Start: brachyExe1

Page 15: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Exercise: select phantom material from UI

Select a water/tissue phantom

– The user shall be able to change interactively the material of the phantom

Guidance– create a BrachyDetectorMessenger– Create a BrachyDetectorMessenger pointer in BrachyDetectorConstruction– Create the member function SetMaterial in BrachyDetectorConstruction– Help! Novice example N02

Solution : brachyExe2

Page 16: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Titanium capsule tipsTitanium tube

Iodium core:Inner radius :0Outer radius: 0.30mmHalf length:1.75mm

Air:Outer radius:0.35mm half length:1.84mm

Titanium tube:Outer radius:0.40mmHalf length:1.84mm

Titanium capsule tip:Semisphereradius:0.40mm

Model a I-125 brachytherapic sourcein brachyExe2

Model the source geometry

Air

Iodium core

Golden marker

Golden marker:Inner radius :0Outer radius: 0.085 mmHalf length:1.75mm

Precise geometry and material model of any type of source

Mean gamma energy :28.45keV

Page 17: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Exercise: model a 125I brachytherapy seed

Guidance– define necessary elements, materialselements, materials– define solids, logical volumes, physical volumessolids, logical volumes, physical volumes– suggestion: proceed incrementally (i.e. implement one/few features at a

time, compile, verify that it is OK, add a new feature etc…)

Solution brachyExe3

Pay attention to overlapping volumes!

Page 18: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Exercise: model a source spectrum

Description of the spectrum

Guidance– In brachyExe3– Change in the BrachyPrimaryGeneratorAction

Solution brachyExe4

Energy(keV) Probability

27.4 0.783913

31.4 0.170416

35.5 0.045671

Page 19: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Part 2Part 2Use case: calculate the energy deposit in a phantom

due to a radioactive source

9. Use case: generate physics interactions in the phantom

10.Exercise: select alternative physics processes

11.Exercise: modify the production thresholds

12.Use case: collect the energy deposit in the phantom

13.Exercise: model the hits as consisting of the energy deposited in each voxel and the coordinates of the voxel centre

14.Use case: produce a 1-D histogram with the energy deposited in the phantom

15.Exercise: produce a 2-D histogram with the dose distribution in the phantom

Page 20: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Exercise: select alternative e.m. processes

Replace LowEnergy processes with standard ones– For gamma and e-

Change the production thresholds to 0.2 mm for all the particles involved

Guidance– Novice Example N02– User Guide: for Application Developers– Physics ReferenceManual

Solution brachyExe5

In brachyExe4…

Page 21: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Collect the energy deposit in a phantom

Page 22: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.
Page 23: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Exercise: hits consisting of Edep, x,y,z

Add Edep

– Associate Edep to the voxel coordinates

Guidance– In brachyExe5– In BrachyEventAction– Take inspiration from

Solution brachyExe6

i=((*CHC)[h])->GetZID(); k=((*CHC)[h])->GetXID(); …….

Page 24: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Analysis

How to store information in 1D histograms, in 2D histograms and ntuples

Page 25: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.
Page 26: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.
Page 27: S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January 2004   Brachytherapy exercise.

Exercise: add a 2-D histogram

Produce a 2-D histogram with the dose distribution in the phantom

Guidance – In brachyExe6– Complete the method FillHistogramWithEnergy(…) in

BrachyAnalysisManager– Similar implementation as in 1-D histogram– Store the information (x, z, Edep) in the 2D histogram in BrachyEventAction– Edep is the weight

Solution brachyExe7