-
Notifications
You must be signed in to change notification settings - Fork 16
Extracting GATE scatter, randoms and trues data
OMEGA allows the import of GATE scatter, randoms and trues data into MATLAB either in the raw data format, as a sinogram or as a "true" image depicting the number of counts emanating from each coordinate (this is converted into same pixel resolution as the reconstructed image). All three components (trues, scatter and randoms) are stored separately along with the actual coincidence (prompts) data. The import can be done either by using gate_main_m
, gate_main_simple.m
, or any scanner specific main-file. gate_main_simple.m
supports only OSEM reconstruction. If you need only the data import, gate_main_simple.m
is recommended for better readability.
Randoms are supported by all three formats (ASCII, LMF and ROOT). LMF only supports Compton scattering in the phantom, while ASCII and ROOT support also Compton scattering in the detector, Rayleigh scattering in the phantom and Rayleigh scattering in the detector. You can select any one of these in the main-files (options.scatter_components
).
Note
|
Using ROOT data, as mentioned in readme, will cause MATLAB R2018b and EARLIER to crash during GUI activity. This can be prevented by using MATLAB in the -nojvm mode (i.e. matlab -nojvm ), which means without any GUIs. It is recommended to use this only for data extraction (set options.only_sinos = true and run gate_main_simple.m or other main-file with GATE support). This issue is not present on Octave or MATLAB R2019a and up. ROOT is not supported on Windows on either MATLAB or Octave.
|
Extracting the trues, randoms and/or scatter has no effect on the actual coincidences (prompts). I.e. they will also be extracted same regardless if any of the trues, randoms or scatter is extracted.
All coincidences that are from different events (i.e. not from the same annihilation) will be considered as randoms. All coincidences that come from the same event but have scattered in at least one of the four possibilities are considered scatter. For trues, it is possible to control on which coincidences are considered trues. Randoms and Compton scattered events in the phantom are ALWAYS excluded from trues, but the other three are excluded ONLY if they are selected in options.scatter_components
. E.g. if options.scatter_components = [1 1 0 0]
then Rayleigh scattered events are included in trues, but not in scattered events.
For scattered events, the scattering in the phantom takes precedence. For example, if an event has Compton scattered in the phantom and in the detector, it is included ONLY in the Compton scattered events in the phantom. Compton scattering also takes precedence over Rayleigh scattering. The order is thus Compton scattering in the phantom → Compton scattering in the detector → Rayleigh scattering in the phantom → Rayleigh scattering in the detector.
For scattered events, it is also possible to select only multiply scattered events. For example, only Compton scattered events in the phantom that have scatted twice or more can be included in the scatter data.
First block (SCANNER PROPERTIES) needs to be filled with the parameters corresponding to the scanner in question. Components computed from earlier elements (e.g. det_per_ring
) do not need to be filled (only gate_main.m
).
The second block (titled "GATE SPECIFIC SETTINGS") allows the user to specify which elements to extract by setting the appropriate options-value to true (or 1).
Setting options.obtain_trues = true
causes automatic extraction of trues. You can also (optionally) choose to reconstruct the trues instead of the actual coincidences. This is done by setting options.reconstruct_trues = true
. options.scatter_components
is used to control the events included in trues (see below). As mentioned above, randoms and Compton scattered events in the phantom are always excluded from trues.
options.store_scatter = true
allows the storing of scatter. However, in order to store scatter at least one element in the next vector needs to be 1. options.scatter_components
stores the different scatter components as mentioned in introduction. The first one is Compton scattering in the phantom, second Compton scattering in the detector, this Rayleigh scattering in the phantom and fourth Rayleigh scattering in the detector. E.g. setting options.scatter_components = [1 0 1 0]
stores only the Compton and Rayleigh scattering in the phantom, while scatter in the detectors will be ignored and not included in the scatter data, it will be, however, included in trues if trues are stored. As with trues data, you can optionally choose to reconstruct the scatter data by setting options.reconstruct_scatter = true
. Only one of trues, scatter or prompt coincidences can be reconstructed at the same time.
Randoms can be obtained by putting options.store_randoms = true
. The randoms obtained like this will not be used for randoms correction if it is selected. Both the actual randoms and delayed coincidences (if selected in GATE) can be extracted at the same time and in separate variables.
The "true" image can be optionally stored as well by putting options.source = true
. This will create a separate mat-file named machine_name 'Ideal_image_coordinates' name '_ASCII.mat'
, where machine_name
is the name of the scanner you’ve specified and name
the name of the examination you’ve specified. The last elements of C
contains the trues (e.g. C{end}
), RA
contains randoms and SC
scatter. Randoms and scatter are stored as singles in the true images.
Only ONE of the below output data can be used at a time (e.g. you cannot extract both LMF and ASCII data at the same time).
If you intent to form sinograms as well, the SINOGRAM PROPERTIES block also needs to be filled with correct values.
In order to extract scatter, randoms and/or trues from ASCII data you need to set options.use_ASCII = true
in the ASCII DATA FORMAT SETTINGS block. Additionally you need to copy-paste the ASCII coincidence mask used in your macro. E.g. if /gate/output/ascii/setCoincidenceMask 0 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0
then options.coincidence_mask = [0 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0];
.
If you are extracting trues, then ALL the scatter components need to be selected in the GATE coincidence mask before running the simulation.
The location of the ASCII .dat files is specified by options.fpath
in MISC PROPERTIES. Alternatively, the current working directory in MATLAB can be used as well.
Set options.use_LMF = true
and specify the number of bytes in the LMF header and in each event packet. Additionally, specify the number of bits dedicated for each detector element (R-sectors, modules, submodules, crystals, layers, shown when the simulation starts in GATE) and the coincidence window. Lastly the clock time step shown in cch-files is needed.
The location of the LMF .ccs files is specified by options.fpath
in MISC PROPERTIES. Alternatively, the current working directory in MATLAB can be used as well.
You need to run install_mex
before LMF support is available.
Note
|
The source image can be unreliable with LMF data. |
Simply set options.use_root = true
. The location of the ROOT .root files is specified by options.fpath
in MISC PROPERTIES. Alternatively, the current working directory in MATLAB can be used as well.
You need to run install_mex
before ROOT support is available (Linux only). If thisroot.sh/csh
has been sourced, ROOT should be found automatically. Otherwise you can input the ROOT path with install_mex(0, [], [], [], '/PATH/TO/ROOT')
.
Note
|
Using ROOT data, as mentioned in readme, will cause MATLAB R2018b and EARLIER to crash during GUI activity. This can be prevented by using MATLAB in the -nojvm mode (i.e. matlab -nojvm ), which means without any GUIs. It is recommended to use this only for data extraction (set options.only_sinos = true and run gate_main_simple.m ). This issue is not present on Octave or MATLAB R2019a and up. ROOT is not supported on Windows on either MATLAB or Octave.
|
Sinograms are automatically created during data load regardless of the type of data used. Raw data is stored if options.store_raw_data = true
. These are also automatically saved into a mat-file in the current working directory. If you are using TOF data, all the trues, scatter and randoms sinograms will be TOF as well.
If you wish to reconstruct any data, run the next section (Reconstructions). The selected data (trues, scatter, coincidences [default]) will be automatically selected.
If you want to reconstruct e.g. trues (without any scattered coincidences) + Compton scatter in phantom, you should load the saved sinogram/raw data and sum the trues and Compton scatter together (i.e. if options.scatter_components = [1 0 0 0]
then SinScatter
contains only the Compton scatter in phantom and you can perform them reconstructions with the following code options.SinM = SinTrues + SinScatter
). If options.SinM
already exists, it will not be loaded from the saved mat-files. That way you can input any data combinations, but unless you want exclusively trues or scatter, they need to be performed manually now. The same applies to raw data, but instead of options.SinM
use options.coincidences
. Note that in this example case you need to obtain the scatter data and trues data separately since the trues will include the other scattered components if the scatter components is options.scatter_components = [1 0 0 0]
, i.e. trues should be obtained with options.scatter_components = [1 1 1 1]
.
Currently the user also has to individually extract each scatter component (i.e. you can’t extract Compton scatter in phantom or in detector simultaneously in separate variables/data files, but rather need to extract each component on its own and rename the output data accordingly).
- Home
- Installation help
- Getting started
- PET Tutorials
- CT Tutorials
- Useful information
- Function help
- Visualization
- Using GATE PET data
- Using GATE CT data
- Extracting GATE scatter, randoms and trues data
- Computing the forward and/or backward projections
- Using non-cylindrical PET scanners
- Custom detector coordinates and/or list mode reconstruction
- Using TOF data
- Extracting the system matrix
- Using Inveon PET data
- Using Inveon CT data
- Using Biograph PET data
- Using custom gradient-based priors
- Adding custom built-in algorithms
- Toolbox overview
- Contributing code to OMEGA
- Contact