source: trunk/examples/extended/medical/DICOM/README @ 1346

Last change on this file since 1346 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 10.3 KB
Line 
1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2|                        DicomG4                          |
3+                                                         +
4|                        README                           |
5+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
6
7The DICOM application has been orignal developed by the Geant4 users:
8Louis Archambault,*Luc Beaulieu, +Vincent Hubert-Tremblay.
9
10*Centre Hospitalier Universitaire de Quebec (CHUQ),
11Hotel-Dieu de Quebec, departement de Radio-oncologie
1211 cote du palais. Quebec, QC, Canada, G1R 2J6
13tel (418) 525-4444 #6720
14fax (418) 691 5268
15web : thomson.phy.ulaval.ca/phys_med
16
17+ Université Laval, Québec (QC) Canada
18
19And it has been deeply reviewed by Pedro Arce in December 2007.
20Very small changes by Stephane Chauvie in January 2008.
21Stephane Chauvie, Oct 2009: changed Physics list; changes in DICOM read.
22Stephane Chauvie and Andrea Armando; June 2010 adapted for reading  whatever DICOM file
23
24
25--->1) Introduction
26
27This 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.
28
29You can find the phantom reproduced in the image PhantomCT.jpg.
30In the application the phantom is placed on a table.
31 
32---> 2) Installation:
33
34 - A standard Geant4 example GNUmakefile is provided           
35 - Compile it with 'make'/'gmake'
36
37---> 3) Run the example:
38
39 - To run the environment variabmore le G4LEDATA needs to be set, pointing to the low energy data base
40
41 - batch mode:
42   - $G4INSTALL/bin/Linux-g++/dicom run.mac
43
44 - interactive mode:
45   - $G4INSTALL/bin/Linux-g++/dicom
46   the file vis.mac is read in order to visualise the phantom with OpenGL, DAWN or VRML
47
48--->4) Metadata:
49
50 The file Data.dat has the following information
51  - A line with the compression value (used only to create the .g4dcm and .g4dcmb, not to read it)
52  - A line with the number of files
53  - 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)
54
55In case you want to convert DICOM files to text files, it must have the following lines:
56  - The number of materials you want to use
57  - 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.
58
59--->5) Conversion of Hounsfield numbers to materials:
60
61After 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.
62Each 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.
63
64The 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.
65The file CT2Density.dat contains the calibration curve to convert CT (Hounsfield) number to physical density
66The assignment of material densities to materials is done following the information from the file Data.dat (see below). In this case we have used:
67
68           #####################################################
69           #     Density Range                   Material      #
70           #---------------------------------------------------#
71           #       mg/cm3                            -         #
72           #---------------------------------------------------#
73           #  [ 0.    , 0.207 )                 Air            #
74           #  [ 0.207 , 0.481 )                 Lungs (inhale) #
75           #  [ 0.481 , 0.919 )                 Lungs (exhale) #
76           #  [ 0.919 , 0.979 )                 Adipose        #
77           #  [ 0.979 , 1.004 )                 Breast         #
78           #  [ 1.004 , 1.043 )                 Phantom        #
79           #  [ 1.043 , 1.109 )                 Liver          #
80           #  [ 1.109 , 1.113 )                 Muscle         #
81           #  [ 1.113 , 1.496 )                 Trabecular Bone#
82           #  [ 1.496 , 1.654 ]                 Dense Bone     #
83           #####################################################
84
85Data taken from the International Commission on Radiation Units and measurements (ICRU) report 46 was used to build the materials (lung, liver, breast, bones, ...)
86
87--->6) Splitting materials in density intervals:
88
89In the class DicomDetectorConstruction, it is defined a density interval
90
91  G4double densityDiff = 0.1;
92
93This 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.
94
95--->7) Voxel colouring:
96
97The file Colormap.dat defines the colour that will be assigned to the voxels of each material.
98
99--->8) DICOM file formats:
100
101The DICOM files are converted to a simple text format. You may create your own file with the following format (see e.g. 14196616.g4dcm):
102
103- A line with the number of materials
104- A line for each material with its index and name (the same name of materials that you construct as G4Material's)
105- A line with the number of voxels in X, Y and Z
106- A line with the minimum and maximum extension in X (mm)
107- A line with the minimum and maximum extension in Y (mm)
108- A line with the minimum and maximum extension in Z (mm)
109- A number of lines containing the nVoxelX*nVoxelY*nVoxelZ material indices (one per voxel)
110- A number of lines containing the nVoxelX*nVoxelY*nVoxelZ material densities (one per voxel)
111
112As 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.
113
114The same information is also used to fill a file in binary format, that contains the same information as the text format. Its name ends in .g4dcmb, instead of .g4dcm .
115
116--->9) Choosing different parameterisation/navigation options:
117
118There are four possible ways in GEANT4 to treat the navigation in regular voxelised volumes:
119
120- The 1D optimisation . 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
121- The 3D optimisation with G4SmartVoxel: a 3D grid is built, so that the location of voxels is fast, but it requires a lot of memory
122- Using G4NestedParameterisation. The search is done hierarchically in X, Y and Z. It is fast and does not require big memory
123- 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. When using this option at each step the energy is all deposited in the last voxel; for properly distribution of the dose (=energy/volume) the G4PSDoseDeposit_RegNav scorer can be used (see below)
124
125You can select amont the four options in the following way:
126
127- By default the example will run with G4RegularNavigation
128
129- To use the first option at RegularDicomDetectorConstruction.cc you just have to set
130
131  patient_phys->SetRegularStructureId(0);
132
133- To use the second option apart from the change above at RegularDicomDetectorConstruction.cc you have to replace (i.e. use kUndefined)
134
135  G4PVParameterised * patient_phys = new G4PVParameterised("Patient",voxel_logic,container_logic,
136                        kXAxis, nVoxelX*nVoxelY*nVoxelZ, param);
137
138by
139
140  G4PVParameterised * patient_phys = new G4PVParameterised("Patient",voxel_logic,container_logic,
141                        kUndefined, nVoxelX*nVoxelY*nVoxelZ, param);
142
143- To use the third option you have to set the enviromental variable DICOM_NESTED_PARAM to 1
144
145
146--->10) Calculating dose in phantom voxels for regular navigation
147
148As mentioned above the regular navigation has the option to keip voxel frontiers when two voxels share the same material, what can make the CPU time several times smaller. But this option makes that all energy deposited is computed in the last voxel, instead of distributing it along the voxels traversed. To properly calculate the dose in each voxel the G4PSDoseDeposit_RegNav scorer can be used.
149It takes into account the fact that,  when the particle travels through the voxels it looses energy and therefore the energy lost per length (dEdx) is bigger and also the effect of the multiple scattering is bigger.
150The algorithm to make this correction is an iterative one, as the step length increase due multiple scattering (that converts the geometrical step length in what we will call the true step length) and the energy loss are correlated.
151It works in the folloing way: first the total true step length is distributed among the voxels proportionally to their geometrical step length; with these values it is calculated one voxel after another the value of dEdx and then the value of the kinetic energy at the entrance of each voxel; with these values it is calculated the geometrical to true step corrections due to multiple scattering for each voxel; finally these new values are used to recalculate the energy lost in each voxel. It has been demonstrated for dose in a water phantom and in a real phantom that the two-step iteration described is enough to reproduce the dose calcualted when no skipping of voxel frontiers is done.
152
153This scorer is implemented in this examples if the regular navigation option is
154chosen. It is triggered at the method RegularDicomDetectorConstruction::ConstructPatient() by the call
155
156SetScorer(voxel_logic);
157
158--->11) Output
159dicom.out is produced running th macro file run.mac. It has 2 columns: the first is the number of
160voxel (ordered in x,y,z) and the second the dose there deposited (in Gy)
161It is produced, as an example, with a compression value of 32
Note: See TracBrowser for help on using the repository browser.