+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DicomG4 | + + | README | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The DICOM application has been orignal developed by the Geant4 users: Louis Archambault,*Luc Beaulieu, +Vincent Hubert-Tremblay. *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 + Université Laval, Québec (QC) Canada And it has been deeply reviewed by Pedro Arce in December 2007. --->1) Introduction 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. You can find the phantom reproduced in the image PhantomCT.jpg. In the application the phantom is placed on a table. ---> 2) Installation: - A standard Geant4 example GNUmakefile is provided - Compile it with 'make' ---> 3) Run the example: - To run the environment variable G4LEDATA needs to be set, pointing to the low energy data base, G4EMLOW4.3 - batch mode: - $G4INSTALL/bin/Linux-g++/dicom run.mac - interactive mode: - $G4INSTALL/bin/Linux-g++/dicom the file vis.mac is read in order to visualise the phantom with OpenGL --->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. , 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, ...) --->6) Splitting materials in density intervals: In the class DicomDetectorConstruction, it is defined a density interval G4double densityDiff = 0.1; 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