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

Last change on this file since 1313 was 807, checked in by garnier, 16 years ago

update

File size: 7.7 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.
20
21
22--->1) Introduction
23
24This 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.
25
26You can find the phantom reproduced in the image PhantomCT.jpg.
27In the application the phantom is placed on a table.
28 
29---> 2) Installation:
30
31 - A standard Geant4 example GNUmakefile is provided           
32 - Compile it with 'make'
33
34---> 3) Run the example:
35
36 - To run the environment variable G4LEDATA needs to be set, pointing to the low energy data base, G4EMLOW4.3     
37
38 - batch mode:
39   - $G4INSTALL/bin/Linux-g++/dicom run.mac
40
41 - interactive mode:
42   - $G4INSTALL/bin/Linux-g++/dicom
43   the file vis.mac is read in order to visualise the phantom with OpenGL
44
45--->4) Metadata:
46
47 The file Data.dat has the following information
48  - A line with the compression value (used only to create the .g4dcm, not to read it)
49  - A line with the number of files
50  - 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)
51
52In case you want to convert DICOM files to text files, it must have the following lines:
53  - The number of materials you want to use
54  - 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.
55
56--->5) Conversion of Hounsfield numbers to materials:
57
58After 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.
59Each 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.
60
61The 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.
62The file CT2Density.dat contains the calibration curve to convert CT (Hounsfield) number to physical density
63The assignment of material densities to materials is done following the information from the file Data.dat (see below). In this case we have used:
64
65           #####################################################
66           #     Density Range                   Material      #
67           #---------------------------------------------------#
68           #       mg/cm3                            -         #
69           #---------------------------------------------------#
70           #  [ 0.    , 0.207 )                 Air            #
71           #  [ 0.207 , 0.481 )                 Lungs (inhale) #
72           #  [ 0.481 , 0.919 )                 Lungs (exhale) #
73           #  [ 0.919 , 0.979 )                 Adipose        #
74           #  [ 0.979 , 1.004 )                 Breast         #
75           #  [ 1.004 , 1.043 )                 Phantom        #
76           #  [ 1.043 , 1.109 )                 Liver          #
77           #  [ 1.109 , 1.113 )                 Muscle         #
78           #  [ 1.113 , 1.496 )                 Trabecular Bone#
79           #  [ 1.496 , 1.654 ]                 Dense Bone     #
80           #####################################################
81
82Data taken from the International Commission on Radiation Units and measurements (ICRU) report 46 was used to build the materials (lung, liver, breast, bones, ...)
83
84--->6) Splitting materials in density intervals:
85
86In the class DicomDetectorConstruction, it is defined a density interval
87
88  G4double densityDiff = 0.1;
89
90This 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.
91
92--->7) Voxel colouring:
93
94The file Colormap.dat defines the colour that will be assigned to the voxels of each material.
95
96--->8) DICOM text file format:
97
98The DICOM files are converted to a simple text format. You may create your own file with the following format (see e.g. 14196616.g4dcm):
99
100- A line with the number of materials
101- A line for each material with its index and name (the same name of materials that you construct as G4Material's)
102- A line with the number of voxels in X, Y and Z
103- A line with the minimum and maximum extension in X (mm)
104- A line with the minimum and maximum extension in Y (mm)
105- A line with the minimum and maximum extension in Z (mm)
106- A number of lines containing the nVoxelX*nVoxelY*nVoxelZ material indices (one per voxel)
107- A number of lines containing the nVoxelX*nVoxelY*nVoxelZ material densities (one per voxel)
108
109As 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.
110
111--->9) Choosing different parameterisation/navigation options:
112
113There are four possible ways in GEANT4 to treat the navigation in regular voxelised volumes:
114
115- 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
116- The optimisation with G4SmartVoxel: a 3D grid is built, so that the location of voxels is fast, but it requires a lot of memory
117- Using G4NestedParameterisation. The search is done hierarchically in X, Y and Z. It is fast and does not require big memory
118- 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
119
120You can select amont the four options in the following way:
121
122- By default the example will run with G4RegularNavigation
123
124- To use the first option at RegularDicomDetectorConstruction.cc you just have to set
125
126  patient_phys->SetRegularStructureId(0);
127
128- To use the second option apart from the change above at RegularDicomDetectorConstruction.cc you have to replace (i.e. use kUndefined)
129
130  G4PVParameterised * patient_phys = new G4PVParameterised("Patient",voxel_logic,container_logic,
131                        kXAxis, nVoxelX*nVoxelY*nVoxelZ, param);
132
133by
134
135  G4PVParameterised * patient_phys = new G4PVParameterised("Patient",voxel_logic,container_logic,
136                        kUndefined, nVoxelX*nVoxelY*nVoxelZ, param);
137
138- To use the third option you have to set the enviromental variable DICOM_NESTED_PARAM to 1
139
Note: See TracBrowser for help on using the repository browser.