PET application

Before reading this chapter we recommend you to read the chapter on Detector, that contains the utilities that are common to all detector applications.

The PET application contains two directories. The first one, PetGeometry, contains an utility to build a simple PET ring detector by just defining a few parameters. The second one contains the PET event classifier, the Compton identification algorithms and a few histogram classes.

Many of the utilities for PET detectors are related to the sensitive detectors that they contain, so please read the Sensitive Detectors chapter if you have not done it yet.

PET geometry

The directory source/Detector/PET/GeometryData contains several examples of building simple PET ring detectors with text geometry files by just defining the following parameters:

  • :P NCRYSTALS_transaxial VALUE : Number of crystals per block in the transaxial direction
  • :P NCRYSTALS_axial VALUE : Number of crystals per block in the axial direction
  • :P NBLOCKS VALUE : Number of blocks of crystals per ring
  • :P NRINGS VALUE : Number of rings of blocks
  • :P CRYS_transaxial VALUE: Crystal size, trans-axial
  • :P CRYS_axial VALUE : Crystal size, axial
  • :P CRYS_radial VALUE : Crystal size, radial
  • :P DIAMETER VALUE : Detector ring diameter
  • :PS CRYS_MATE VALUE : Name of crystal material
  • :P WORLD_Z VALUE : World Z dimension (the X and Y are calculated as slightly bigger than the detector

There are several examples of simplified commercial PET detectors in the files with suffix .geom in that directory. To use this utility you just have to choose as your geometry the GmGeometryFromText one:

/gamos/geometry GmGeometryFromText

NOTE: This module is just thought for simple PET geometries. If you want to do more complicated geometries, we recommend you to describe them with a text file (see section Building your geometry with a text file).

PET event classification

The class PETEventClassifierUA in the directory NuclearMedicine/PET classifies the events as PET by looking at the reconstructed hits. It is a GAMOS user action, so you can activate it with the command

/gamos/userAction PETEventClassifierUA

First it counts how many reconstructed hits have 511 keV

Indeed the exact mass of the electron is always used within a precision given by the parameter

/gamos/setParam PET:EvtClass:511EPrec ENERGY_FRACTION

That is the energies accepted will be those between 511*(1-ENERGY_FRACTION) and 511*(1+ENERGY_FRACTION). Alternatively you may use the following two parameters

/gamos/setParam PET:EvtClass:511EPrecMin ENERGY_MIN

/gamos/setParam PET:EvtClass:511EPrecMax ENERGY_MAX

where ENERGY_MIN is the minimum energy, that by default takes a value of 0.7*511 keV, and ENERGY_MAX is the maximum energy, that by default takes a value of 1.3*511 keV.

To recover hits when one of several Compton interactions have occurred you may switch the merging of hits that are close into a single one. You may set the distance to merge hits with the parameter

/gamos/setParam PET:EvtClass:ComptonRecHitDist DIST

DIST takes by default a value of 0, what means that no Compton hits merging will be done. The merging of hits first identifies the hit with biggest energy and merges with it those hits that are closer than the given distance. The same algorithm is repeated with the hits not associated until no hit is left. If hits merging is chosen you may choose among several algorithms to try to identify the hit that corresponds to the first gamma interaction (and this will be the position of the whole set). See section Identifying Compton interactions to learn how to do it. If no algorithm is selected the position will be the one of biggest energy, or second biggest, or n-th biggest, where the order is given by the parameter

/gamos/setParam PET1stHitByEnergy:Order ORDER

ORDER takes by default a value of 1, that is, the position is that of the hit with biggest energy (see section on Identifying Compton interactions).

If two hits are found it will be checked that their relative time difference is less than the value given by the parameter

/gamos/setParam PET:EvtClass:CoincidenceTime COINCIDENCE_TIME

which by default takes a value almost infinite (it is assumed that one of the two started the trigger and the other must be in the coincidence time opened at that moment).

If two 511-keV hits are finally found, the event is classified as a good PET event. Then the sub-classification code enters in the game:

  • More than two 511-keV hits: If more than two hits are found, the two that are closer to 511 keV will be taken and the event will receive a sub-classification type of 3->2.
  • %If the distance to the event vertex is too big, we can check if still the distance to the phantom is too big (TO BE DONE)
  • Random coincidence: It is checked that each of the two 511-keV hits is built only from tracks from the same ‘original’ gamma ‘original’ gammas are gammas that are primary particles or that are directly created by the annihilation of positron that is a primary particle, and that the two hits come from the same event
  • Scattered: The event is classified as scattered if any of the 511-keV gammas has suffered an interaction in the list of volumes defined by the parameter /gamos/setParam DetCountScatteringUA:VolumeNames VOLUME_1 VOLUME_2 … and this interaction is of one of the process types defined by the parameter /gamos/setParam DetCountScatteringUA:ProcessNames PROCESS_1 PROCESS_2 … (by default Compton are Rayleigh interactions are counted); and it has lost in the volumes more energy than the parameter /gamos/setParam DetCountScatteringUA:EnergyMin ENER_MIN (by default the minimal energy is 0.)
  • Check PET line distance: a line joining the position of the two reconstructed hits is built and the distance of closest approach (DCA) to the origin of the positron is calculated; the events are classified as ‘near’ of ‘far’ if the DCA is smaller or bigger than the parameter /gamos/setParam PET:EvtClass:LineDistToVtx DISTANCE where DISTANCE has a default value of 10*mm.

The ClassifyPET method returns an integer with several digits containing the event classification:

  • 0 if it is not PET, 1 if it is PET and PET line is close to the event vertex, 2 if it is PET and PET line is far from event vertex
  • 10*1 if the search for 511-keV reconstructed hits found more than 2
  • 100*1 if the event is a random coincidence event
  • 1000*1 if the event is a scattered event

At the end of the run a table is printed with the number of events in each of the combinations of the sub-classification types.

PET histograms: event classification

These histograms are related to the event classification explained above. They are produced if the event classification user action is selected. The name of all these histograms starts with “PETEvtClass: “ and all are written in the file pet.root/csv.

The following histograms are written:

  • Classification index of event (“PET classification”). This index is the one described in the precedent section.
  • % For a more compact presentation of the results, those events with an index digit 1,2 are summed up in the bin with index digit 5 (i.e. 0,1 and 2 in bin 5, 10, 11 and 12 in bin 15, 1, 11 and 21 in bin 51, etc.)
  • Number of 511-keV reconstructed hits before cleaning if there are more than two and searching for Compton hits, i.e., hits produced merging two crystals (see above) (“N 511 recHits initial”)
  • The energy of the 511-keV reconstructed hits (“PET RecHit energy (keV)”)
  • The energy of the 511-keV reconstructed hits that are rejected because there are more than two (“PETEvtClass: Extra PET RecHit energy (keV)”)
  • Distance of closest approach between vertex and the line joining the two 511-keV reconstructed hits (=DCA) (“PET dist line - vertex (mm)”)
  • Z coordinate if distance of closest approach between vertex and the line joining the two 511-keV reconstructed hits (=DCA) (“PET dist line - vertex Z (mm)”)
  • Phi coordinate if distance of closest approach between vertex and the line joining the two 511-keV reconstructed hits (=DCA) (“PET dist line - vertex PHI (mm)”)
  • Radial position in the XY plane of the primary positrons (“e+ position (X,Y) (mm)”)
  • Radial position in the XY plane of the primary positrons, only for those events that are good PET events (“e+ position (X,Y)_PET Events (mm)”)

There are also a histogram of the DCA and the reconstructed hit energies for each of the sixteen sub-classification types (combinations of the 4 sub-indices) and also for the all the events that are far from vertex, all the events where there were more than two hits, all the events with random coincidences and all the scattered events.

PET output for reconstruction

List-mode binary file

If the event is classified as a PET one, it is dumped in a binary file given by the name

/gamos/setParam pet:FileName MY_FILENAME

that takes the name pet.out by default. The variables written are given by the structure

struct PetOutput
{
char name[8];
float xVtx,yVtx,zVtx,x1,y1,z1,x2,y2,z2;
}

where name is PET, xVtx, yVtx, zVtx are the coordinates of the event vertex, x1, y1, z1 are the coordinates of the first reconstructed hit, x2, y2, z2 are the coordinates of the second vertex.

The same data that is written to the file can be written in the standard output if the parameter

/gamos/setParam PET:EvtClass:DumpEventListMode TRUE

is set to true. The positions in the standard output (not in the file) will be written in cylindrical coordinates by default. If you want them in cartesian coordinates you should set to true the parameter

/gamos/setParam pet:DumpCartesian TRUE

Projection data file

PET events can also be stored as projection data (sinograms) by selecting the following parameter

/gamos/setParam PET:EvtClass:DumpProjData 1

Projection data or sinogram is a common way to organize PET events and represents the standard input for image reconstruction algorithms. By default, GAMOS generates a file compatible with its own image reconstructor (see “Image reconstruction utilities” section), data are written in pairs, including a header text file (.hv) and a binary data file (.v). Nevertheless, the user can also select an output file compatible with the STIR package [biblio.ImageJ], a Open Source software for use in tomographic imaging. In this case, data files are also written in pairs: a header text file (.hs) and a binary data file (.s); but following the STIR Interfile format. The type of output format (0 for GAMOS ad-hoc or 1 for STIR Interfile) is controlled by the “OutFormat” parameter:

/gamos/setParam PET:ProjData:OutFormat OUT_TYPE

In order to generate the sinograms, the user must specify the dimensions of image axial and transaxial field of view (FOV). These values are given in milimetres by

/gamos/setParam PET:ProjData:DistAxial D_AXIAL

/gamos/setParam PET:ProjData:DiameterTranFOV D_TRANSAXIAL

In addition, projection data are discretized in axial, tangential and angular dimensions. The user must indicate the number of axial planes (N_PLANES, by default 40), tangential bins (N_BINS, by default 81) and angular views (N_ANGULAR, by default 80) using these parameters:

/gamos/setParam PET:ProjData:Nplanes N_PLANES

/gamos/setParam PET:ProjData:Nbin N_BINS

/gamos/setParam PET:ProjData:NangViews N_ANGULAR

Note that once axial FOV is fixed, the plane width is given by D_AXIAL/(N_PLANES-1); which represents the double of the slice thickness in the reconstructed image, by default. In the same way, the image transaxial pixel size will have a value of D_TRANSAXIAL/(N_BINS-1).

In 3-dimensional PET acquisition the “maximum ring difference” is another fundamental parameter which limits the axial distance between the two planes (rings) of a detected PET coincidence. It is used to discard lines of response which are too axially tilted, since these events can deteriorate the image quality with some reconstruction methods. By default (value -1) all axial planes are included; the number of planes which defines the “maximum ring difference” can be changed with

/gamos/setParam PET:ProjData:MaxRingDiff MY_MRD

The projection data file name (without extension) is given by

/gamos/setParam PET:ProjData:Filename MY_PROJDATA_FILE

that takes the name default_sino3D by default.

PET histograms: positrons

These histograms are related to the original positron and the two secondary gammas created at its annihilation. They are produced if the user action PETHistosPositron is activated with the command

/gamos/userAction PETHistosPositron

The name of all these histograms starts with ``PETPositron’‘ and all are written in the file pet.root/csv.

The histograms are the following:

  • Positron energy at creation (“e+ initial energy (keV)”)
  • Positron range (“e+ range (mm)”)
  • Positron energy at annihilation (“e+ energy at annihilation (keV)”)
  • Positron energy at creation vs range (“e+ initial energy (keV) vs range (mm)”)
  • Positron energy at annihilation vs secondary gammas energy (“e+e- gammas vs e+ energy (keV)”)
  • Positron energy at annihilation vs sum of secondary gammas energy - 1.022 MeV - positron energy at annihilation (“total gamma energy vs e+ energy (keV)”). This is the energy deposited locally at annihilation.

Detector histograms: distance between two gammas

These histograms are related to the distance between the line joining two gammas originated at the positron annihilation and the vertex position, at the moment of the gamma creation and when they hit the sensitive detector. Also other histograms about these two gammas are provided for further information. They are produced if the user action DetHistosGammaDist is activated with the command

/gamos/userAction DetHistosGammaDist.

The name of all these histograms starts with “NHGammaDist: “ and all are written in the file NHGammaDist.root/csv/txt.

The histograms are the following:

  • Angle between the direction of the two gammas when they are created (“angle between gammas at vertex (deg)”)
  • Angle between the direction of the two gammas when they enter the sensitive detector (“angle between gammas at entering SD (deg)”)
  • Distance of closest approach between vertex and the line joining the vertex points of the two gammas (“DCA orig from Gamma vertex (mm)”)
  • Distance of closest approach between vertex and the line joining the points where the gammas enter the sensitive detectors (“DCA orig from Gamma entering SD (mm)”)
  • Z position of vertex of gamma if it reaches the sensitive detector (“Orig Pos Z if Gamma reaches SD (mm)”)
  • R position of vertex of gamma if it reaches the sensitive detector (“Orig Pos R if Gamma reaches SD (mm)”)