Electricity and MagnetismSimulation Worksheets and LabsP.docx
RFP_2016_Zhenjie_CEN
1. MÉMOIRE
présenté devant
L’Institut National des Sciences Appliquées de Lyon
pour obtenir
LE GRADE DE MASTER
par
Zhenjie CEN
Phase Contrast Simulator on VIP
Enseignant référent :
Nicolas DUCROS
Tuteurs de stage :
Jean-Michel LÉTANG
Max LANGER
Simon RIT
soutenu le 31 août 2016 devant le jury
Philippe DELACHARTRE Professeur
Rémy PROST Professeur
Nicolas DUCROS Maître de Conférence
Thomas GRENIER Maître de Conférence
2. ii
“La perfection est atteinte, non pas lorsqu’il n’y a plus rien à ajouter, mais lorsqu’il n’y a
plus rien à retirer.”
Antoine de Saint-Exupéry
3. iii
NATIONAL INSTITUTE OF APPLIED SCIENCES OF LYON
Abstract
ELECTRICAL ENGINEERING DEPARTMENT
MASTER’S DEGREE
Phase Contrast Simulator on VIP
by Zhenjie CEN
This report describes the design and development of the X-ray phase contrast imaging
feature for the medical imaging and radiotherapy simulator GATE. The implementation
includes a Monte Carlo simulation of the stochastic process for attenuation imaging and an
analytical model for Fresnel diffraction effect. The phase contrast imaging is an imaging
modality taking advantage of phase-shift of X-Rays. This modality allows to produce
images with a higher sensibility than conventional absorption based imaging. The program
was written in C++ to run under the Unix-like operating systems and be deployed over
distributed computing infrastructures like VIP. The solution tried to make maximum use
of abstract data types and insisted on software re-use. The implementation is validated
through several simulations and comparisons with theoretical values and real data. The
limits of the current implementation and possible solutions are discussed at the end of this
report. The report includes a full user manual, as well as an example macro showing the
usage of these new features.
4. iv
INSTITUT NATIONAL DES SCIENCES APPLIQUÉES DE LYON
Résumé
DÉPARTEMENT GÉNIE ÉLECTRIQUE
GRADE DE MASTER
Phase Contrast Simulator on VIP
par Zhenjie CEN
Ce rapport décrit la conception et le développement de la fonctionnalité de l’imagerie
par contraste de phase par rayons X pour le simulateur de l’imagerie médicale et de
la radiothérapie GATE. L’implémentation comprend une simulation de Monte-Carlo du
processus stochastique pour l’imagerie par atténuation et un modèle analytique pour l’effet
de diffraction de Fresnel. L’imagerie par contraste de phase est une modalité d’imagerie
profitant du déphasage du rayon X. Cette modalité permet de produire des images avec une
sensibilité plus élevée que l’imagerie conventionnelle basée sur l’absorption. Le programme
a été écrit en C++ pour fonctionner sous des systèmes d’exploitation du type Unix et être
déployées sur des infrastructures informatiques distribuées comme VIP. La solution a visé à
utiliser au maximum des types de données abstraits et a insisté sur la réutilisation du code.
L’implémentation est validée par plusieurs simulations et comparaisons avec la théorie et
les données réelles. Les limites de l’implémentation actuelle et les solutions possibles sont
discutées à la fin de ce rapport. Le rapport comprend un manuel d’utilisation complet,
ainsi qu’un exemple macro montrant l’utilisation de ces nouvelles fonctionnalités.
5. v
Acknowledgements
The opportunity I had with the CREATIS laboratory at the Léon Bérard cancer treat-
ment center was a great chance for learning and professional development. I perceive this
opportunity as a big milestone in my career development. Therefore, I consider myself a
very lucky person because I was given the opportunity to be a part of it. I am also grateful
to have the chance to meet so many wonderful people and professionals. I would like to
take this opportunity to express my gratitude to all people with whom I worked during
this internship.
Especially, I want to express my deepest gratitude and special thanks to my supervi-
sors, Dr. Jean-Michel Létang, Dr. Simon Rit and Dr. Max Langer, who accepted me into
the project and took time out to hear, guide and keep me on the correct path in spite of
being extraordinarily busy with their duties.
I want to express my appreciation to the research director, Dr. David Sarrut, for
taking part in important decisions and giving necessary advices and guidance. I choose
this moment to acknowledge his contribution gratefully.
I also want to thank Dr. Nicolas Ducros and the entire teaching staff for training,
giving advices and having provided the necessary knowledge and skills for me to conduct
the project.
Finally, I would like to say thanks to my family, my friends and all those who have
given me advice during this internship.
8. viii
List of Figures
2.1 Geometry of Fresnel diffraction. (x, y) are the coordinates in the diffraction
plane, z is the beam propagation direction and Σ is the support of the
transmittance function T(x, y). Each point in the object plane contributes
to each point in the diffraction plane at distance D (Langer, 2008). . . . . . 10
3.1 Flowchart of the XrayBoundary process. . . . . . . . . . . . . . . . . . . . . 15
3.2 Flowchart of the Fresnel diffraction actor. . . . . . . . . . . . . . . . . . . . 15
3.3 Schematic diagram of the simulation setup for refraction testing. The pho-
ton’s trajectory is marked in red. . . . . . . . . . . . . . . . . . . . . . . . . 16
3.4 Simulated result of refraction testing. . . . . . . . . . . . . . . . . . . . . . . 17
3.5 Schematic diagram of simulation setup for total reflection testing. The
photon’s trajectory is marked in red. . . . . . . . . . . . . . . . . . . . . . . 17
3.6 Simulated result of total reflection testing. . . . . . . . . . . . . . . . . . . . 18
3.7 The phantom is an aluminium wire (blue) which has a radius of 15.208 µm.
The refractive index decrement of aluminium at 19 keV is δ = 2.0 × 10−6.
To capture the image, we use a flat panel detector (yellow) with a pixel size
of 1 µm. For the sake of simplicity, only one photon’s trajectory is displayed
(green). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.8 Profile comparison between the stochastic model and the analytical model.
The green curve is obtained with the Monte Carlo refraction model. The
blue curve is obtained with the analytical Fresnel diffraction model imple-
mented in Octave by Loriane Weber of ESRF. . . . . . . . . . . . . . . . . . 19
3.9 The phantom is a voxelized tungsten wire with the radius of 5 µm. The
refractive index decrement of tungsten at 19 keV is δ = 9.0 × 10−6. To
capture the image, we use a flat panel detector with a pixel size of 1 mm. . 20
3.10 Profile comparison between our implementation in GATE and Loriane We-
ber’s implementation in Octave. The green curve is obtained with our code.
The blue curve is obtained with Loriane Weber’s code. . . . . . . . . . . . . 20
3.11 Projection of three wires: Aluminium, Magnesium and PET (Frachon et al.,
2015). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.12 Profile comparison between the Monte Carlo simulation result and the real
values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.1 Schematic of Monte Carlo phase contrast imaging of a voxelized tungsten
cylinder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 Profile of the Monte Carlo phase contrast imaging of a voxelized tungsten
cylinder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3 Phase-shift of a photon due to the changes of travelling distance. . . . . . . 24
9. ix
4.4 Schematic of the local envelope surface solution. . . . . . . . . . . . . . . . 25
A.1 List of estimated tasks with expected duration. . . . . . . . . . . . . . . . . 26
A.2 Gantt chart of project planning. . . . . . . . . . . . . . . . . . . . . . . . . 26
A.3 List of tasks with actual duration. . . . . . . . . . . . . . . . . . . . . . . . 27
A.4 Gantt chart of actual progress of the project. . . . . . . . . . . . . . . . . . 27
10. x
List of Abbreviations
CAGR Compound Annual Growth Rate
DABAX DAtaBAse for X-ray applications
DFT Discrete Fourier Transform
ESRF European Synchrotron Radiation Facility
GATE Geant4 Application for Tomographic Emission
GEANT4 GEometry ANd Tracking 4
ITK Insight segmentation and registration ToolKit
PCI Phase Contrast Imaging
PET PolyEthylene Terephthalate
RTK Reconstruction ToolKit
VIP Virtual Imaging Platform
11. xi
Physical Constants
Speed of Light c = 2.997 924 58 × 108 m s−1 (exact)
Planck Constant h = 6.626 070 04 × 10−34 m2 kg s−1
Electron Rest Mass me = 9.109 382 15 × 10−31 kg
Avogadro Constant NA = 6.022 140 85 × 1023 mol−1
Classical Electron Radius re = 2.817 940 32 × 10−15 m
12. xii
List of Symbols
A atomic mass u
D distance from object to diffraction plane m
E X-ray energy J
E0 amplitude
Ek kinetic energy J
f frequency Hz
f1,2 anomalous scattering factor
k wave number m−1
M molar mass kg mol−1
mf number of horizontal pixels
N number of photons
n number density m−3
nf number of vertical pixels
n complex refractive index
W work function J
Z atomic number
β absorption index
δ refractive index decrement
θc critical angle rad
θi angle of incidence rad
λ wavelength m
µ linear absorption coefficient m−1
ρ density kg m−3
σ absorption cross section m2
σx,pixel horizontal pixel size m
σy,pixel vertical pixel size m
13. 1
Chapter 1
Introduction
This report is a description of my internship carried out as a compulsory component to
complete the engineer education and obtain the engineer’s degree in electrical engineering.
After graduation, I want to work as a modelling and simulation engineer in the health-
care domain in my first job. The nature of a modelling and simulation engineer’s work is
to design and implement new simulation models and tools in response to new needs that
emerge. This job requires the candidate to be an engineer who has acquired a high level of
expertise in the field of applied mathematics and computer science to be able to proceed
with the analysis and evaluation of models in place and new model development.
In fact, the medical simulation improves patient outcomes, facilitates increased task
proficiency and patient safety, reduces medical errors, and enhances professional communi-
cation and team management skills, which reduces the overall healthcare costs. Therefore,
an increased number of medical schools, training centers, and military organizations are
adopting simulation technologies. In addition, there is an increasing adoption of techno-
logically advanced simulation systems to create clinical condition situations so that the
actual operations on patients can be done with minimized errors.
According to the report “Healthcare/Medical simulation Market by Product (Patient
Simulator, Surgical Simulator, Web-based Simulation, Simulation Software, Dental Simu-
lator, Eye Simulator), End-User (Academics, Hospitals, Military) & by Services - Global
Forecasts to 2019”, the global healthcare/medical simulation market is expected to reach
$2,069.2 million by 2019 from $863.5 million in 2014 and, at a CAGR1 of 19.1% from 2014
to 2019.
Therefore, from the social and economical point of view, being a modelling and simu-
lation engineering in healthcare domain has a promising future.
The reason why I carried out my internship within the CREATIS laboratory is, on the
one hand, the CREATIS laboratory has proven its excellence and international influence
in the identification of major health issues that can be addressed by imaging and identifi-
cation of theoretical barriers in biomedical imaging related to signal and image processing,
modelling and numerical simulation, on the other hand, I could work directly as a medical
simulator developer with researchers in a cutting-edge and widely used simulation tool
development project.
This internship allowed me to discover the real work content of a medical imaging
software engineer and how the research is combined with the real-world application in a
medical imaging laboratory in direct cooperation with the Léon Bérard cancer treatment
center and learn their scientific method used in the research that has led to so many
1
Compound Annual Growth Rate
14. 2 Chapter 1. Introduction
successful results. Besides, this internship helped me confirm my interest in the career
and gave me the first precious experience in the related field.
During the internship, I held the position of software developers and my assignments
were as follows:
• preliminary study;
• simulation functionality development;
• summary of work completed.
By working on the assigned tasks, I practiced and improved the different skills I developed
during my education such as:
• reading and analyzing academic articles;
• goal setting and time management;
• cooperative software development;
• object-oriented programming in C++;
• Linux system fundamentals and shell scripting;
• software development process and use of tools.
1.1 Context
Medical imaging is the technique and process of creating visual representations of the
interior of a body for clinical analysis and medical intervention, as well as a visual rep-
resentation of the function of some organs or tissues. Medical imaging seeks to reveal
internal structures hidden by the skin and bones, as well as to diagnose and treat disease.
Radiography is an imaging technique that uses electromagnetic radiation other than
visible light, especially X-rays, to view the internal structure of a non-uniformly composed
and opaque object. When imaging an object using X-ray, a beam of X-rays is produced
and projected toward the sample. A certain amount of X-ray is absorbed when passing
through the object, which depends on the physical properties of the sample. This process
is called the attenuation of X-ray beam, which results in the contrast of the clinical image
captured by a detector placed on the other side of the sample.
During the past twenty years, there has been a significantly growing interest in PCI2
based on coherent electromagnetic wave, particularly at X-ray energies. In X-ray PCI,
the transmission of coherent X-rays properties through matter can be described in terms
of the complex refractive index n. The real (1 − δ) and imaginary (β) parts of n are,
respectively, related to the phase-shift and the absorption. Unlike conventional absorption-
based imaging, which is only sensitive to the attenuation of the incoming X-ray beam, PCI
also relies on the phase-shift of X-rays occurring when they pass through a medium. This
modality offers a better sensitivity than conventional radiology, since for hard X-rays (10–
100 keV) and low-Z materials (such as soft tissues), refraction is at least two or three orders
of magnitude higher than the absorption at typical imaging energies (Momose et al., 1996).
Today, several X-ray phase contrast imaging techniques have been developed and they
are all based on the observation of interference patterns which are transformed into varia-
tions in intensity to be recorded by the detector. The most common techniques are crystal
interferometry, propagation-based imaging, analyzer-based imaging, edge-illumination and
grating-based imaging.
2
Phase Contrast Imaging
15. 1.2. Outline 3
1.1.1 Problem Definition
The purpose of this project is to develop a phase contrast imaging solution for the
VIP3 (Glatard et al., 2013) developed at the CREATIS laboratory. The solution is a
combination of a Monte Carlo simulation of the stochastic process for attenuation imag-
ing with an analytical model for phase-shift.
One important part of the project is the use of the Monte Carlo method to model the
stochastic movement of particles.
A rigorous description of phase contrast imaging requires the Fresnel-Kirchhoff diffrac-
tion theory which has to be solved numerically and that can be very computationally-
intensive. A Monte Carlo approach could avoid storing the wavefront in the Fresnel-
Kirchhoff diffraction integral approach which limits the domain size.
Another advantage of the Monte Carlo approach is that the method is highly paral-
lelizable. In fact, for many problems, finding analytical solutions is sometimes difficult or
even impossible for complex geometries like the anatomy of a patient. However, given the
model of the considered media and the source of the particle beam, we can determine the
evolution of every particle (energy, direction) after each interaction and the larger simu-
lation size, which means the more particles, we use, the better we can reproduce complex
geometry and source properties. The parallelization allows us to handle these complex
geometries in an efficient way.
As Monte Carlo method focuses on the evolution of individual particles, it isn’t con-
sidered appropriate for describing coherence effect. However, in conditions of limited
coherence, a simpler ray-tracing approach can also be used to reproduce the formation of
phase contrast images (Cipiccia et al., 2014).
As GATE4 is an advanced open source medical imaging simulator developed by the
international OpenGATE collaboration based on the Geant45 particle simulation toolkit,
when developing new functionalities, some guidelines need to be followed to improve or at
least maintain the readability, maintainability and compatibility with existing code. The
programming solution is, in fact, made up of a series of little choices. The difficulty lies in
making choices wisely to fit the best with the existing code and to avoid introducing too
many dependencies.
Another difficulty is that the source code of GATE doesn’t have an up to date developer
manual. This is because of the fact that the source code is updated more frequently than
the document and outdated documents might be worse than no document at all. How to
understand the logic and quickly locate the interest part in a large piece of source code is a
tricky challenge. Thankfully, Unix-like operating systems offer a bunch of native powerful
tools which can make things much easier.
1.2 Outline
In chapter 2, the theory behind the development is presented. We describe the interaction
between X-rays and matter and how it plays a role in image formation in a general way.
We then talk about the attenuation, the refraction and the Fresnel diffraction, which are
the most important aspects involved in the phase contrast imaging. This chapter is based
primarily on the work of Max Langer (Langer, 2008) and the book Introduction To Fourier
Optics (Goodman, 1996).
3
Virtual Imaging Platform
4
Geant4 Application for Tomographic Emission
5
GEometry ANd Tracking
16. 4 Chapter 1. Introduction
In chapter 3, we talk about the development of the phase contrast simulation function-
ality. We first present the solution in a general way. We then discuss the design in detail
and we finish the chapter by describing the test and validation of the implementation.
In chapter 4, we summarize the results obtained and discuss the limits of the current
solution. Finally, we conclude by indicating the direction of the future development. In
particular, we discuss how to overcome the limits present in our current solution.
17. 5
Chapter 2
Theoretical Background
In this chapter, we aim to provide the theoretical background of X-ray optics involved in
image formation. X-ray optics is the branch of optics that manipulates X-rays instead of
visible light. While lenses for visible light are made of transparent materials that can have
a refractive index substantially larger than 1, for X-rays the index of refraction is slightly
smaller than 1.
2.1 X-Ray Image Formation
When an X-ray beam passes through an object, it will be affected in terms of amplitude
and phase-shift. These two aspects lead to, attenuation and diffraction, the two main
phenomena involved in the contrast formed by X-rays. We first study the physics of X-
rays interactions with matter. Then, we describe in detail different processes behind these
two phenomena and their relation to the contrast formation.
2.1.1 Wave-Object Interaction
When X-rays encounter an object, some part of it will always be attenuated by photoab-
sorption and coherent scattering, and it might pass through the object with a phase-shift.
To take the absorption and phase-shift into account at the same time, the X-rays interac-
tion with matter can be described by a complex refractive index n defined as
n = 1 − δ + iβ, (2.1)
where the refractive index decrement δ determines the phase-shift and the absorption
index β relates to the linear absorption coefficient µ through µ = 4πβ/λ, where λ is the
wavelength.
In fact, if we assume a monochromatic plane wave with no polarization propagating
in the vacuum in the direction normal to the surface of the medium z, the scalar wave
function is
Ψ(z) = E0eikz
. (2.2)
Within the medium, the angular wave number changes from k to nk. The wave function
becomes
Ψ(z) = E0einkz
= E0ei(1−δ)kz
e−βkz
, (2.3)
where δkz is the phase-shift and e−βkz is an exponential decay factor decreasing the
amplitude E0 of the wave (Nielsen, 2011).
18. 6 Chapter 2. Theoretical Background
2.2 Attenuation
As we consider the interaction of hard X-rays (10–100 keV) with matter, in this energy
range the main processes that contribute to the attenuation are photoelectric absorption,
Rayleigh and Compton scattering.
2.2.1 Photoelectric Absorption
The photoelectric absorption refers to the energy loss due to the photoelectric effect. In
the interaction with matter of a photon with frequency f, if the photon’s frequency is
above the threshold frequency, below which no photoelectron can escape, electrons are
dislodged and emitted with a kinetic energy
Ek = hf − W, (2.4)
where h is the Planck constant and f is the frequency of the incident photon. The term
W refers to the work function which gives the minimum thermodynamic work needed to
remove an electron from a solid to a point in the vacuum immediately outside the solid
surface.
The atomic photoelectric cross section σ is dependent on the X-ray energy E and the
atomic number Z (Langer, 2008)
σphotoelectric ∝
Z5
E3.5
. (2.5)
2.2.2 Rayleigh Scattering
Rayleigh scattering is the elastic scattering of light or other electromagnetic radiation by
particles much smaller than the wavelength of the radiation. The photon’s energy doesn’t
change in Rayleigh scattering, only its travelling path is deviated. The Rayleigh scattering
cross section depends on the X-ray energy E and atomic number Z as (Langer, 2008)
σRayleigh ∝
Å
Z
E
ã2
. (2.6)
2.2.3 Compton Scattering
Unlike Rayleigh scattering, Compton scattering is the inelastic scattering of a photon by
a charged particle, usually an electron, which means there is energy loss in the process.
In Compton scattering, the wavelength of the scattered light is different from that of
the incident radiation because part of the photon’s energy is transferred to the recoiling
electron. The amount of wavelength variation is called the Compton shift and satisfies the
relation
λ − λ =
h
mec
(1 − cos θ), (2.7)
where λ is the initial wavelength, λ is the wavelength after scattering, h is Planck constant,
me is the electron rest mass, θ is the scattering angle and c is the speed of light in vacuum.
The Compton scattering cross section depends on the X-ray energy E and atomic number
Z as (Langer, 2008)
σCompton ∝
Zmec
E + mec2
. (2.8)
19. 2.3. Theory of Phase Contrast Imaging 7
2.2.4 Total Attenuation Coefficient
The attenuation mesured by the detector is described by the linear attenuation coefficient
µ which is proportional to the total cross section
σtot = σphotoelectric + σRayleigh + σCompton. (2.9)
The linear attenuation coefficient µ is then
µ =
NAρσtot
A
, (2.10)
where ρ is the density of the material, NA is Avogadro constant and A is the atomic mass
of the material.
2.2.5 Beer-Lambert Law
If we consider an X-ray beam passing through a medium, with N(z, E) the number of
photons at a certain energy E, the expected number of photons that interact and are
removed from the X-ray beam over an infinitesimal distance is proportional to the negative
of the number of incident photons is given by the Beer-Lambert law
dN = −µ(z, E)N(z, E)dz. (2.11)
The solution to this differential equation is given by
N(z, E) = N0(E) exp
ï
− µ(z, E)dz
ò
, (2.12)
where N0(E) = N(z0, E) is the number of incident photons. In case of homogeneous
objects, the solution can be simplified by
N(z, E) = N0(E) exp [−µ(E)z] . (2.13)
2.3 Theory of Phase Contrast Imaging
There are, in fact, two different mathematical models describing the phase contrast imag-
ing: the simpler one which uses the ray-optical approach and describes the phenomenon
as refraction of X-rays in an object and the more rigorous one which is based on the
wave-optical approach, describes the diffracted X-ray wave field according to the paraxial
Fresnel diffraction theory. It is possible to demonstrate that the ray-optics results can also
be obtained by opportunely developing the diffraction formalism only with some restric-
tions on the spatial frequencies present in the final image, without any limitation on the
maximum phase shift (Peterzol et al., 2005).
2.3.1 Refraction
Rays travelling in a homogeneous medium (i.e., a medium with constant index of refrac-
tion) always travel in straight lines. However, when the wave travels through a medium
having a refractive index that changes in space, the propagation direction will change
depending on the changes of refractive index.
20. 8 Chapter 2. Theoretical Background
Refractive Index
As we can see, the complex refractive index n (2.1) can be separated into two parts: the
refractive index decrement δ and the absorption index β. For a simple substance, these
components can be calculated from the atomic scattering factors f1 and f2 using
δ =
nreλ2
2π
f1 (2.14)
β =
nreλ2
2π
f2, (2.15)
where re is the classical electron radius, λ is the wavelength of the X-ray and n is the
number density
n =
ρNA
M
, (2.16)
where ρ is the mass density, NA the Avogadro constant and M the molar mass.
For a multi-component system composed of n elements, the refractive index decrement
can be calculated by simply using a weighted sum of the contributions from each element:
δ =
ρ
E2
n
i=1
ci · K · (Zi + f1i)
Mi
, (2.17)
where ρ is the mass density, E is the X-ray’s energy, Z is the atomic number, f1i is the
real part of the dispersion correction, Mi is the atomic weight, ci is the weighting factor
and K is the pre-calculated constant value
K =
reNA
2π
(hc)2
. (2.18)
Snell’s Law
When a wave encounters an abrupt boundary between two media having different refrac-
tive indices, the propagation directions are changed suddenly as they pass through the
interface. The angles of incidence θ1 and refraction θ2 are related by Snell’s law,
n1 sin θ1 = n2 sin θ2, (2.19)
where n1 and n2 are respectively the refractive indices of the first and second medium.
When a wave enters a medium with higher refractive index, the angle of refraction will
be smaller than the angle of incidence and the wave will be refracted towards the normal
of the surface. The higher the refractive index, the closer to the normal direction the wave
will travel. When passing into a medium with lower refractive index, the light will be
refracted away from the normal.
Total External Reflection
X-ray refractive indices are smaller than but very close to 1. Thus, total external reflection
may occur at a sufficiently small grazing angle. This can be compared to total internal
reflection for visible light.
Visible light can be totally reflected when travelling from a denser medium into a less
dense medium. As for X-rays, the beam can be totally reflected when travelling from a
less dense medium into a denser medium.
The critical angle is the angle of incidence at which total external reflection occurs.
The critical angle θc can be calculated using Snell’s law (2.19). The total external reflection
21. 2.3. Theory of Phase Contrast Imaging 9
occurs when the angle of refraction is 90◦ and thus sin θ2 = 1. The angle of incidence is
then equal to the critical angle θc. We can deduce the critical angle by solving for θi
θc = θi = arcsin
Å
n2
n1
ã
. (2.20)
We should notice that the function arcsin is undefined if the fraction n2/n1 is greater than
1 which means that the total external reflection doesn’t occur at any angle of incidence.
Thus, the critical angle is only defined when n2/n1 is smaller than 1.
2.3.2 Fresnel Diffraction
Here, we describe the Fresnel diffraction, which is an approximation of Fresnel-Kirchhoff
diffraction of the near-field diffraction with adaptation for X-ray source. We will show
that the diffraction pattern observed at a distance D from the object can be calculated
by a convolution of the exit wave u0 and the Fresnel propagator PD (Langer, 2008)
uD(x, y) = u0(x, y) ∗ PD(x, y). (2.21)
Exit Wave
From the point of view of wave optics, an object can be described by its complex refractive
index (2.1) distribution. The attenuation and the phase-shift induced by the object can
be expressed by integrals calculated over the entire object thickness
B(x, y) =
2π
λ object
β(x, y, z) dz (2.22)
φ(x, y) = −
2π
λ object
δ(x, y, z) dz. (2.23)
Here, the coordinates (x, y) represent the crossing point position in the object plane and
z is the propagation direction. By ignoring the propagation path changes and propagation
effects inside the object, we represent the object with the complex transmittance function
T(x, y) defined as
T(x, y) = exp (−B(x, y) + iφ(x, y)) . (2.24)
We can then express the exit wave which is the object’s influence on the incident wave
uinc(x, y) as
u0(x, y) = T(x, y) · uinc(x, y). (2.25)
In our case, the incident wave uinc(x, y) is always equal to 1.
Fresnel Propagator
The Rayleigh-Sommerfield diffraction integral describes the diffraction pattern created by
waves passing through an aperture or around an object
uD(x, y) =
1
iλ Σ
u0(x0, y0)
eik|r| cos θ
|r|
dx0dy0, (2.26)
where Σ is the object plane, k = 2π
λ is the angular wave number, |r| = D
cos θ is the distance
between points in the object plane (x0, y0) and the point in the diffraction plane (x, y)
and θ is the angle made by the vector r and the propagation direction z.
22. 10 Chapter 2. Theoretical Background
Figure 2.1: Geometry of Fresnel diffraction. (x, y) are the coordinates in
the diffraction plane, z is the beam propagation direction and Σ is the sup-
port of the transmittance function T(x, y). Each point in the object plane
contributes to each point in the diffraction plane at distance D (Langer,
2008).
Because for X-rays the angle θ is small, we have cos θ ≈ 1 and |r| ≈ D. Another way
to write |r| is
|r| =
»
D2 + (x − x0)2 + (y − y0)2 (2.27)
= D
ñ
1 +
Å
x − x0
D
ã2
+
Å
y − y0
D
ã2
ô1/2
. (2.28)
We apply the binomial approximation to (2.28)
|r| ≈ D
ñ
1 +
1
2
Å
x − x0
D
ã2
+
1
2
Å
y − y0
D
ã2
ô
, (2.29)
which holds for
D3
max
π
4λ
î
(x − x0)2
+ (y − y0)2
ó2
. (2.30)
We substitute the approximation (2.29) into the Rayleigh-Sommerfield diffraction inte-
gral (2.26), replace the denominator by D and simplify cos θ by 1
uD(x, y) =
1
iλ Σ
u0(x0, y0)
exp
ß
ikD
ï
1 + 1
2
x−x0
D
2
+ 1
2
Ä
y−y0
D
ä2
ò™
D
dx0dy0. (2.31)
Thus
uD(x, y) =
exp(ikD)
iλD Σ
u0(x0, y0) exp
ß
iπ
λD
î
(x − x0)2
+ (y − y0)2
ó™
dx0dy0. (2.32)
The Fresnel integral (2.32) can be interpreted as a convolution of the exit wave u0 and
the Fresnel propagator by dropping the non-relevant (at the intensity level) phase factor
exp(ikD)
PD(x, y) =
1
iλD
exp
Å
i
π
λD
Ä
x2
+ y2
äã
. (2.33)
The Fresnel propagator can also be obtained by an analysis in the Fourier domain. In
this case, we obtain the Fourier transform of the The Fresnel propagator (2.33), which can
23. 2.3. Theory of Phase Contrast Imaging 11
be written as
˜PD(f) = exp(−iπλD|f|2
), (2.34)
where |f| defined as |f| =
»
f2
x + f2
y is the norm of the frequency vector f = (fx, fy).
24. 12
Chapter 3
Implementation and Software
Development Challenges
In this chapter, we first describe the challenging problems encountered during the imple-
mentation. Particularly, we discuss in detail the candidate solutions and the final chosen
solution to these problems. We then describe the tests used to validate our implementa-
tion.
3.1 Outline Solution
The implementation can, in fact, be divided into two parts: implementation of the ray-
optical approach and that of the wave-optical approach. The ray-optical approach requires
to use the Monte Carlo modality to control the evolution of each particle. Therefore, it was
implemented in Geant4 layer as a new physical process. The wave-optical approach allows
to obtain the diffraction patterns directly from the knowledge of the object’s geometry
and optical properties. Therefore, it was implemented as an actor in GATE layer. In the
following, we decompose our goal into several subproblems with candidate solutions and
we describe and discuss their the advantages and disadvantages.
3.1.1 Ray-Optical Approach
The ray-optical approach is implemented in a new Geant4 process as a part of the GATE’s
source code. We principally use the refraction theory described in the section 2.3.1 and
Geant4’s native mechanism to manipulate a particle’s movement. The procedure of im-
plementation is based on solving two problems
• where to put the code;
• how to get the medium’s refractive index.
Where to Put the Code
A new process is added to the Geant4 toolkit to implement the Monte Carlo simulation for
attenuation imaging. This process is defined as a discrete process for gamma photon and
will be called at the end of each simulation step. At first, we wanted to add this process
directly in the Geant4’s source code, because this solution has the advantage that the X-ray
refraction effect would from then on become available for all developers using the Geant4
toolkit. However Geant4 is a toolkit used by many other programs, bathe maintainers
25. 3.1. Outline Solution 13
will take a lot of time to carefully examine the code quality and the integration period is
normally very long.
Another problem is the new process will not appear in the next update before the code
is accepted. As a consequence, each time a new version of Geant4 is released before our
code is finally integrated into the project, we have to recompile our own version and make
sure that it still works.
The final chosen solution is to include the code in GATE’s source code. The feasibility
of this solution has already been proven by another process called G4Hybridino developed
by François Smekens in the same way.
How to Get the Medium’s Refractive Index
The refractive index of X-ray is different from that of optical photons and Geant4 toolkit
doesn’t provide these data.
The first solution that came up to us is to hard code the refraction indices into the
material properties of Geant4. But this is not a good idea because users will be limited
in terms of materials and energy ranges. We wanted to find a solution that can provide
the refractive index for any material and for any energy.
In the refractive index section 2.3.1, we have described the formulae for calculating the
refractive index for any material at a specified energy under the condition of knowing the
composition of the material. We only need the tabulated scattering factor values for all
of the known elements and there is already an available solution: DABAX1 provided by
the ESRF2.
The next problem is how to integrate these data files into our project. One lightweight
solution is to directly include the files we need in the GATE project. This solution doesn’t
create any additional persistent dependency, but we have to implement a parser to interpret
and retrieve the data we need. The reason why we didn’t choose this solution is that this
database has already undergone several updates since its first release. Data are corrected
from time to time and the format would possibly change in the future. When this happens,
we will have to update the parser to support the new format. As leaving this duty to its
original maintainer is a better choice, we finally decided to introduce the whole library
xraylib into the project.
3.1.2 Wave-Optical Approach
The wave-optical approach is to implement the Fresnel diffraction 2.3.2 as an actor. The
first step is to code the exit wave 2.3.2 which can be further divided into three parts:
• code the absorption index integral (2.22);
• code the refractive index decrement integral (2.23);
• code the complex transmittance function (2.24).
The computation of the absorption index integral has already been implemented in the
existing code. We reused the code and add another loop over the energies to compute
the ray line integral of refractive index decrement obtained with the library xraylib
introduced above. We created a functor called Transmittance which takes two integrals
computed previously as input and returns the complex transmittance array.
1
DAtaBAse for X-ray applications
2
European Synchrotron Radiation Facility
26. 14 Chapter 3. Implementation and Software Development Challenges
The second step is to generate the Fresnel propagator (2.33). Because we used the
convolution theorem (3.1) to perform the convolution (2.21), we chose to use the Fres-
nel propagator in the Fourier domain (2.34) in order to avoid precision loss due to an
unnecessary additional DFT3.
In order to create the Fresnel propagator array, an empty image with complex pixel
type of the same size as the transmittance array is allocated. A frequency vector f =
(fx, fy) is defined for each pixel. The component fx goes from − 1
2σx,pixel
+ 1
mf σx,pixel
to
1
2σx,pixel
with a step of 1
2mf σx,pixel
where σx,pixel is the horizontal pixel size and mf is the
number of horizontal pixels. The component fy has a similar expression which replaces
σx,pixel by σy,pixel, the vertical pixel size, and mf by nf , number of vertical pixels. Each
pixel value is set to |f| by an iterator looping through the entire image.
When saving the image, the Fresnel actor activation flag is checked. If it is set and the
output image file name is specified, the convolution (2.21) will be calculated. The library
ITK4 offers filters for computing the convolution. However, these filters accept only real
pixel images as input. Our solution is to do the computation in the Fourier domain using
the convolution theorem
F{f ∗ g} = F{f} · F{g}. (3.1)
We use the two following ITK filters for the computation:
• ComplexToComplexFFTImageFilter;
• MultiplyImageFilter.
3.2 Detailed Design
3.2.1 Ray-Optical Approach
The refraction process is implemented as a discrete process which is called at the end of
each step. When the process is triggered, it examines the previous and the current position
of a particle. If the two positions indicate a transition into another medium identified by
a change of refractive index, the process will be triggered to handle the refraction effect.
When the control is passed to the refraction process handler, it retrieves the particle’s
movement information and two pointers to volumes on both sides of the boundary. A call
to the xraylib returns the refractive indices of the two volumes. The Snell’s law (2.19)
is then applied to compute the refraction direction vector to be used to rectify the prop-
agation direction across the boundary. According to the angle of refraction calculated,
the algorithm decides whether the interaction should be treated as refraction or total
reflection.
3.2.2 Wave-Optical Approach
The Fresnel diffraction is implemented as an actor. The real and imaginary parts of the
transmittance function are independently calculated by ray-casting algorithm for each
pixel of the image. When the actor is activated, the SaveData function will check if the
file name is specified. If it is not empty, the functor called Transmittance will be invoked
and creates the transmittance function. The Fresnel propagator has already been created
in the initialization phase. The SaveData function will compute the result image with the
convolution theorem (3.1).
3
Discrete Fourier Transform
4
Insight segmentation and registration ToolKit
27. 3.2. Detailed Design 15
Begin process
Boundary reached?
Get refractive index
Get movement information
Apply Snell’s law
Total reflection? Apply reflection law
Set movement information
End process
yes
no
yes
no
Figure 3.1: Flowchart of the XrayBoundary process.
Begin process
Compute δ integrals
Compute β integrals
Create propagator map
Create transmittance map
Compute the convolution
End process
Figure 3.2: Flowchart of the Fresnel diffraction actor.
28. 16 Chapter 3. Implementation and Software Development Challenges
3.3 Test and Validation
The X-ray phase contrast imaging feature is validated by simulation. We used two exper-
iments to test the implementation:
• theoretical comparison;
• real data comparison.
The theoretical comparison involves two experiments. The first experiment compares
a single photon’s position in a simulation to the predicted position with Snell’s law. The
second experiment compares the profile of the simulated image to the profile obtained
with the phase contrast imaging code developed by Loriane Weber.
The real data comparison compares the simulated results with some real data from
the ESRF.
3.3.1 Theoretical Validation
We use a rectangular tungsten sheet to test the refraction and the total reflection. The
size of this rectangular sheet is 25 cm × 25 cm × 1 mm.
First Experiment
In the first experiment, we test only the refraction process.
Refraction The experiment setup is designed as shown in the figure 3.3.
Figure 3.3: Schematic diagram of the simulation setup for refraction test-
ing. The photon’s trajectory is marked in red.
We know the thickness e, the refractive index n2 and the tilt angle γ of the plane. We
aim to find the deviation distance d in the detection plane of the photon. Geometrically,
we have the following relations:
• |IJ| = e
cos(α);
• α = β;
• d = |IJ| sin(β − γ).
Thus, the distance d is given by the expression
d =
e sin(β − γ)
cos(α)
. (3.2)
Also, we have n1 sin γ = n2 sin β with Snell’s law (2.19). Numerically, we use the
following values for the simulation:
29. 3.3. Test and Validation 17
• e = 1 µm;
• γ = 86◦;
• n1 = 1;
• n2 = 0.999991.
Using the expression (3.2) and Snell’s law, we find the theoretical value of the distance
dtheory = 1.85 µm. We use a detection plane of size 10 µm × 10 µm × 1 nm with a spacing
of 0.1 µm to capture the photon.
Figure 3.4: Simulated result of refraction testing.
The simulation gives dsimulation = 0.1·18 = 1.8 µm. We notice that the simulated result
is in perfect accordance with the theoretical value calculated previously.
Total Reflection The experiment setup is designed as shown in the figure 3.5.
Figure 3.5: Schematic diagram of simulation setup for total reflection
testing. The photon’s trajectory is marked in red.
We know the tilt angle α, the distance |NH| between the contact point H and the
detection plane and the value of the angle ∠MHK. Geometrically, we have the following
relations:
• ∠MHK = ∠FHI = π
2 − α;
30. 18 Chapter 3. Implementation and Software Development Challenges
• β = α − ∠MHK = 2α − π
2 .
Thus, the distance d can be calculated by
d =
|NH|
tan 2α − π
2
. (3.3)
Numerically, we use the following values for the simulation:
• |NH| = 100 mm;
• α = 89.8◦.
We should notice that α is very close to 90◦ because the refractive index is very close to
1. With these values, we can calculate the theoretical value of the distance d with (3.3),
which gives dtheory = 698.14 µm.
As the distance d of the total reflection is far more important than that of the refraction,
we added a horizontal offset to the detection plane in order to capture the photon near
the center of the plane. The detection plane is in fact 800 µm to the right of the X-ray
source and has a size of 500 µm × 500 µm × 1 nm with a spacing of 1 µm.
Figure 3.6: Simulated result of total reflection testing.
The simulation gives dsimulation = 800 − (250 − 148.3) = 698.30 µm. We notice that the
simulated result is in perfect accordance with the theoretical value calculated previously.
Second Experiment
We use an aluminium wire with the radius of 15.208 µm for this simulation. The experi-
ment setup is shown in figure 3.7(a). The simulated result is shown in figure 3.7(b). We
compare the simulated image’s energy profile with that given by Loriane Weber’s program
which implemented an analytical model of Fresnel diffraction by a cylinder with specified
material (See figure 3.8).
We notice that the refraction model is good enough to approximate the Fresnel diffrac-
tion model under certain conditions.
We also compare our implementation of the Fresnel diffraction with Loriane Weber’s
implementation in Octave. We use a voxelized tungsten wire with the radius of 5 µm for
this simulation. The simulated image is shown in figure 3.9 and the profile comparison is
shown in figure 3.10.
We see in figure 3.10 that the peaks are close, but the blue peaks are narrower and
the vertex of the blue curve is much lower. Besides, we can see some oscillations near
31. 3.3. Test and Validation 19
(a) Simulation setup (b) Imaged phantom
Figure 3.7: The phantom is an aluminium wire (blue) which has a radius
of 15.208 µm. The refractive index decrement of aluminium at 19 keV is
δ = 2.0 × 10−6
. To capture the image, we use a flat panel detector (yellow)
with a pixel size of 1 µm. For the sake of simplicity, only one photon’s
trajectory is displayed (green).
Figure 3.8: Profile comparison between the stochastic model and the ana-
lytical model. The green curve is obtained with the Monte Carlo refraction
model. The blue curve is obtained with the analytical Fresnel diffraction
model implemented in Octave by Loriane Weber of ESRF.
32. 20 Chapter 3. Implementation and Software Development Challenges
Figure 3.9: The phantom is a voxelized tungsten wire with the radius
of 5 µm. The refractive index decrement of tungsten at 19 keV is δ = 9.0 ×
10−6
. To capture the image, we use a flat panel detector with a pixel size
of 1 mm.
Figure 3.10: Profile comparison between our implementation in GATE
and Loriane Weber’s implementation in Octave. The green curve is obtained
with our code. The blue curve is obtained with Loriane Weber’s code.
33. 3.3. Test and Validation 21
the two peaks of the green curve. This is possibly because our implementation doesn’t
have the resampling steps. If we add an oversampling step in the computation of the
transmittance function, we will be able to gain in precision of the integrals (2.22) and
(2.23). This oversampling will allow the green vertex to approach the blue one. However,
the simulator’s detector has a higher resolution than a real one, to be closer to the reality,
we should add an undersampling step in the final image to smooth the curve.
3.3.2 Comparison with Real-World X-Ray Images
We have proven the validity of the implementation in the previous section. The simulation
fits well with the theory. But it is always interesting to know the difference between the
reality and the simulation. Here, we compare the profile of a ESRF’s image 3.11 with
our simulation. The imaged object is composed of three wires twisted and we want to
compare with the aluminium wire because it has the biggest radius among the three and
is obvious enough to be identified. We choose a section where the aluminium wire is not
covered (near the center in this case) to avoid interference of the other two wires. The
profile comparison is shown in figure 3.12.
Figure 3.11: Projection of three wires: Aluminium, Magnesium and
PET (Frachon et al., 2015).
In spite of the noise in the real data, our simulation is in coherence with the projection.
The spikes caused by the wire’s border coincide with each other. However, the vertex due
to attenuation in the real projection image is more important. It should be noted that
the profiles are simply aligned without normalizing the real values. The normalization
consists in applying the transformation
I0 − Idark
Iflat − Idark
, (3.4)
where I0 is the original image, Idark is the image obtained without X-ray irradiation and
Iflat is the image obtained without the sample. Since we don’t have the reference images
Idark and Iflat, the normalization can not be done. But as we are only interested in
comparing the peaks, a simple alignment is sufficient.
34. 22 Chapter 3. Implementation and Software Development Challenges
Figure 3.12: Profile comparison between the Monte Carlo simulation re-
sult and the real values.
35. 23
Chapter 4
Conclusions
4.1 Results and Discussion
During the internship, a Monte Carlo based and an analytical model based X-ray phase
contrast imaging feature are developed. We added the X-ray phase contrast imaging capa-
bility to Geant4/GATE that can be used in medical imaging research. The implementation
is validated through several experiments.
4.1.1 Limits of the Current Solution
The current solution actually still has some drawbacks. In fact, the refraction effect works
only for analytical phantoms and the Fresnel diffraction effect imaging works only for
voxelized phantoms. We have these drawbacks because the implementation relies on the
Geant4/GATE’s internal mechanisms to manage geometries which don’t support both the
two types of phantom at the same time.
For example, the refraction effect doesn’t work correctly on a voxelized phantom be-
cause the latter consists of a bundle of voxels. When photons come in contact with the
voxelized phantom, they interact with the facets of its voxels in place of the phantom’s
actual surface which is the envelope surface of the voxels. As a consequence, the refraction
effect will not properly contribute to the contrast and we will only have the attenuation
effect. The figure 4.1 illustrates this situation. In order to verify this explanation, we use
a voxelized cylindrical phantom. The profile of the simulated result in shown in figure 4.2.
Figure 4.1: Schematic of Monte Carlo phase contrast imaging of a vox-
elized tungsten cylinder.
Another drawback of our solution is that the phase-shift is not taken into account in
the refraction process. In fact, when a photon’s trajectory is changed, its phase may also
change as shown in figure 4.3. In the current implementation, the photon’ energy is simply
accumulated algebraically. In order to code phase-shift in the refraction process, would
36. 24 Chapter 4. Conclusions
Figure 4.2: Profile of the Monte Carlo phase contrast imaging of a vox-
elized tungsten cylinder.
have to alter Geant4’s detector mechanism to make it be able to process complex pixels.
However, it is difficult to proceed like this because this modification will have a global
impact on many kinds of simulations.
Figure 4.3: Phase-shift of a photon due to the changes of travelling dis-
tance.
4.1.2 Perspective
We can eliminate the drawbacks about voxelized phantoms mentioned above by using the
corrected normal vector in the refraction process. The idea is to compute the normal
vector with regards to the local envelope surface of the contact voxel’s neighbourhood and
apply the Snell’s law relative to this vector. A schematic of this solution is illustrated in
figure 4.4.
The red line represents the incident ray and the refracted ray relative to the local
envelope surface (the green arc ˙EFG). The blue line represents the refracted ray relative
to the intended surface of the voxelized phantom (the dotted circle). With this solution
if we can wisely create the local envelope surface, the simulated results will still be good
enough.
37. 4.1. Results and Discussion 25
Figure 4.4: Schematic of the local envelope surface solution.
38. 26
Appendix A
Project Schedule
A.1 Original Project Schedule
Name Begin date End date
Etude préliminaire 4/11/16 4/28/16
Etude bibliographique 4/29/16 5/10/16
Revue des bases de données 4/29/16 5/10/16
Implémentation du code de simulation 5/11/16 7/22/16
approche corpusculaire probabiliste Monte-Carlo 5/11/16 6/9/16
approche ondulatoire déterministe 6/10/16 7/22/16
Comparaison des deux approches 7/25/16 8/23/16
Rédaction du rapport de stage 4/29/16 8/24/16
Etude du modèle ondulatoire Monte-Carlo 6/21/16 9/29/16
Simulateur de contraste de phase sur Gate Apr 28, 2016
Tasks 2
Figure A.1: List of estimated tasks with expected duration.
Simulateur de contraste de phase sur Gate Apr 28, 2016
Gantt Chart 3
Name Begin date End date
Etude préliminaire 4/11/16 4/28/16
Etude bibliographique 4/29/16 5/10/16
Revue des bases de données 4/29/16 5/10/16
Implémentation du code de simula... 5/11/16 7/22/16
approche corpusculaire probabil...5/11/16 6/9/16
approche ondulatoire détermini... 6/10/16 7/22/16
Comparaison des deux approches 7/25/16 8/23/16
Rédaction du rapport de stage 4/29/16 8/24/16
Etude du modèle ondulatoire Mont... 6/21/16 9/29/16
2016
April May June July August September
Figure A.2: Gantt chart of project planning.
39. A.2. Actual Project Schedule 27
A.2 Actual Project Schedule
Name Begin date End date
Etude préliminaire 4/11/16 4/28/16
Revue des bases de données 4/29/16 6/1/16
Implémentation du code de simulation 5/26/16 7/29/16
approche corpusculaire probabiliste Monte-Carlo 5/26/16 7/8/16
approche ondulatoire déterministe 7/11/16 7/29/16
Comparaison des deux approches 6/24/16 8/16/16
Rédaction du rapport de stage 7/8/16 8/24/16
Etude du modèle ondulatoire Monte-Carlo 8/25/16 9/23/16
Simulateur de contraste de phase sur Gate Aug 18, 2016
Tasks 2
Figure A.3: List of tasks with actual duration.
Simulateur de contraste de phase sur Gate Aug 18, 2016
Gantt Chart 3
Name Begin date End date
Etude préliminaire 4/11/16 4/28/16
Revue des bases d... 4/29/16 6/1/16
Implémentation du... 5/26/16 7/29/16
approche corpu... 5/26/16 7/8/16
approche ondul... 7/11/16 7/29/16
Comparaison des d... 6/24/16 8/16/16
Rédaction du rapp... 7/8/16 8/24/16
Etude du modèle o... 8/25/16 9/23/16
2016
April May June July August September
Figure A.4: Gantt chart of actual progress of the project.
40. 28
Appendix B
User Manual and Example Macro
B.1 XrayBoundary Process
To set up a phase contrast imaging simulation, users should perform the following steps
1. setup simulation parameters by following the Gate’s Users Guide V7;
2. activate the refraction effect process in a simulation by putting in the macro file the
line /gate/physics/addProcess XrayBoundary;
3. change the particle type to Gamma.
In order to customize the phantom material, users need to communicate the material’s
composition to GATE by modifying the material database as follows
1. add composition information to the data/GateMaterials.db database file;
2. add a dummy refractive index entry to the Materials.xml configuration file.
For example, to use PET1 (C10H8O4)n, users should add the following information to
the appropriate files.
Listing B.1: Information added to data/GateMaterials.db
PET: d=1.34 g/cm3 ; n=3 ; state=solid
+el: name=Carbon ; n=10
+el: name=Hydrogen ; n=8
+el: name=Oxygen ; n=4
Listing B.2: Information added to Materials.xml
<material name="PET">
<propertiestable>
<propertyvector name="RINDEX" energyunit="eV">
<ve energy="1.0" value="1.0"/>
</propertyvector>
</propertiestable>
</material>
Following is the macro file used to test the XrayBoundary process during development.
The figures shown in the section 3.3.1 are also obtained with this macro file.
1
PolyEthylene Terephthalate
41. B.1. XrayBoundary Process 29
Listing B.3: Example macro to test the XrayBoundary process
#=====================================================
# VERBOSITY
#=====================================================
#/control/execute mac/verbose.mac
#=====================================================
# VISUALISATION
#=====================================================
#/control/execute mac/visu.mac
#=====================================================
# GEOMETRY
#=====================================================
/gate/geometry/setMaterialDatabase data/GateMaterials.db
# World
/gate/world/geometry/setXLength 1 m
/gate/world/geometry/setYLength 1 m
/gate/world/geometry/setZLength 1 m
/gate/world/setMaterial Vacuum
# Water Box
/gate/world/daughters/name waterbox
/gate/world/daughters/insert cylinder
/gate/waterbox/geometry/setRmin 0 cm
/gate/waterbox/geometry/setRmax 50 um
/gate/waterbox/geometry/setPhiStart 0 rad
/gate/waterbox/geometry/setDeltaPhi 6.282 rad
/gate/waterbox/geometry/setHeight 1 cm
/gate/waterbox/placement/setTranslation 0 0 0 cm
/gate/waterbox/placement/setRotationAxis 1 0 0
/gate/waterbox/placement/setRotationAngle 90 deg
/gate/waterbox/setMaterial Aluminium
/gate/waterbox/vis/setVisible 1
/gate/waterbox/vis/setColor blue
#=====================================================
# PHYSICS
#=====================================================
/gate/physics/addPhysicsList emstandard_opt3
/gate/physics/addProcess XrayBoundary
/gate/physics/Gamma/SetCutInRegion world 10 mm
/gate/physics/Electron/SetCutInRegion world 10 mm
/gate/physics/Positron/SetCutInRegion world 10 mm
42. 30 Appendix B. User Manual and Example Macro
/gate/physics/Proton/SetCutInRegion world 10 mm
/gate/physics/Gamma/SetCutInRegion waterbox 1 mm
/gate/physics/Electron/SetCutInRegion waterbox 1 mm
/gate/physics/Positron/SetCutInRegion waterbox 1 mm
/gate/physics/Proton/SetCutInRegion waterbox 1 mm
/gate/physics/displayCuts
#=====================================================
# DETECTORS
#=====================================================
# Detection plane
/gate/world/daughters/name DetectorPlane
/gate/world/daughters/insert box
/gate/DetectorPlane/geometry/setXLength 500.0 um
/gate/DetectorPlane/geometry/setYLength 500.0 um
/gate/DetectorPlane/geometry/setZLength 1 nm
/gate/DetectorPlane/placement/setTranslation 0 0 -10 cm
/gate/DetectorPlane/setMaterial Vacuum
/gate/DetectorPlane/vis/setVisible 1
/gate/DetectorPlane/vis/setColor yellow
# Fluence of gamma
/gate/actor/addActor FluenceActor DetectorFluence
/gate/actor/DetectorFluence/save output/detectorMC.mhd
/gate/actor/DetectorFluence/attachTo DetectorPlane
/gate/actor/DetectorFluence/stepHitType pre
/gate/actor/DetectorFluence/setResolution 500 500 1
/gate/actor/DetectorFluence/enableScatter true
/gate/actor/DetectorFluence/enableUncertainty true
# Save particles stats
/gate/actor/addActor SimulationStatisticActor stat
/gate/actor/stat/save output/statsMC.txt
#=====================================================
# INITIALISATION
#=====================================================
/gate/run/initialize
#=====================================================
# BEAMS
#=====================================================
/gate/source/addSource mybeam gps
/gate/source/mybeam/gps/particle gamma
/gate/source/mybeam/gps/energy 19. keV
43. B.2. Fresnel Actor 31
/gate/source/mybeam/gps/polarization 1 0 0
/gate/source/mybeam/gps/pos/type Beam
/gate/source/mybeam/gps/pos/shape Rectangle
/gate/source/mybeam/gps/pos/centre 0 0 50 cm
/gate/source/mybeam/gps/pos/halfx 500 um
/gate/source/mybeam/gps/pos/halfy 500 um
/gate/source/mybeam/gps/direction 0 0 -1
#=====================================================
# START BEAMS
#=====================================================
# JamesRandom Ranlux64 MersenneTwister
/gate/random/setEngineName MersenneTwister
/gate/random/setEngineSeed auto
/gate/application/noGlobalOutput
/gate/application/setTotalNumberOfPrimaries 2147483647
/gate/application/start
B.2 Fresnel Actor
The Fresnel diffraction feature currently works only on voxelized phantoms. We can use
the RTK2 to create a previously specified geometric phantom. RTK accepts all geome-
tries shown in Wiki Quadric, exceptions (parabolic cylinder and paraboloid family). For
example, a cylindrical phantom of radius 5 µm centered on the z-axis is specified by the
following script.
Listing B.4: Content of script myPhantom.txt
Phantom
// original 3D phantom
// -------------------
[Cylinder] A=5 B=0. C=5 x=0. y=0. z=0. beta=0 gray=2.
Users can execute the command to obtain the voxelized phantom saved as myPhantom.mha.
$ rtkdrawgeometricphantom –phantomfile myPhantom.txt -o myPhantom.mha
Put the following line in the macro file to activate the Fresnel diffraction actor.
/gate/actor/ffda/fresnelFilename output/fresnel.mha
After execution, the Fresnel diffraction pattern will be saved as output/fresnel.mha.
2
Reconstruction ToolKit
44. 32
Bibliography
Cipiccia, Silvia et al. (2014). “Inclusion of coherence in Monte Carlo models for simulation
of x-ray phase contrast imaging”. In: Opt. Express 22.19, pp. 23480–23488. doi: 10.
1364/OE.22.023480. url: http://www.opticsexpress.org/abstract.cfm?URI=
oe-22-19-23480.
Frachon, Thibaut et al. (2015). “Dose fractionation in synchrotron radiation x-ray phase
micro-tomography”. In: Physics in medicine and biology 60.19, p. 7543.
Glatard, Tristan et al. (2013). “A virtual imaging platform for multi-modality medical
image simulation.” In: IEEE Transactions on Medical Imaging 32.1, pp. 110–8. doi:
10.1109/TMI.2012.2220154. url: http://www.hal.inserm.fr/inserm-00762497.
Goodman, J.W. (1996). Introduction to Fourier Optics. 2nd. MaGraw-Hill.
Gui, Jianbao et al. (2013). “Phase-contrast Imaging Simulation Based on a Micro-CT
System”. In: World Congress on Medical Physics and Biomedical Engineering May
26-31, 2012, Beijing, China. Springer, pp. 1041–1044.
Incerti, Sébastien (2014). “Special section: selected papers from the Geant4 2013 interna-
tional user conference at the physics-medicine-biology frontier”. In: Physics in Medicine
and Biology 59.24, p. 7565. url: http://stacks.iop.org/0031-9155/59/i=24/a=
7565.
Khromova, A. N. et al. (2004). “Monte Carlo Simulation of X-rays Multiple Refractive
Scattering from Fine Structure Objects imaged with the DEI Technique”. In: 2004
IEEE Nuclear Science Symposium and Medical Imaging Conference (NSS/MIC 2004)
Rome, Italy, October 16-22, 2004, pp. 4014–4018. doi: 10 . 1109 / NSSMIC . 2004 .
1466758. arXiv: 1002.0358 [physics.med-ph]. url: https://inspirehep.net/
record/844533/files/arXiv:1002.0358.pdf.
Langer, Max (2008). “Phase retrieval in the Fresnel region for hard X-ray tomography”.
PhD thesis. Villeurbanne, INSA.
Langlois, P, A Boivin, and RA Lessard (1985). “Electromagnetic diffraction of a three-
dimensional Gaussian laser beam at grazing incidence upon a large absorbing circular
cylinder”. In: JOSA A 2.6, pp. 858–862.
45. BIBLIOGRAPHY 33
Momose, Atsushi et al. (1996). “Phase–contrast X–ray computed tomography for observing
biological soft tissues”. In: Nature medicine 2.4, pp. 473–475.
Nielsen, J (2011). Elements of modern X-ray physics. Hoboken: Wiley. isbn: 978-0-470-
97395-0.
Peterzol, A et al. (2005). “The effects of the imaging system on the validity limits of the
ray-optical approach to phase contrast imaging”. In: Medical physics 32.12, pp. 3617–
3627.
Tur’yanskii, Aleksandr Georgievich et al. (2014). “Edge diffraction effect at the refraction
of X rays in a diamond prism”. In: JETP Letters 100.8, pp. 540–542.
Vladimirsky, Yuli et al. (1999). “Demagnification in proximity x-ray lithography and exten-
sibility to 25 nm by optimizing Fresnel diffraction”. In: Journal of Physics D: Applied
Physics 32.22, p. L114. url: http://stacks.iop.org/0022-3727/32/i=22/a=102.
Wang, Z. et al. (2009). “Implement X-ray refraction effect in Geant4 for phase contrast
imaging”. In: 2009 IEEE Nuclear Science Symposium Conference Record (NSS/MIC),
pp. 2395–2398. doi: 10.1109/NSSMIC.2009.5402180.