Old examples

From Wiki OpenGATE
Revision as of 14:23, 16 September 2016 by Vcuplov (Talk | contribs)

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.