<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?action=history&amp;feed=atom&amp;title=Software%2FGeant4%2FTutorials%2FAdvanced%2FComputed_Tomography</id>
	<title>Software/Geant4/Tutorials/Advanced/Computed Tomography - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?action=history&amp;feed=atom&amp;title=Software%2FGeant4%2FTutorials%2FAdvanced%2FComputed_Tomography"/>
	<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Software/Geant4/Tutorials/Advanced/Computed_Tomography&amp;action=history"/>
	<updated>2026-04-06T19:29:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Software/Geant4/Tutorials/Advanced/Computed_Tomography&amp;diff=1099&amp;oldid=prev</id>
		<title>JordanSilverman: Formatting changes and tweaks of information contained</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Software/Geant4/Tutorials/Advanced/Computed_Tomography&amp;diff=1099&amp;oldid=prev"/>
		<updated>2017-09-26T09:54:16Z</updated>

		<summary type="html">&lt;p&gt;Formatting changes and tweaks of information contained&lt;/p&gt;
&lt;a href=&quot;https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Software/Geant4/Tutorials/Advanced/Computed_Tomography&amp;amp;diff=1099&amp;amp;oldid=1094&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>JordanSilverman</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Software/Geant4/Tutorials/Advanced/Computed_Tomography&amp;diff=1094&amp;oldid=prev</id>
		<title>SimonJolly: Created page with &quot;== &lt;span style=&quot;color:#000080&quot;&gt; Introduction &lt;/span&gt; ==  This tutorial is based on the GEANT4 DICOM example originally developed by Louis Archambault, Luc Beaulieu and Vincent Hu...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Software/Geant4/Tutorials/Advanced/Computed_Tomography&amp;diff=1094&amp;oldid=prev"/>
		<updated>2017-09-20T13:44:51Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==  This tutorial is based on the GEANT4 DICOM example originally developed by Louis Archambault, Luc Beaulieu and Vincent Hu...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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 files (.g4bin) that can be read by GEANT4. Each of these files corresponds to a Z Computed tomography (CT) slice. Then, the .g4dcm (.g4bin) files are merged into one volume.    &lt;br /&gt;
&lt;br /&gt;
The geometry is constructed by voxelizing this volume. There are four navigation algorithms used to create the voxel geometry: &amp;#039;&amp;#039;&amp;#039;G4RegularNavigation&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;G4VNestedParameterisation&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;G4SmartVoxel&amp;#039;&amp;#039;&amp;#039;/&amp;#039;&amp;#039;&amp;#039;G4VoxelNavigation&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;G4PVReplica&amp;#039;&amp;#039;&amp;#039;.   &lt;br /&gt;
&lt;br /&gt;
The material for this volume is constructed by converting the pixel values (Hounsfield numbers) from the DICOM images to densities using the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/DICOM/CT2Density.dat Hounsfield scale]. Then, the densities are converted to material types according to this [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/DICOM/Materials.txt table].&lt;br /&gt;
&lt;br /&gt;
A simple monenergetic electron beam is simulated using &amp;#039;&amp;#039;&amp;#039;G4ParticleGun&amp;#039;&amp;#039;&amp;#039; class. The output of the tutorial is a text file with dose deposition in several voxels. The dose is scored using classes &amp;#039;&amp;#039;&amp;#039;G4MutiFunctionalDetector&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;G4VPrimitiveScorer&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;G4PSDoseDeposit3D&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;G4THitsMap&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/DICOM/dicom.png&lt;br /&gt;
&lt;br /&gt;
This is one of the DICOM files used in the tutorial.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder DICOMFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk&amp;#039;s password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir DICOMFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd DICOMFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOMFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOMFolder]$ cp -r /unix/pbt/tutorials/advanced/DICOM .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 DICOMFolder]$ mv DICOM DICOM_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/DICOMFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOMFolder]$ mkdir DICOM_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOMFolder]$ cd DICOM_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 DICOM_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/DICOMFolder/DICOM_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 DICOM_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro run.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ ./DICOM run.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a [http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/ExampleDICOM.html link] to the official DICOM tutorial explanation notes. We recommend to read it before proceeding with this tutorial.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The macro run.mac produces a text file &amp;#039;&amp;#039;&amp;#039;dicom.out&amp;#039;&amp;#039;&amp;#039; which includes the dose deposition in several voxels.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
; Chose among several voxelization algorithms&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RegularNavigation &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;G4RegularNavigation&amp;#039;&amp;#039;&amp;#039; class is the default class for this tutorial. This algorithm skips frontiers between voxels when they have the same material i.e. &amp;quot;replacing group of voxels with a smaller number of larger voxels&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4NestedParameterization &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
To run with this voxelization algorithm you need to set the variable &amp;#039;&amp;#039;&amp;#039;DICOM_NESTED_PARAM&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ export DICOM_NESTED_PARAM=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check if it is set correctly by typing in the command line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ env&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, compile and run the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ make &lt;br /&gt;
&lt;br /&gt;
[username@plus1 DICOM_build]$ ./DICOM run.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4SmartVoxel / G4VoxelNavigation &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Using smart voxels required a huge amount of memory. At /home/username/DICOMFolder/DICOM_source/src/DicomRegularDetectorConstruction.cc set&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
patient_phys-&amp;gt;SetRegularStructureId(0);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
compile and run the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ make&lt;br /&gt;
&lt;br /&gt;
[username@plus1 DICOM_build]$ ./DICOM run.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Change the type, energy and position of the incident particle&lt;br /&gt;
&lt;br /&gt;
At /home/username/DICOMFolder/DICOM_source/src/DicomPrimaryGeneratorAction.cc change the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4ParticleDefinition* particle = particleTable-&amp;gt;FindParticle(particleName=&amp;quot;e-&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleEnergy(100.*MeV);&lt;br /&gt;
&lt;br /&gt;
fParticleGun-&amp;gt;SetParticlePosition(G4ThreeVector(0.,0.,0.));&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
You can chose among several particles like &amp;quot;gamma&amp;quot;, &amp;quot;e+&amp;quot;, &amp;quot;alpha&amp;quot; and &amp;quot;He3&amp;quot;. Then, compile and run the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ make&lt;br /&gt;
&lt;br /&gt;
[username@plus1 DICOM_build]$ ./DICOM run.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Run the visualisation macro vis.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ ./DICOM vis.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will produce .prim file. You can open this file in DAWN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 DICOM_build]$ dawn g4_00.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will create 3D image showing the patient geometry and the incident electron beam. The image is big and it takes time to open:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/DICOM/g4_03.eps&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of computed tomography files with brief description]]&lt;/div&gt;</summary>
		<author><name>SimonJolly</name></author>
	</entry>
</feed>