Computed tomography

From UCL HEP PBT Wiki

(Difference between revisions)
Jump to: navigation, search
m
m
Line 58: Line 58:
</pre>
</pre>
-
; Before running the code you can chose among several voxelisation algorithms.   
+
; Before running the code you can chose among several voxelization algorithms.   
* Using <span style="color:#ff0000"> G4RegularNavigation </span>:
* Using <span style="color:#ff0000"> G4RegularNavigation </span>:

Revision as of 08:53, 1 September 2014

Contents

Introduction

This tutorial is based on the GEANT4 DICOM example originally developed by Louis Archambault, Luc Beaulieu and Vincent Hubert-Tremblay. In this example a list of DICOM files (.dcm) are converted to ASCII files (.g4dcm) and binary (.g4bin) that can be read by GEANT4. Each of these files corresponds to a Z slice. Then, the .g4dcm (.g4bin) files are merged into one unique volume and used by GEANT4 to construct patient geometry and materials.

The geometry is constructed by voxelizing the volume. There are four navigation algorithms used to create the voxel geometry: G4RegularNavigation, G4VNestedParameterisation, G4SmartVoxel/G4VoxelNavigation and G4PVReplica.

The material is constructed by converting the pixel values (Hounsfield numbers) from the DICOM images to densities using the Hounsfield scale. Then, the densities are converted to material types according to this table.

A simple monenergetic electron beam is simulated using G4ParticleGun class. The output of the tutorial is a text file with dose deposition in several voxels. The dose is scored using classes G4VSensitiveDetector and G4THitsMap.

dicom.png

This is one of the DICOM files that is used in the tutorial.

How to run the tutorial

Connect to the HEP cluster and create folder DICOMFolder in your area
ssh -X username@plus1.hep.ucl.ac.uk 

username@plus1.hep.ucl.ac.uk's password: type your password here

[username@plus1 ~]$ mkdir DICOMFolder 

[username@plus1 ~]$ cd DICOMFolder  
Setup your environment
[username@plus1 DICOMFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  
Copy the code to your working directory and rename it
[username@plus1 DICOMFolder]$ cp -r /unix/pbt/tutorials/advanced/DICOM .
  
[username@plus1 DICOMFolder]$ mv DICOM DICOM_source
Inside /home/username/DICOMFolder/ create a directory
[username@plus1 DICOMFolder]$ mkdir DICOM_build  
To compile the code enter this directory and run cmake and make
[username@plus1 DICOMFolder]$ cd DICOM_build 

[username@plus1 DICOM_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/DICOMFolder/DICOM_source 

[username@plus1 DICOM_build]$ make  
Before running the code you can chose among several voxelization algorithms.
  • Using G4RegularNavigation :

It is a special algorithm to navigate in a regular voxelised geometry. It includes an option to skip frontiers between voxels when they have the same material i.e. "replacing group of voxels with a smaller number of larger voxels". G4RegularNavigation class is the default setup for this tutorial. To run with the default settings simply run macro run.mac.

[username@plus1 DICOM_build]$ ./DICOM run.mac
  • Using G4NestedParameterization :
[username@plus1 DICOM_build]$ export DICOM_NESTED_PARAM=1

You can check if you set this environment variable correctly by typing in the command line

[username@plus1 DICOM_build]$ env

Then, run the code:

[username@plus1 DICOM_build]$ ./DICOM run.mac
  • Usinging G4SmartVoxel / G4VoxelNavigation :

Using smart voxels required a huge amount of memory. At /home/username/DICOMFolder/DICOM_source/src/DicomRegularDetectorConstruction.cc set

patient_phys->SetRegularStructureId(0);

compile and run the code:

[username@plus1 DICOM_build]$ make

[username@plus1 DICOM_build]$ ./DICOM run.mac

How to analyze data

This is a link to the official DICOM explanation notes. We recommend to read it before proceeding with this tutorial.

Text files

The macro run.mac produces a text file which includes the dose deposition in several voxels.

Visualisation

Run the visualisation macro vis.mac

[username@plus1 DICOM_build]$ ./DICOM vis.mac

which will produce .prim file. You can open this file in DAWN

[username@plus1 DICOM_build]$ dawn g4_00.prim

This will create 3D image showing the patient geometry and the incident electron beam. The image is big and it takes time to open:

http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/DICOM/g4_03.eps

Personal tools