=Paper= {{Paper |id=Vol-1787/502-506-paper-87 |storemode=property |title=Geant4-based simulation of a micro-CT scanner using cloud resources |pdfUrl=https://ceur-ws.org/Vol-1787/502-506-paper-87.pdf |volume=Vol-1787 |authors=Vladislav Andriyashen,Anton Gerasimov,Alexander Provorov,Michail Demichev,Danila Kozhevnikov }} ==Geant4-based simulation of a micro-CT scanner using cloud resources== https://ceur-ws.org/Vol-1787/502-506-paper-87.pdf
  GEANT4-based simulation of a micro-CT scanner using
                  cloud resources
                 V. V. Andriyashen1,2, A. S. Gerasimov2, 3, A. A. Provorov1,2,
                           M. A. Demichev1, D. A. Kozhevnikov1
          1
              Joint Institute for Nuclear Research, 6, Joliot-Curie st., Dubna, Moscow region, 141980, Russia
    2
        Moscow Institute of Physics and Technology, 9, Institutskiy ln, Dolgoprudniy, Moscow region, Russia
           3
              Institute for High Energy Physics, 1, Ulitsa Pobedy, Protvino, Moscow region, 142280, Russia
                     E-mail: proa1ex@mail.ru, antoshkasg@gmail.com, vladandriyashen@gmail.com



      Research of methods of material recognition using Medipix-based micro-CT scanner MARS requires de-
tailed simulation of passage of X-rays through the sample. The application based on the Geant4 toolkit has been
developed to solve this task. Since the computation turned out to be very time consuming for a single PC (sever-
al hunderds of projections must be simulated for each sample) the cloud resources has been used. Amazon was
chosen as an organization to provide us with such a resources and, particularly, its cloud computing related ser-
vice – AWS (Amazon Web Services). Two possible ways to create the AMI (Amazon Machine Image) with in-
stalled software for the problem was considered. This AMI was used to run instances (virtual server) to perform
calculations. A significant increase in performance was reached by using several instances that were working at
the same time (the task can be divided into independent pieces). A job submission framework optimized to run
Geant4 applications in Amazon EC2 has been implemented using Python language. All actions after registration
on AWS (Amazon Web Services – cloud computing service) to run instance – virtual server – are explained. We
considered 2 ways of AMI creation (Amazon Machine Image – template of the instance). The first way is to use
template given by Amazon and install any required software on it. The second way is to create template using
one of prepared virtual machines with some preinstalled software. We used this template to create a lot of in-
stance that worked at the same time computing different parts of the calculation. Use of this method lowered
time of computation and made it acceptable. Obtained results were compared with expectations, we consider our
method to be effective for our task.

        Keywords: cloud computing, circular cone-beam CT, GEANT4, Python, Amazon Web Services, Medipix


               © 2016 Vladislav V. Andriyashen, Anton S. Gerasimov, Alexander A. Provorov, Michail A. Demichev, Danila A. Kozhevnikov




                                                                                                                              502
Introduction
      Our group studied problem of material’s chemical composition recognition using CT scanner
MARS(Medipix All resolution System) – the first commercially available 3D spectral (multi-energy)
scanner to produce images with anatomic and molecular quantification at a fraction of the cost, time,
and radiation dose of traditional molecular imaging, such as PET or SPECT. It is based on Medipix
detector chip [Ballabriga, Campbell, …, 2011] - CMOS pixel detector readout chip designed to be
connected to a segmented semiconductor sensor, developed by the Medipix3 Collaboration.
      This task requires simulation of the CT scan to improve accuracy. Elements can be recognized
using only their mass attenuation coefficients and its dependency on energy of X-ray but it leads to
large errors. Computer model helps to take into account features of the sample, geometrical defects,
beam hardening. Our program imitates the real scan of the multi-contrast phantom for material de-
composition, calibration and quality assurance. It is written in C++ language and uses the Geant4
toolkit [Allison, et al., 2006] for simulation of passage of X-rays through the samples.
      Monte-Carlo simulation requires a lot of computing power to simulate a large number of radia-
tion quanta and their interactions with matter. This led us to the idea of using cloud-computing re-
sources. We chose an organization to provide us with such resources – Amazon [Ostermann, Iosup,
…, 2010]. In particular, cloud computing related service of Amazon is called AWS (Amazon Web
Services). Amazon EC2 (Elastic Cloud) forms the central part of it. To perform this work we also need
the storage service - Amazon S3 (Simple Storage Service). Amazon EC2 provides us with a so-called
instances - virtual servers with certain operating systems. An instance type is determined by this sys-
tem and the resources assigned to it. The cost of the instance (per hour) is defined by resources. In-
stance considered to be running, even if it is not performing any useful work.

Application
      Our computer program simulates the real CT-scan. The simulated setup consists of X-ray source,
studied sample and detector. X-ray source generates gamma quanta which momentum is distributed
evenly in a cone. Energy of quanta is distributed according to the real X-ray tube spectrum:
      As samples, we created 2 different objects for different kinds of experiments. First sample is cyl-
inder containing several small cylinders inside. This object was used to study material recognition and
simulates syringes with fluids in a stand. Second sample is a rectangle with circular grooves and
stripes. It is used to determine the size of smallest details that scan is able to register. Particular interest
has the dependency of this size on geometrical defects of the setup.




                                           Fig. 1. Simulated samples




                                                                                                          503
     During the simulation gamma quanta are generated in focal spot of X-ray tube and pass through
the phantom. They are registered on the detector at different energy thresholds. This procedure is ap-
plied for 360 angles with step of 1°. CT reconstruction programs use this data to recreate a sample
[Turbell, 2001]. Reconstruction algorithms are based on the equation which determines the intensity of
the beam passing through matter:
                                                              
                                            I out  I 0 e 
                                                         f ( r ) dl
                                                                                                      (1)

     These algorithms determine f(r) – effective mass attenuation coefficient of different points of
sample and this allows to recognize the material. The main feature of MARS is the ability to measure
the intensity of quanta with energies above the thresholds (8 thresholds can be set at the same time).
This allows to measure the dependency of mass attenuation coefficient on energy and greatly improve
the accuracy of recognition.
     Our computer model is able to simulate different defects of the experimental setup such as focal
spot nonzero size, X-ray tube displacement and rotation axis displacement. These problems affect the
quality of the reconstructed volume. Usually they lower contrast of the output images and reduce the
visibility of details. Rectangular sample with grooves and stripes was used to study these effects.


Calculations
      SSH client is used to connect to instances so it has to be installed on the client machine. To use
Amazon EC2 services one should perform several steps to provide convenient and safe access to his
resources. Firstly, one has to sign up for AWS, after that it is desirable to create an IAM (Identity and
Access Management) user to restrict users credentials and add this user to created administrators
group. AWS also uses public-key cryptography to secure the login information for the instance, so one
should (in case of Linux instances has to) create key pair. For security reasons one should create secu-
rity groups for for instances to restrict range of IP, from which one can get access to the instance.




                                     Fig. 2. Connection to an instance

      One can only create an instance using a certain template, called AMI (Amazon Machine Image).
There are two basic ways to create an instance: one may use a standard template provided by Amazon,
or create his own template by using a user's operating system. The main advantage of the first method
is that there is no need to configure and load his own operating system, one can instead use one of the




                                                                                                   504
relatively wide range offered – among these templates are Amazon Linux AMI, Red Hat Enterprise
Linux, SUSE Linux Enterprise Server, Ubuntu Server, a lot of Windows servers, etc with different
initial settings. Among the shortcomings - there is a need to configure the system that is already in
progress and load tools for a specific task directly in the instance. Moreover, these operations are not
always possible due to the limited number of standard AMI. However, a customized system can be
saved as a template and can be used to create a number of instances, which is very useful if the task
can be divided into independent pieces and one configuration is suitable for each of them.




                                        Fig. 3. Creation of an AMI

     The second method is more suitable if the specific properties of specific operating systems are
required for solving the problem, as well as if an environment for Computing System was created a
long time ago and it is difficult to completely transfer all necessary components to a clean operating
system. Disadvantages include a comparative inconvenience (compared with the first method) of the
procedure of creating an instance (especially for simple tasks) which is because one has to perform a
lot of additional actions to make it possible to Amazon services to transform loaded virtual machine
into AMI. Another point is the requirement to raise additional service - Amazon S3 - service for data
storage. One have to connect to an instance via ssh so it has to be installed in the virtual machine be-
fore its transformation into the proper format to be loaded into Amazon S3. A full list of essential
preparations and acceptable operating systems is contained in the Amazon EC2 documentation pages.
Standard templates already have ssh server. There is the other essential tool to be installed on the cli-
ent – AWS CLI (Command Line Interface), which is essential when one loads VM into S3. CLI is also
may be useful for setting properties of AMI users, security groups, etc.
     During the work we could install the necessary software (the main component of which is
Geant4) on an instance, created on a standard template provided by Amazon, and on the virtual ma-
chine OS: Debian 64bit. After that we exported the VM from its virtualization environment and, im-
ported it to Amazon S3 bucket and, in the end, imported it as an image to Amazon EC2, so it was
ready to use.
     We used Python script for all calculations. Module boto3 helped us to control instances and mod-
ule Paramiko was used to provide ssh protocol. Overall script creates necessary amount of concrete
type of instances, then calculates, processes errors, deletes instances and finally shows us the result.




                                                                                                   505
Results
      A substantial increase in performance over a PC was achieved by running instance 361 for data
reduction for each degree separately. PC Configuration: Intel Core i7-3610QM @ 2.30GHz. Configu-
ration of instance on Amazon: Inter (R) Xeon (R) CPU E5-2676 v3 @ 2.40GHz. 10^7 particles on the
PC: 3 minutes on Amazon Instance: 2 minutes. 8.5^10 particles per Instance are counted for 40.8
hours. At the same time, it has been used the least productive of the supplied hardware configurations,
as the only significant feature was the performance of the processor, and also due to the fact that the
version Geant4, does not support parallel execution on multicore processors. Tests have also shown
that switching on more expensive instances doesn't affect performance considerably. Namely, 0.5 Gb
RAM is enough to perform all the calculations (but is not enough to install all the components on a
running instance) and increase in this value doesn’t affect this situation.


References
Ballabriga R., Campbell M., Heijne E., Llopart X., Tlustos L. and Wong W. Medipix3: A 64 k pixel
     detector readout chip working in single photon counting mode with improved spectrometric per-
     formance // Nuclear Instruments and Methods in Physics Research Section A: Accelerators,
     Spectrometers, Detectors and Associated Equipment. — 2011. — Vol. 633. — P. 15–18.
Allison J. [et al.] Geant4 developments and applications // IEEE Transactions on Nuclear Science. —
     2006. — Vol. 53. — P. 270–278.
Ostermann S., Iosup A., Yigitbasi N., Prodan R., Fahringer T. and Epema D. A Performance Analysis
     of EC2 Cloud Computing Services for Scientific Computing // Lecture Notes of the Institute for
     Computer Sciences: Social Informatics and Telecommunications Engineering. — 2010. —
     Vol. 34. — P. 115–131.
Turbell H. Cone-Beam Reconstruction Using Filtered Backprojection  Linköping: Linköping Univer-
     sity Electronic Press. 2001.




                                                                                                 506