Old examples

From Wiki OpenGATE
Revision as of 16:37, 25 January 2018 by Albertine.Dubois (Talk | contribs) (Albertine.Dubois moved page Users Guide V8.0:Examples to Old examples)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

example_ARF

Angular Response Function (ARF) Tables Data computation

In this step, the data needed to generate the ARF tables are computed from a rectangular source located at the center of the field of view. The SPECT head is duplicated twice and located at roughly 30 cm from the axial axis. The command to tell GATE to compute the ARF data is:

/gate/systems/SPECThead/arf/setARFStage generateData

The ARF data are stored in the ROOT format from the GATE command output :

/gate/output/arf/root/setARFDataFileName testARFdata

By default the maximum size of a ROOT file is 1.8 Gb. Once the file has reached this size, ROOT automatically closes it and open a new file name testARFdata_1.root. when this file reaches 1.8 Gb, it is closed and a new file testARFdata_2.root if needed is created and so on ...

A template macro file is provided in gate_v4.0.0/examples/example_ARF/generateARFdata.mac which summarizes the commands listed before.

Computation of the ARF tables from ARF data (previous step)

Now that the data have been stored to ROOT files, we may compute the tables and store them to a binary file :

# COMPUTE THE ARF TABLES FROM ARF DATA
/gate/systems/SPECThead/arf/setARFStage computeTables
# DIGITIZER PART OF THE ARF SENSISTIVE DETECTOR
/gate/systems/SPECThead/ARFTables/setEnergyDepositionThreshHold      328. keV
/gate/systems/SPECThead/ARFTables/setEnergyDepositionUpHold          400. keV
/gate/systems/SPECThead/ARFTables/setEnergyResolution                  0.10
/gate/systems/SPECThead/ARFTables/setEnergyOfReference               140. keV

Here we shot 364.5 keV photons. We choose an energy resolution of 10% from which we obtain 328 keV and 400 keV as the energy window boundaries. The energy of reference is chosen to be 140 keV which allows to define the FWHM of the response of the detector as FWHM = 0.10 x sqrt(140. x Edep ), where Edep is the photon deposited energy.

If we do not want to consider photons which deposit less than 130 keV we may use:

/gate/systems/SPECThead/setEnergyDepositionThreshHold 130. keV

The ARF tables depend strongly on the distance from the detector to the source. We have to enter this parameter to get proper tables. The detector plane is set to be the half—middle plan of the detector part of the SPECT head. In the given example, we set the translation of the SPECT head to be 34.5 cm along the X direction (radial axis), the detector is 2 cm wide along X and its center is located at X = 1.5 cm with respect to the SPECThead frame. This is what we call the detector plane ( x = 1.5 cm ). So the distance from the source to the detector plane is 34.5 +1.5 = 36 cm :

# DISTANCE FROM SOURCE TO DETECTOR PLANE TAKEN TO BE THE PLANE AT HALF DIMENSION OF THE CRYSTAL RESPECTIVELY TO THE SPECTHEAD FRAME
/gate/systems/SPECThead/ARFTables/setDistanceFromSourceToDetector 36 cm

Now we compute the ARF tables from a text file which contains informations regarding the incident photons called ARFData.txt (provided in gate/examples/example_ARF).

# NOW WE ARE READY TO COMPUTE THE ARF TABLES
/gate/systems/SPECThead/ARFTables/ComputeTablesFromEnergyWindows ARFData.txt

The ARFData.txt file reads like this :

# This file contains all the energy windows computed during first step with their associated root files
# It has to be formatted the following way : 
# [Emin,Emax] is the energy window of the incident photons
# The Base FileName is the the name of the root files name.root, name_1.root name_2.root ...
# The number of these files has to be given as the last parameter.
#
# Enter the datas for each energy window : 
# Inident Energy Window : Emin (keV) - Emax (keV) | Associated Root Base FileName | number of these files

0.    365.    test1head    20

Here we have only one incident energy window for which we want to compute the corresponding ARF tables. The data for the first one are stored inside 20 files whose base file name is test1head which were generated in the previous stage. It means the ARF data are stored in test1head.root, test1head_1.root ... test1head_20.root.

Finally we store the computed tables to a binary file :

/gate/systems/SPECThead/ARFTables/list
# SAVE ARF TABLES TO A BINARY FILE FOR PRODUCTION USE
/gate/systems/SPECThead/ARFTables/saveARFTablesToBinaryFile ARFSPECTBench.bin

Use of the ARF Tables

The command to tell GATE to use the ARF tables is :

/gate/systems/SPECThead/arf/setARFStage useTables

The ARF sensitive detector is attached to the SPECThead :

/gate/SPECThead/attachARFSD

These tables are loaded from binary files with :

/gate/systems/SPECThead/ARFTables/loadARFTablesFromBinaryFile ARFTables.bin


example_CT

CT simulation

The CT example simulation (Figure 1) is made of an X-Rays conical source, with 6.8° angle emission, a CT scanner with 100x100 Silicon (0.5x0.5x1 mm3) pixels and a cylindrical phantom made of Water containing 4 balls (Aluminium, Glass, SpineBone, PVC). During the simulation 16,835,281 photons are detected.

Figure 1: CT example simulation using GATE.

There are 2 runs. Each run performs during 90 seconds. The phantom turns around its central axis at 1 deg per second.

Building and Running AnalyzeCT.cpp

Compile the C++ file (in the classic directory) with the following command:

g++ -O3 `root-config -cflags -glibs` AnalyzeCT.cpp -o AnalyzeCT

Results

Figure 2 shows the Energy spectrum for the first and second projection (first and second run). For the first Run, from top-left to bottom-right, the plot shows the energy spectrum outside the phantom, in the phantom, behind the 2 Top balls and behind the 2 bottom balls. For the second Run, from top-left to bottom-right, the plot shows the energy spectrum behind the PVC ball, behind the Aluminium ball, behind the Glass ball and behind the Spine Bone ball.

Figure 2: CT example simulation : Projections during the First (left) and second (right) run.

example_DNA

This example shows how to mix Standard and DNA physics list in the same simulation. The geometry consists in a world volume made of liquid water (!! Be careful you must use the so-called "G4_WATER" material while using Geant4 DNA processes and models !!) including three boxes Target1, Target2, Target3 made of liquid water (G4_WATER) of thickness 50 micrometers aligned along the Z axis. Monoenergetic protons of 8 MeV are shot along the Z axis at 10 micrometers of the face of the first box Target1. Geant4 Standard option 3 physics list is assigned to the world volume with a cut of 4 micrometers (2.9 keV electrons in liquid water). Geant4 DNA physics list is assigned to Target1 and Target3 (note that cut is not active using Geant4 DNA processes and models). A KillActor is used to kill electrons with kinetic energy below 8 eV. It prevents electrons to be trapped into single scattering.

The production of secondary particles is scored in each Target via EnergySpectrumActor. To analyse the spectrum with ROOT, use the plot.C macro file. One can check the correct production of secondaries: from 2.9 keV in Target2, whereas the Geant4 DNA models in Target1 and Target3 are able to produce secondaries below 2.9 keV.

example_dosimetry

brachytherapy

This example illustrates the simulation of a brachytherapy treatment using a titanium capsule and a source of Iodine 125.

electron radiotherapy

This example describes the simulation of a Clinac 2100C linear accelerator operating in 6 MeV electron mode for a thoracic irradiation of a RANDO phantom.

!!Warning!! This example should only be used for illustration purpose. Due to NDA with manufacturer, the geometry of the devices provided in the macros have been modified and are not the real ones.

The linac head consists in :

+ a vacuum window : exit window in beryllium
+ a 6 MeV scattering foil : in tantalum
+ an ionization chamber : kapton-air-copper slabs
+ X and Y Jaws : defining a 20x20cm2 aperture adapted to the 10x10cm2 applicator
+ a 10x10cm2 applicator
+ a 10x10cm2 cerrobend cut-out
  

The source is described as a circular surface source. The electron spectrum is assumed to be Gaussian with a mean energy of 7.2 MeV and a standard deviation of 3%.

external beam therapy photon

This example illustrates a photon beam therapy in a patient CT image. The output is a 3D dose distribution map (with associated uncertainty). The phantom being a patient CT image, one needs to generate materials from the image Hounsfield units :

/gate/HounsfieldMaterialGenerator/SetMaterialTable                      data/Schneider2000MaterialsTable.txt
/gate/HounsfieldMaterialGenerator/SetDensityTable                       data/Schneider2000DensitiesTable.txt
/gate/HounsfieldMaterialGenerator/SetDensityTolerance                   0.1 g/cm3
/gate/HounsfieldMaterialGenerator/SetOutputMaterialDatabaseFilename     data/patient-HUmaterials.db
/gate/HounsfieldMaterialGenerator/SetOutputHUMaterialFilename           data/patient-HU2mat.txt
/gate/HounsfieldMaterialGenerator/Generate

After the conversion from HU to materilas, the patient CT is inserted as the simulation phantom :

/gate/world/daughters/name                                   patient
/gate/world/daughters/insert                                 ImageRegionalizedVolume
/gate/geometry/setMaterialDatabase                           data/patient-HUmaterials.db
/gate/patient/geometry/setHUToMaterialFile                   data/patient-HU2mat.txt
/gate/patient/geometry/setImage                              data/patient-2mm.mhd     <==== real patient CT scan 
/gate/patient/placement/setTranslation                       0 0 0 mm
/gate/patient/geometry/TranslateTheImageAtThisIsoCenter      109.7 99.3 146.2 mm

A DoseActor is used to store 3D distributions of dose/edep/uncertainty/nbHit into files (mhd image file format) :

/gate/actor/addActor                                   DoseActor  doseDistribution
/gate/actor/doseDistribution/attachTo    	       patient
/gate/actor/doseDistribution/stepHitType               random
/gate/actor/doseDistribution/setPosition               0 0 0 mm
/gate/actor/doseDistribution/setVoxelSize              2 2 2 mm
/gate/actor/doseDistribution/enableEdep                true
/gate/actor/doseDistribution/enableUncertaintyEdep     true
/gate/actor/doseDistribution/enableDose                true
/gate/actor/doseDistribution/enableNumberOfHits        false
/gate/actor/doseDistribution/save                      output/photon.mhd

molecular therapy I131

protontherapy

This example simulates a proton beam in a water box with a Pencil Beam Scanning source with a treatment plan obtained from a Treatment Planning System (TPS).

/gate/source/addSource                      PBS TPSPencilBeam
/gate/source/PBS/setTestFlag                false
/gate/source/PBS/setPlan                    data/RTIPLAN.0912590.16.txt
/gate/source/PBS/setFlatGenerationFlag      false
/gate/source/PBS/setSourceDescriptionFile   data/Source-Properties.txt


example_PET

This example defined a complete simulation for a PET application :

  • The PET scanner is defined with the cylindricalPET system. The camera is dedicated for small animal imaging. A phoswitch system is defined. An orbiting movement of the camera is also defined. The phantom is a water box and the source is Carbon 11. The acquisition is dynamic : 6 frames of 1 seconde each.
  • The PET scanner is defined with the ECAT system. The camera is dedicated for whole human body imaging. A dead time model is included. The phantom is a water cylinder and the source is Fluor 18. The "ECAT Library" needs to be installed on your system.

example_SPECT

This example defined a complete simulation for a SPECT application. The SPECT scanner is defined with the SPECThead system. The camera is NaI camera with 4 heads and parallel collimator. An orbiting movement of the camera and a translation movement of the bed and the phantom are defined. The is a water cylinder and the source is a gamma source of 140 keV. The acquisition is dynamic : 16 frames of 37.5 secondes each.

example_fluorescence

This example is dedicated to test the activation of the fluorescence process in function of the physicsList. The phantom is either geometric (box) or voxelized and its material is Iodine and Tungsten. If using the voxelised phantom, apply first the following commands to get the binary data :

cd data
wget http://www.creatis.insa-lyon.fr/~smekens/voxelisedPhantom.mhd
wget http://www.creatis.insa-lyon.fr/~smekens/voxelisedPhantom.raw
cd ..
The source is an isotropic monoenergetic gamma emission. The EnergySpectrumActor with a gamma filter is used to obtain the histogram of the number of gamma detected in the volume as a function of the energy. If fluorescence is activated, the fluorescence x-ray lines as well as the incident energy peak are visible. 

In order to get the atom deexcitation processes :

  • With the physicsList-builder : /gate/physics/addPhysicsList emlivermore
  • With your own physicsList : /gate/physics/addAtomDeexcitation

In both case, all atom deexcitation processes are automatically activated (fluo, auger, PIXE) for all volume included in the simulation. You still have the possibility to disable those processes by using one of the following commands :

/process/em/fluo  false              -> disable all deexcitation processes
/process/em/auger false              -> disable auger only
/process/em/pixe  false              -> disable PIXE only


The theoretical data (http://www.kayelaby.npl.co.uk/atomic_and_nuclear_physics/4_2/4_2_1.html) :

                  K       Kb2      Kb1      Kb3       Ka1      Ka1     LI      Lg3       Lb3    Lb4       LII     Lg1      Lb1    LIII     Lb2     La1     La2     Li
Intensity (%)     -       5-15     ~20      ~10       100     53-65     -       ~5       5-20    20        -      5-25     100      -      5-20     ~90     10     20–5
53 I (keV)      33.168   33.054   32.295   32.239   28.612   28.317   5.186    5.072    4.313   4.257    4.851    4.799   4.221   4.556    4.509   3.938   3.926   3.485 
74 W (keV)      69.517   69.100   67.244   66.951   59.318   57.982   12.092   11.675   9.819   9.526   11.535   11.284   9.671   10.199   9.959   8.396   8.335   7.388

example_OPTICAL

In the GATE software you will find simple examples of a bioluminescence/fluorescence experiment. All macros are located in example/example_OPTICAL. In addition, a ROOT macro [DrawBranches.C] is available and draws all branches of the OpticalData tree into a postscript file.

OpticalImaging-experiments.png

The optical imaging system is composed of an array of pixels, an electronic board and an angular aperture that limits the range of angles over which the optical system can accept light. The phantom is composed of a box of water and two layers made of either water, hypodermis or epidermis. In case of a bioluminescence experiment, the tumor is described as a voxelized source of optical photons and is positioned under the inner layer of the phantom. In case of a fluorescence experiment, we assigned the Rhodamine B fluorophore to each voxel of a voxelized tumor and positioned it under the inner layer of the phantom. The fluorophore is excited by two external beam light sources emitting optical photons towards the tumor.

These two experiments are available in example/example_OPTICAL through the following macros: bioluminescence.mac and fluorescence.mac. The voxelized source or phantom is available in example/example_OPTICAL/voxelized-source-phantom with an attenuation file and an optical-flux file. These macros will generate a root output file with the OpticalData tree enabled and a binary file which corresponds to the GATE ProjectionSet on the XY plane (i.e detection plane). Using the root macros MakeBioluminescencePlots.C and MakeFluorescencePlots.C, you can read the root output file and draw the bioluminescent/fluorescent light that is detected by the optical system. In case of the fluorescence experiment, two plots are drawn: all detected light (any wavelength) and the fluorescent light (wavelength cut). The projection binary file (.bin and .hdr) can be viewed directly using Anatomist or Imagej. In case of the fluorescence experiment, an Upholder (uphold cut) was applied through the digitizer so the binary image illustrates the fluorescent light.

The Materials.xml file is updated with several tissues properties at specific wavelengths (from literature): brain, kidney, epidermis and hypodermis but also with the emission spectra of the Fluorescein and Rhodamine B.