Skip to content

Opengate newsletter 2

David Sarrut edited this page Nov 28, 2023 · 3 revisions

Here is the second newsletter about the progress of Gate version 10.

News

Since last month, here are some changes in the code:

  • The way the volume is managed was deeply refactored. This is mostly invisible from the user side, but it changes many things for developers. It is now better structured and less error-prone. The only visible change as a user is that you can obtain help on every attribute of a volume, thanks to the help() Python command. The attributes that a user can change, such as the size of a Box or the radius of a Sphere, are called the "user_info".
  • Another invisible change: all the Python imports are now cleaned and should be more in the Python spirit. We still have some issues with a relatively long import time (mostly related to itk), but we are working on it.
  • The phase-space source is now faster (we avoid an unnecessary copy from Python to C++)
  • The use of GAN source and SPECT ARF with neural network has been updated. In particular, thanks to Pytorch 2.0, the GPU of Apple Mac M1 is now usable! This GPU device is called MPS and is similar to the CUDA for Linux. It seems still slower than CUDA but it helps nevertheless.

There is a new beta version 10.0beta05:

pip install --upgrade --pre opengate

Or use the developer version.

Focus on "IEC 6 spheres NEMA phantom description"

IEC 6 shperes

In the "contrib" folder, you will find a simple function that allows you to include a complete analytical description of the popular IEC 6 spheres phantom often used for PET or SPECT investigations. It is easy to use: a simple function with only two required parameters, the main Simulation object and a name. The resulting object is a volume that can be positioned as wanted. Options are available to change the 6 spheres' order. In addition to the volume, there is another function that creates an activity source from the spheres and, if needed, the background.

    from opengate.contrib.phantoms.nemaiec import add_iec_phantom, add_spheres_sources, add_background_source
    
    # create the IEC phantom 
    phantom = add_iec_phantom(sim, name="iec")
    
    # move it
    phantom.translation = [10*cm, 0, 4*cm]

    # add sources in all the spheres (1 MeV gamma)
    sources = add_spheres_sources(sim, iec_name="iec", src_name="source", 
                                         spheres="all", 
                                         activity_Bq_mL=[3*BqmL, 1*BqmL, 5*BqmL, 30*BqmL, 6*BqmL, 3*BqmL])
     for source in sources:
        source.particle = "gamma"
        source.energy.type = "mono"
        source.energy.mono = 1 * MeV
        source.direction.type = "iso"
    
    # add background source (e+ from Ga68 energy spectrum)                                
    bg_source = add_background_source(sim, iec_name="src", src_name="source", activity_Bq_mL=0.01*BqmL)
    bg_source.particle = "e+"
    bg_source.energy.type = "Ga68"
    bg_source.direction.type = "iso"

You can find an example here: https://github.com/OpenGATE/opengate/blob/master/opengate/tests/src/test015_iec_phantom_2.py

Finally, there is a tool to convert the analytical phantom into a voxelized phantom with a given resolution. This tool can be used as a Python function or from the command line. Once converted to a voxelized image (mhd file format), the tool also provides a list of pixel intensity label correspondence with the materials. Note that ANY volume (not only the IEC phantom) can be voxelized this way.

Here are the code:

As always, your feedback is crucial to us. Please don't hesitate to reach out with any questions, suggestions, or comments.

Thank you for your continued support and contributions. 2023/10/23