Skip to content

Commit ff16682

Browse files
committed
Update technical.rst
1 parent 4c6c05f commit ff16682

File tree

1 file changed

+9
-69
lines changed

1 file changed

+9
-69
lines changed

docs/source/technical.rst

+9-69
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
Technical info
22
===============
33

4-
This page outlines some technical information on the software. Mainly how everything works.
4+
This page outlines some technical information on the software. Mainly how everything works. The text is largely based on version 1.2 and thus mainly features PET-related information in MATLAB. This page is still work in progress!
55

66
The general structure of OMEGA can be divided into three different layers. The top layer is the MATLAB/Octave/Python user-interface that contains the scripts and functions necessary to call the lower layers.
77
The middle layer is the MATLAB (C) MEX-interface or C++ dynamic library that calls and computes the C++ code and then sends it back to the top layer. The bottom layer, which is not always used, contains the OpenCL/CUDA kernels that
88
compute the OpenCL/CUDA code and then send the output data (reconstructed images) to the middle layer. The bottom layer is only used if OpenCL/CUDA code is used. The middle layer can also be ignored, but this is recommended only when
99
doing custom reconstructions in Python.
1010

11-
For the user, only the top layer is exposed. This is achieved in the form of scripts that are referred to as *main-files*. These include, for example, https://github.com/villekf/OMEGA/blob/master/main-files/PET_main_gateExample.m[``gate_main.m``],
12-
https://github.com/villekf/OMEGA/blob/master/main-files/CT_main_full.m[``CT_main_full.m``], or https://github.com/villekf/OMEGA/blob/master/source/Python/gate_PET.py[``gate_PET.py``].
11+
`GNU Octave <https://octave.org/>`_
12+
For the user, only the top layer is exposed. This is achieved in the form of scripts that are referred to as *main-files*. These include, for example, `gate_main.m <https://github.com/villekf/OMEGA/blob/master/main-files/PET_main_gateExample.m>`_,
13+
`CT_main_full.m <https://github.com/villekf/OMEGA/blob/master/main-files/CT_main_full.m>`_, or `gate_PET.py <https://github.com/villekf/OMEGA/blob/master/source/Python/gate_PET.py>`_.
1314
It is from these main-files that the actual functions are called. This
1415
is achieved by storing all the user selected parameters to a
15-
MATLAB/Octave struct called ``options``, which is then input to the
16+
MATLAB/Octave/Python struct called ``options`` in the example files (the name can be anything though), which is then input to the
1617
functions (e.g. when loading data or performing image reconstruction).
1718

1819
In the main-files most parameters are set either with numerical values
@@ -23,74 +24,13 @@ it is omitted (e.g. ``randoms_correction``, ``scatter_smoothing``,
2324
labels (SCANNER PROPERTIES, IMAGE PROPERTIES, SINOGRAM PROPERTIES, etc.)
2425
that control different aspects. Many of these sections are completely
2526
optional, e.g. CORRECTIONS section can be omitted if the user does not
26-
wish to use any corrections. The only compulsory ones are SCANNER
27-
PROPERTIES and either SINOGRAM or RAW DATA PROPERTIES. For
28-
reconstruction it is also advisable to inspect the RECONSTRUCTION
29-
PROPERTIES section, but the default values should always output a
30-
working OSEM estimate. By default all non-compulsory options are set as
31-
false (with the exception of the Inveon main-file which has several
32-
corrections enabled by default).
27+
wish to use any corrections. The only compulsory items are the FOV size, the number of voxels per dimension, and the source/detector coordinates for each measurement (and the measurement data itself).
3328

3429
There are also several functions that work very independently without
3530
the need for the main-files. These include file import and export
36-
functions, visualization functions and many reconstruction algorithm
37-
functions. For help on many of these functions, you should use
31+
functions, and visualization functions. For help on many of these functions, you should use
3832
``help function_name`` or alternatively ``doc function_name``. E.g.
39-
``help saveImage``.
40-
41-
Technical aspects
42-
=================
43-
44-
This section explains how, exactly, does each component of OMEGA
45-
software work.
46-
47-
Precomputation phase
48-
--------------------
49-
50-
The corresponding m-file is
51-
https://github.com/villekf/OMEGA/blob/master/source/lor_pixel_count_prepass.m[``lor_pixel_count_prepass.m``].
52-
53-
Purpose
54-
~~~~~~~
55-
56-
As mentioned in other help pages, the goal of the precomputation phase
57-
is to determine the number of voxels that each line of response
58-
traverses (interacts with). Line of responses that do not intersect the
59-
FOV at all will have 0 interacted voxels and as such can be safely
60-
removed. This step is also necessary for the parallel version of
61-
implementation 1 as it requires the preallocation of the system matrix
62-
in memory. This also means that, unlike with matrix free
63-
implementations, the orthogonal and volume of intersection ray tracers
64-
require their own precomputation passes since the number of voxels that
65-
are interacted with is much higher.
66-
67-
Execution
68-
~~~~~~~~~
69-
70-
Dedicated codes are available for the precomputation phase. Furthermore,
71-
since the OpenCL implementations use single (32-bit float) precision
72-
numbers and the C++ versions double (64-bit double) precision numbers,
73-
different versions are available for both. This is because of
74-
floating-point rounding effects that can cause LORs that are on the very
75-
edge of a voxel to be in different voxels depending on whether the
76-
single or double precision implementations are used. While this usually
77-
affects only a very small portion of all the LORs, even a single wrong
78-
one can cause a crash due to out-of-bounds variables. Implementation 2
79-
also has its own precomputation code, although the OpenCL kernel itself
80-
is identical to implementation 3. This is simply because of the
81-
different device/platform executions.
82-
83-
The codes themselves are stripped versions of the actual projectors. In
84-
all cases, the ray tracing itself is always performed, no parameters
85-
outside of the ones necessary for the ray tracing are computed. For C++
86-
version, there is a different file/function for this
87-
(https://github.com/villekf/OMEGA/blob/master/source/improved_Siddon_algorithm_discard.cpp[``improved_Siddon_algorithm_discard.cpp``]),
88-
but for OpenCL versions all the code are in “master” kernel file
89-
(https://github.com/villekf/OMEGA/blob/master/source/multidevice_kernel.cl[``multidevice_kernel.cl``])
90-
where the correct lines are compiled during runtime by taking advantage
91-
of preprocessor directives (``#ifdef``, ``#else``, etc.). For
92-
precomputation phase, the preprocessor directive that is defined is
93-
``FIND_LORS``. No precomputation code is available for CUDA.
33+
``help saveImage`` in MATLAB/Octave.
9434

9535
Data load
9636
---------
@@ -113,7 +53,7 @@ GATE data
11353
^^^^^^^^^
11454

11555
For http://www.opengatecollaboration.org/[GATE] data, the data import is
116-
separate for LMF, ASCII and ROOT.
56+
separate for LMF (not supported anymore), ASCII and ROOT.
11757

11858
In LMF, the data import is done in a C++ file
11959
(https://github.com/villekf/OMEGA/blob/master/source/gate_lmf_matlab.cpp[``gate_lmf_matlab.cpp``])

0 commit comments

Comments
 (0)