Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
+94 -59
View File
@@ -4,7 +4,7 @@
| README |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The DICOM application has been developed by the Geant4 users:
The DICOM application has been orignal developed by the Geant4 users:
Louis Archambault,*Luc Beaulieu, +Vincent Hubert-Tremblay.
*Centre Hospitalier Universitaire de Quebec (CHUQ),
@@ -16,89 +16,124 @@ web : thomson.phy.ulaval.ca/phys_med
+ Université Laval, Québec (QC) Canada
This example illustrates a preliminary version of a Geant4 interface
to the DICOM image format.
The example consists in creating an image from dicom files.
And it has been deeply reviewed by Pedro Arce in December 2007.
--->1) Introduction
DICOM images are read and used as Geometry for simulation.
This example serves first to convert a DICOM file to a simple ASCII file, where the Hounsfield numbers are converted to materials and densities so that it can be used by GEANT4. It serves also to create a GEANT4 geometry based on the DICOM file information using the G4PhantomParameterisation.
Three file .dcm give the experimental set-up
(in terms of tissues and tissue geometry position) are read.
It is possible to visualise the reproduced experimental
set-up thanks to the use of visualisation packages.
You can find the phantom reproduced in the image PhantomCT.jpg.
In the application the phantom is placed on a table.
In the application the phantom is placed on a table.
---> 2) Installation:
-example enviroment with the compiler 3.2.3
-a standard Geant4 example GNUmakefile is provided
setup with:
compiler = gcc-3.2.3
G4SYSTEM = linux-g++
The following environment variables need to be set:
G4LEDATA: points to low energy data base - G4EMLOW3.0
visualisation package: OpenGL
- A standard Geant4 example GNUmakefile is provided
- Compile it with 'make'
---> 3) Run the example:
- batch mode:
-dicom vis.mac :the geometry is visualised with OPENGL
-dicom run.mac :no geometry visualisation
- To run the environment variable G4LEDATA needs to be set, pointing to the low energy data base, G4EMLOW4.3
- interactive mode:
dicom
the file default.mac is read in order to visualise the phantom.
- batch mode:
- $G4INSTALL/bin/Linux-g++/dicom run.mac
--->4) Some details :
- interactive mode:
- $G4INSTALL/bin/Linux-g++/dicom
the file vis.mac is read in order to visualise the phantom with OpenGL
The DICOM images pixel values represent CT (Hounsfield) numbers and they should be
converted, first, to a given density and then to a material type. The relation between
CT number and density is more or less linear. The one used in this program is represented
in the table below.
--->4) Metadata:
The file Data.dat has the following information
- A line with the compression value (used only to create the .g4dcm, not to read it)
- A line with the number of files
- A line for each file name (to these names it will be added the suffix .dcm to read the DICOM files in their original format, and the suffix .g4dcm to read the text files that contain the DICOM information where the Hounsfield numbers have been converted to material and densities)
In case you want to convert DICOM files to text files, it must have the following lines:
- The number of materials you want to use
- A line for each material describing its name and the upper bound of the density interval. The materials should be described in increasing order of density. The voxels with a density between 0. and the first upper bound will be assigned to the first material, those with a density between the first upper bound and the second upper bound will be assigned to the second material, etc.
--->5) Conversion of Hounsfield numbers to materials:
After reading the name of files from Data.dat, if a file .dcm is found, then it looks for the corresponding .g4dcm file and if not found creates it.
Each file corresponds to a Z slice. The Z slices will be merged at runtime to form a unique patient volume; therefore the different slices have to be contiguous in Z.
The DICOM images pixel values represent CT (Hounsfield) numbers and they should be converted, first, to a given density and then to a material type. The relation between CT number and density is more or less linear.
The file CT2Density.dat contains the calibration curve to convert CT (Hounsfield) number to physical density
The assignment of material densities to materials is done following the information from the file Data.dat (see below). In this case we have used:
#####################################################
# Density Range Material #
#---------------------------------------------------#
# mg/cm3 - #
#---------------------------------------------------#
# [ 0.207 , 0.227 ] Lungs (inhale) #
# [ 0.481 , 0.534 ] Lungs (exhale) #
# [ 0.919 , 0.979 ] Adipose #
# ] 0.979 , 1.004 ] Breast #
# ] 1.004 , 1.043 ] Phantom #
# ] 1.043 , 1.109 ] Liver #
# ] 1.109 , 1.113 ] Muscle #
# ] 1.113 , 1.217 ] Trabecular Bone#
# [ 0. , 0.207 ) Air #
# [ 0.207 , 0.481 ) Lungs (inhale) #
# [ 0.481 , 0.919 ) Lungs (exhale) #
# [ 0.919 , 0.979 ) Adipose #
# [ 0.979 , 1.004 ) Breast #
# [ 1.004 , 1.043 ) Phantom #
# [ 1.043 , 1.109 ) Liver #
# [ 1.109 , 1.113 ) Muscle #
# [ 1.113 , 1.496 ) Trabecular Bone#
# [ 1.496 , 1.654 ] Dense Bone #
#####################################################
Data taken from the International Commission on Radiation Units and measurements (ICRU)
report 46 was used to build the materials (lung, liver, breast, bones, ...)
Data taken from the International Commission on Radiation Units and measurements (ICRU) report 46 was used to build the materials (lung, liver, breast, bones, ...)
5) Contacts
--->6) Splitting materials in density intervals:
If you have any questions or wish to notify of updates and/or modification
please contact:
*Louis Archambault at louis.archambault@phy.ulaval.ca
*Luc Beaulieu at beaulieu@phy.ulaval.ca
In the class DicomDetectorConstruction, it is defined a density interval
+ Vincent Hubert-Tremblay
<tigre.2@sympatico.ca> or <vihut@phy.ulaval.ca>
G4double densityDiff = 0.1;
*Centre Hospitalier Universitaire de Quebec (CHUQ),
Hotel-Dieu de Quebec, departement de Radio-oncologie
11 cote du palais. Quebec, QC, Canada, G1R 2J6
tel (418) 525-4444 #6720
fax (418) 691 5268
web : thomson.phy.ulaval.ca/phys_med
This means that the voxels of each material will be grouped in density intervals of 0.1 g/cm3 and a new material will be created for each group of voxels.
--->7) Voxel colouring:
The file Colormap.dat defines the colour that will be assigned to the voxels of each material.
--->8) DICOM text file format:
The DICOM files are converted to a simple text format. You may create your own file with the following format (see e.g. 14196616.g4dcm):
- A line with the number of materials
- A line for each material with its index and name (the same name of materials that you construct as G4Material's)
- A line with the number of voxels in X, Y and Z
- A line with the minimum and maximum extension in X (mm)
- A line with the minimum and maximum extension in Y (mm)
- A line with the minimum and maximum extension in Z (mm)
- A number of lines containing the nVoxelX*nVoxelY*nVoxelZ material indices (one per voxel)
- A number of lines containing the nVoxelX*nVoxelY*nVoxelZ material densities (one per voxel)
As commented before the DICOM files (.dcm) are assumed to describe one Z slice per file, and therefore the GEANT4 text files (.g4dcm) created from them have also one unique Z slice per file. Nevertheless if you create your own .g4dcm file you may include as many Z slices as desired. In any case you have to respect the rule that the Z slices must be contiguous.
--->9) Choosing different parameterisation/navigation options:
There are four possible ways in GEANT4 to treat the navigation in regular voxelised volumes:
- The non-optimised way. It will be very slow because each time a track exits a voxel it has to loop to all other voxels to know which one it may enter
- The optimisation with G4SmartVoxel: a 3D grid is built, so that the location of voxels is fast, but it requires a lot of memory
- Using G4NestedParameterisation. The search is done hierarchically in X, Y and Z. It is fast and does not require big memory
- Using G4PhantomParameterisation/G4RegularNavigation: an special algorithm to navigate in regular voxelised geometries (see GEANT4 doc). This is the fastest way without any extra memory requirement (and it is the default in this example). It includes an option (default) to skip frontiers between voxels when they have the same material
You can select amont the four options in the following way:
- By default the example will run with G4RegularNavigation
- To use the first option at RegularDicomDetectorConstruction.cc you just have to set
patient_phys->SetRegularStructureId(0);
- To use the second option apart from the change above at RegularDicomDetectorConstruction.cc you have to replace (i.e. use kUndefined)
G4PVParameterised * patient_phys = new G4PVParameterised("Patient",voxel_logic,container_logic,
kXAxis, nVoxelX*nVoxelY*nVoxelZ, param);
by
G4PVParameterised * patient_phys = new G4PVParameterised("Patient",voxel_logic,container_logic,
kUndefined, nVoxelX*nVoxelY*nVoxelZ, param);
- To use the third option you have to set the enviromental variable DICOM_NESTED_PARAM to 1
+ Université Laval, Québec (QC) Canada