3.1. opengate¶
3.1.1. Subpackages¶
- 3.1.1.1.
opengate.actor- 3.1.1.1.1.1.
opengate.actor.ARFActor - 3.1.1.1.1.2.
opengate.actor.ARFTrainingDatasetActor - 3.1.1.1.1.3.
opengate.actor.ActionEngine - 3.1.1.1.1.4.
opengate.actor.ActorBase - 3.1.1.1.1.5.
opengate.actor.ActorEngine - 3.1.1.1.1.6.
opengate.actor.ActorManager - 3.1.1.1.1.7.
opengate.actor.DigitizerAdderActor - 3.1.1.1.1.8.
opengate.actor.DigitizerBlurringActor - 3.1.1.1.1.9.
opengate.actor.DigitizerEnergyWindowsActor - 3.1.1.1.1.10.
opengate.actor.DigitizerHitsCollectionActor - 3.1.1.1.1.11.
opengate.actor.DigitizerProjectionActor - 3.1.1.1.1.12.
opengate.actor.DigitizerReadoutActor - 3.1.1.1.1.13.
opengate.actor.DigitizerSpatialBlurringActor - 3.1.1.1.1.14.
opengate.actor.DoseActor - 3.1.1.1.1.15.
opengate.actor.FilterBase - 3.1.1.1.1.16.
opengate.actor.FilterManager - 3.1.1.1.1.17.
opengate.actor.KineticEnergyFilter - 3.1.1.1.1.18.
opengate.actor.MotionVolumeActor - 3.1.1.1.1.19.
opengate.actor.ParticleFilter - 3.1.1.1.1.20.
opengate.actor.PhaseSpaceActor - 3.1.1.1.1.21.
opengate.actor.SimulationStatisticsActor - 3.1.1.1.1.22.
opengate.actor.SourceInfoActor - 3.1.1.1.1.23.
opengate.actor.TestActor - 3.1.1.1.1.24.
opengate.actor.helpers_actor - 3.1.1.1.1.25.
opengate.actor.helpers_filter
- 3.1.1.1.1.1.
- 3.1.1.2.
opengate.bin - 3.1.1.3.
opengate.contrib- 3.1.1.3.1.1.
opengate.contrib.dose_rate_helpers - 3.1.1.3.1.2.
opengate.contrib.linac_elekta_synergy - 3.1.1.3.1.3.
opengate.contrib.pet_philips_vereos - 3.1.1.3.1.4.
opengate.contrib.pet_siemens_biograph - 3.1.1.3.1.5.
opengate.contrib.phantom_necr - 3.1.1.3.1.6.
opengate.contrib.phantom_nema_iec_body - 3.1.1.3.1.7.
opengate.contrib.spect_ge_nm670 - 3.1.1.3.1.8.
opengate.contrib.spect_ideal_timed_reconstruction
- 3.1.1.3.1.1.
- 3.1.1.4.
opengate.geometry- 3.1.1.4.1.1.
opengate.geometry.BooleanVolume - 3.1.1.4.1.2.
opengate.geometry.BoxVolume - 3.1.1.4.1.3.
opengate.geometry.ConsVolume - 3.1.1.4.1.4.
opengate.geometry.ElementBuilder - 3.1.1.4.1.5.
opengate.geometry.HexagonVolume - 3.1.1.4.1.6.
opengate.geometry.ImageVolume - 3.1.1.4.1.7.
opengate.geometry.MaterialBuilder - 3.1.1.4.1.8.
opengate.geometry.MaterialDatabase - 3.1.1.4.1.9.
opengate.geometry.PolyhedraVolume - 3.1.1.4.1.10.
opengate.geometry.RepeatParametrisedVolume - 3.1.1.4.1.11.
opengate.geometry.SolidBuilderBase - 3.1.1.4.1.12.
opengate.geometry.SphereVolume - 3.1.1.4.1.13.
opengate.geometry.TrapVolume - 3.1.1.4.1.14.
opengate.geometry.TrdVolume - 3.1.1.4.1.15.
opengate.geometry.TubsVolume - 3.1.1.4.1.16.
opengate.geometry.VolumeBase - 3.1.1.4.1.17.
opengate.geometry.VolumeEngine - 3.1.1.4.1.18.
opengate.geometry.VolumeManager - 3.1.1.4.1.19.
opengate.geometry.helpers_geometry - 3.1.1.4.1.20.
opengate.geometry.helpers_materials
- 3.1.1.4.1.1.
- 3.1.1.5.
opengate.mac - 3.1.1.6.
opengate.physics - 3.1.1.7.
opengate.source- 3.1.1.7.1.1.
opengate.source.beta_plus_spectra- 3.1.1.7.1.1.1.1.
opengate.source.beta_plus_spectra.C11 - 3.1.1.7.1.1.1.2.
opengate.source.beta_plus_spectra.F18 - 3.1.1.7.1.1.1.3.
opengate.source.beta_plus_spectra.Ga68 - 3.1.1.7.1.1.1.4.
opengate.source.beta_plus_spectra.N13 - 3.1.1.7.1.1.1.5.
opengate.source.beta_plus_spectra.Na22 - 3.1.1.7.1.1.1.6.
opengate.source.beta_plus_spectra.O15 - 3.1.1.7.1.1.1.7.
opengate.source.beta_plus_spectra.Rb82 - 3.1.1.7.1.1.1.8.
opengate.source.beta_plus_spectra.Zr89
- 3.1.1.7.1.1.1.1.
- 3.1.1.7.2.1.
opengate.source.GANSource - 3.1.1.7.2.2.
opengate.source.GANSourceConditionalGenerator - 3.1.1.7.2.3.
opengate.source.GANSourceConditionalPairsGenerator - 3.1.1.7.2.4.
opengate.source.GANSourceDefaultGenerator - 3.1.1.7.2.5.
opengate.source.GenericSource - 3.1.1.7.2.6.
opengate.source.PencilBeamSource - 3.1.1.7.2.7.
opengate.source.SourceBase - 3.1.1.7.2.8.
opengate.source.SourceEngine - 3.1.1.7.2.9.
opengate.source.SourceManager - 3.1.1.7.2.10.
opengate.source.VoxelizedSourceConditionGenerator - 3.1.1.7.2.11.
opengate.source.VoxelizedSourcePDFSampler - 3.1.1.7.2.12.
opengate.source.VoxelsSource - 3.1.1.7.2.13.
opengate.source.helpers_source
- 3.1.1.7.1.1.
- 3.1.1.8.
opengate.tests
3.1.2. Submodules¶
- 3.1.2.1.
opengate.EngineBase - 3.1.2.2.
opengate.ExceptionHandler - 3.1.2.3.
opengate.RunAction - 3.1.2.4.
opengate.Simulation - 3.1.2.5.
opengate.SimulationEngine - 3.1.2.6.
opengate.SimulationOutput - 3.1.2.7.
opengate.SimulationUserInfo - 3.1.2.8.
opengate.UIsessionSilent - 3.1.2.9.
opengate.UIsessionVerbose - 3.1.2.10.
opengate.UserElement - 3.1.2.11.
opengate.UserInfo - 3.1.2.12.
opengate.helpers - 3.1.2.13.
opengate.helpers_element - 3.1.2.14.
opengate.helpers_image - 3.1.2.15.
opengate.helpers_log - 3.1.2.16.
opengate.helpers_run_timing - 3.1.2.17.
opengate.helpers_tests - 3.1.2.18.
opengate.helpers_tests_root - 3.1.2.19.
opengate.helpers_transform
3.1.3. Package Contents¶
3.1.3.1. Classes¶
A simple dict that contains the list of user parameters. |
|
Common class for all types of elements (volume, source or actor) |
|
Base class for all source types. |
|
Store user information about an actor |
|
Store information about a geometry volume: |
|
Common class for all types of elements (volume, source or actor) |
|
Geant4 exception handler. Inherit form GateExceptionHandler |
|
Geant4 exception handler. Inherit form GateExceptionHandler |
|
Store information about a voxelized volume |
|
Allow to repeat a volume with translations |
|
Voxels source for 3D distributed activity. |
|
GeneriSource close to the G4 SPS, but a bit simpler. |
|
This class manage the base components of a particle generator. |
|
GAN source: the Generator produces particles |
|
Pencil Beam source |
|
The ARF Actor is attached to a volume. |
|
The ARFTrainingDatasetActor build a root file with energy, angles, positions and energy windows |
|
Build a list of hits in a given volume. |
|
DoseActor: compute a 3D edep/dose map for deposited |
|
Equivalent to Gate "adder": gather all hits of an event in the same volume. |
|
This actor is a DigitizerAdderActor + a discretization step: |
|
Consider a list of hits and arrange them according to energy intervals. |
|
This actor takes as input HitsCollections and performed binning in 2D images. |
|
Digitizer module for blurring an attribute (single value only, not a vector). |
|
Digitizer module for blurring a (global) spatial position. |
|
Every run, move a volume according to the given translations and rotations. |
|
Similar to HitsCollectionActor : store a list of hits. |
|
Store statistics about a simulation run. |
|
TODO |
|
Test actor: only py side (no cpp) |
|
Common class for all types of elements (volume, source or actor) |
|
Common class for all types of elements (volume, source or actor) |
|
A description of a material, that will can be build on demand. |
|
A description of a G4Element that can be build. |
|
Manage a unique list of Geant4 materials and elements. |
|
A description of a material, that will can be build on demand. |
|
A description of a G4Element that can be build. |
|
Implementation of G4VUserDetectorConstruction. |
|
FIXME |
|
Manage all the sources in the simulation. |
|
FIXME |
|
This class manage the base components of a particle generator. |
|
GeneriSource close to the G4 SPS, but a bit simpler. |
|
This class manage the base components of a particle generator. |
|
Generate pairs of particles with a GAN, considering conditional vectors. |
|
This is an alternative to GateSPSVoxelsPosDistribution (c++) |
|
Pencil Beam source |
|
GeneriSource close to the G4 SPS, but a bit simpler. |
|
Manage all the Filters in the simulation |
|
Manage all the actors in the simulation |
|
FIXME |
|
Main object to manage all actions during a simulation. |
|
Print Geant4 Verbose with color |
|
User action at begin and end of run. |
|
This class is a simple structure that contains all user general options of ths physics list. |
|
Everything related to the physics (lists, cuts etc) should be here. |
|
FIXME |
3.1.3.2. Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Prefix the text with indent spaces |
|
|
|
Consider a list of Classname. For each, it build a key/value, with: |
|
|
|
|
|
|
|
|
|
Debug print current Function name |
|
Debug print variable name and its value |
|
|
Print information about OpenGate and the environment |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The two images are considered in the same physical space (coordinate system). |
|
The two images are considered in the same GATE physical space (coordinate system), so according to the |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Compute the three CDF (Cumulative Density Function) for the given image |
|
|
|
The inputs are filenames of several images containing projections for a given spect head |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return a branch whether it is a numpy or a uproot tree |
|
Compare with Wasserstein distance |
|
Compare with Wasserstein distance |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Compare two root trees. |
|
|
https://stackoverflow.com/questions/53808503/how-to-test-if-a-matrix-is-a-rotation-matrix |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Build a repeater for the given volume name, according to a ring rotation. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return a list of n time intervals, from start to end |
|
|
|
|
|
Return the min and max 3D points of the bounding box of the given volume |
|
Return the size of the bounding box of the given volume |
|
Consider the point x in the current volume and return the coordinate of x in the top volume |
|
Print a tree of volume |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Same function than in GateHounsfieldToMaterialsBuilder class. |
|
|
|
|
|
|
|
read the file downloaded from LNHB |
|
Given a list of (energy) bins center, compute the width of each bin. |
|
|
|
Compute the CDF (Cumulative Density Function) of a list of non-uniform energy bins |
|
like in G4SPSAngDistribution.cc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return the class of the given type_name (in the element_type list) |
|
Return a function that build an element of the class type_name |
|
Create a new element (Volume, Source, Actor, Filter), according to the type name |
|
Copy all attributes from v1 to v2, except the name. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Create a class (not on object!) which: |
Constructor of the above, dynamically created class. |
|
For debug |
|
|
Dynamically create a class with the given PhysicList |
3.1.3.3. Attributes¶
- opengate.indent(amount, text, ch=' ')[source]¶
Prefix the text with indent spaces https://stackoverflow.com/questions/8234274/how-to-indent-the-contents-of-a-multi-line-string
- opengate.make_builders(class_names)[source]¶
Consider a list of Classname. For each, it build a key/value, with: - the type of the class as key - and a lambda function that create an object of this class as value
- opengate.get_translation_between_images_center(img_name1, img_name2)[source]¶
The two images are considered in the same physical space (coordinate system). This function computes the translation between their centers. Warning, the ITK image origin consider the center of the first voxel, we thus consider half a pixel shift for the center.
- opengate.get_origin_wrt_images_g4_position(img_info1, img_info2, translation)[source]¶
The two images are considered in the same GATE physical space (coordinate system), so according to the centers of both images (+translation). This function computes the origin for the second image such as the two images will be in the same physical space of the first image. Warning, the ITK image origin considers the center of the first voxel, we thus consider half a pixel shift for the center.
- opengate.attach_image_to_physical_volume(phys_vol_name, image, initial_translation=None, initial_rotation=Rotation.identity())[source]¶
- opengate.compute_image_3D_CDF(image)[source]¶
Compute the three CDF (Cumulative Density Function) for the given image Warning; numpy order is ZYX
- Parameters:
image – itk image
- opengate.split_spect_projections(input_filenames, nb_ene)[source]¶
The inputs are filenames of several images containing projections for a given spect head Each image is composed of nb_ene energy windows and XX angles. The number of angles is found by looking at the number of slices.
The function computes nb_ene itk image with all angles and all heads merged into a list of projections stored as a 3D image, to make it easy to reconstruct with RTK.
- opengate.assert_images(ref_filename1, filename2, stats=None, tolerance=0, ignore_value=0, axis='z', fig_name=None, sum_tolerance=5)[source]¶
- opengate.get_branch(tree, keys, key)[source]¶
Return a branch whether it is a numpy or a uproot tree
- opengate.compare_branches(tree1, keys1, tree2, keys2, key1, key2, tol=0.8, scaling1=1, scaling2=1, ax=False, nb_bins=200)[source]¶
Compare with Wasserstein distance Works well, but not easy to set the tolerance value.
- opengate.compare_branches_values(b1, b2, key1, key2, tol=0.8, ax=False, nb_bins=200)[source]¶
Compare with Wasserstein distance Works well, but not easy to set the tolerance value.
- opengate.compare_trees(tree1, allkeys1, tree2, allkeys2, keys1, keys2, tols, scalings1, scalings2, fig=False, nb_bins=200)[source]¶
- opengate.compare_root3(root1, root2, branch1, branch2, keys1, keys2, tols, scalings1, scalings2, img, hits_tol=6, nb_bins=200)[source]¶
- opengate.write_gauss_param_to_file(outputdir, planePositionsV, saveFig=False, fNamePrefix='plane', fNameSuffix='a.mhd')[source]¶
- opengate.root_compare4(p1, p2, param)[source]¶
Compare two root trees.
p1 and p2 contain = the root filename, the tree name, a list of branch names (see root_compare_param_tree) Also, each branch can be scaled and clip to a min/max range.
param contains: the tolerance values (for all branches), the fig name, the nb of bins of the histograms, the tolerance for the nb of hits (see root_compare_param)
- opengate.is_rotation_matrix(R)[source]¶
https://stackoverflow.com/questions/53808503/how-to-test-if-a-matrix-is-a-rotation-matrix
- opengate.repeat_ring(name, start_deg, nb, translation, axis=[0, 0, 1])[source]¶
- Build a repeater for the given volume name, according to a ring rotation.
start_deg must be in degrees nb is the number of repeated positions translation is the initial translation of the volume according to the center axis is the rotation axis
The output is a dict (Box) of all positions (name + translation + rotation) than can be set to the ‘repeat’ member of a volume.
- opengate.build_param_repeater(sim, mother_name, repeated_vol_name, size, translation, rot=None)[source]¶
- class opengate.UserInfo(element_type, type_name, name=None)[source]¶
A simple dict that contains the list of user parameters. Note that the dict is a Box, allowing simpler access to the keys with a dot (rather than brackets)
The default elements are set with set_default_user_info according to the class found thanks to element_type and type_name
- class opengate.UserElement(user_info)[source]¶
Common class for all types of elements (volume, source or actor) Manager a dict (Box) for user parameters: user_info Check that all the required keys are provided
- class opengate.SourceBase(user_info)[source]¶
Bases:
opengate.UserElementBase class for all source types.
- class opengate.ActorBase(user_info)[source]¶
Bases:
opengate.UserElementStore user information about an actor
- class opengate.VolumeBase(user_info)[source]¶
Bases:
opengate.UserElement.UserElementStore information about a geometry volume: - G4 objects: Solid, LogicalVolume, PhysicalVolume - user parameters: user_info - additional data such as: mother, material etc
- class opengate.UserElement(user_info)[source]¶
Common class for all types of elements (volume, source or actor) Manager a dict (Box) for user parameters: user_info Check that all the required keys are provided
- class opengate.Simulation(name='simulation')[source]¶
Main class that store a simulation. It contains: - a set of global user parameters (SimulationUserInfo) - user parameters for Volume, Source, Actors and Filters, Physics - a list of g4 commands that will be set to G4 engine after the initialization
There is NO Geant4 engine here, it is only a set of parameters and options.
- class opengate.ExceptionHandler[source]¶
Bases:
opengate_core.GateExceptionHandlerGeant4 exception handler. Inherit form GateExceptionHandler The function ‘Notify’ will be called by G4 when an exception occurs. Should be created after initialization. Will be automatically stoed in the G4 stateManager
- class opengate.EngineBase[source]¶
Base class for all engines (SimulationEngine, VolumeEngine, etc.)
- class opengate.ExceptionHandler[source]¶
Bases:
opengate_core.GateExceptionHandlerGeant4 exception handler. Inherit form GateExceptionHandler The function ‘Notify’ will be called by G4 when an exception occurs. Should be created after initialization. Will be automatically stoed in the G4 stateManager
- opengate.info_run_timing(sim: opengate.Simulation)[source]¶
- opengate.range_timing(start, end, n)[source]¶
Return a list of n time intervals, from start to end e.g. range_timing(0, 1, 10) => [0, 0.1], [0.1, 0.2], [0.2, 0.3], [0.3, 0.4], [0.4, 0.5], [0.5, 0.6], [0.6, 0.7], [0.7, 0.8], [0.8, 0.9], [0.9, 1.0]]
- opengate.get_volume_bounding_limits(simulation, volume_name)[source]¶
Return the min and max 3D points of the bounding box of the given volume
- opengate.get_volume_bounding_box_size(simulation, volume_name)[source]¶
Return the size of the bounding box of the given volume
- opengate.translate_point_to_volume(simulation, volume, top, x)[source]¶
Consider the point x in the current volume and return the coordinate of x in the top volume (that must be an ancestor). Translation only, do not consider rotation.
- class opengate.BoxVolume[source]¶
Bases:
opengate.VolumeBase
- class opengate.SphereVolume[source]¶
Bases:
opengate.VolumeBase
- class opengate.TrapVolume[source]¶
Bases:
opengate.VolumeBasehttp://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html dx1 Half x length of the side at y=-pdy1 of the face at -pdz dx2 Half x length of the side at y=+pdy1 of the face at -pdz dz Half z length theta Polar angle of the line joining the centres of the faces at -/+pdz phi Azimuthal angle of the line joining the centre of the face at -pdz to the centre of the face at +pdz dy1 Half y length at -pdz dy2 Half y length at +pdz dx3 Half x length of the side at y=-pdy2 of the face at +pdz dx4 Half x length of the side at y=+pdy2 of the face at +pdz alp1 Angle with respect to the y axis from the centre of the side (lower endcap) alp2 Angle with respect to the y axis from the centre of the side (upper endcap)
- class opengate.ImageVolume(user_info)[source]¶
Bases:
opengate.VolumeBaseStore information about a voxelized volume
- initialize_image_parameterisation()[source]¶
From the input image, a label image is computed with each label associated with a material. The label image is initialized with label 0, corresponding to the first material Correspondence from voxel value to material is given by a list of interval [min_value, max_value, material_name] all pixels with values between min (included) and max (non included) will be associated with the given material
- class opengate.TubsVolume[source]¶
Bases:
opengate.VolumeBasehttp://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html prmin SetInnerRadius prmax SetOuterRadius pdz SetZHalfLength psphi SetStartPhiAngle pdphi SetDeltaPhiAngle
- class opengate.ConsVolume[source]¶
Bases:
opengate.VolumeBase
- class opengate.PolyhedraVolume[source]¶
Bases:
opengate.VolumeBase
- class opengate.HexagonVolume[source]¶
Bases:
opengate.VolumeBase- type_name = 'Hexagon'[source]¶
This is a special case of a polyhedra https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html
- class opengate.TrdVolume[source]¶
Bases:
opengate.VolumeBasedx1 Half-length along X at the surface positioned at -dz dx2 Half-length along X at the surface positioned at +dz dy1 Half-length along Y at the surface positioned at -dz dy2 Half-length along Y at the surface positioned at +dz zdz Half-length along Z axis
- class opengate.BooleanVolume(name)[source]¶
Bases:
opengate.VolumeBase
- class opengate.RepeatParametrisedVolume(user_info)[source]¶
Bases:
opengate.VolumeBaseAllow to repeat a volume with translations
- opengate.HounsfieldUnit_to_material(density_tolerance, file_mat, file_density)[source]¶
Same function than in GateHounsfieldToMaterialsBuilder class. Probably far from optimal, put we keep the compatibility
- opengate.all_beta_plus_radionuclides = ['F18', 'Ga68', 'Zr89', 'Na22', 'C11', 'N13', 'O15', 'Rb82'][source]¶
- opengate.read_beta_plus_spectra(rad_name)[source]¶
read the file downloaded from LNHB there are 15 lines-long header to skip first column is E(keV) second column is dNtot/dE b+ WARNING : bins width is not uniform (need to scale for density)
- opengate.compute_bins_density(bins)[source]¶
Given a list of (energy) bins center, compute the width of each bin.
- opengate.compute_cdf_and_total_yield(data, bins)[source]¶
Compute the CDF (Cumulative Density Function) of a list of non-uniform energy bins with associated probability. Also return the total probability.
- opengate.generate_isotropic_directions(n, min_theta=0, max_theta=np.pi, min_phi=0, max_phi=2 * np.pi, rs=np.random)[source]¶
like in G4SPSAngDistribution.cc
Later : do a version with torch (gpu) instead of np (cpu) ?
- class opengate.VoxelsSource(user_info)[source]¶
Bases:
opengate.source.GenericSource.GenericSourceVoxels source for 3D distributed activity. Sampled with cumulative distribution functions.
- class opengate.GenericSource(user_info)[source]¶
Bases:
opengate.SourceBaseGeneriSource close to the G4 SPS, but a bit simpler.
- class opengate.GANSourceDefaultGenerator(user_info)[source]¶
This class manage the base components of a particle generator.
In the constructor, the module ‘gaga’ is imported. It is only imported in the constructor to only required
this module if it is used
‘initialize’ function: the GAN is loaded and the list of keys is initialized
‘generator’ function: default generator
‘get_output_keys’ function: map the user defined keys to the ones of the generator. There are two usages, either
with on single primary (3 values for position, direction), or paired primary (6 values).
‘move_backward’ function: consider all particles positions and move their backward according to their direction,
using the factor provided by the user in ‘user_info.backward_distance’. This is useful to allow generating particles that do not intersect with the detector.
‘copy_generated_particle_to_g4’ function: copy all the particles (pos, dir, time, energy) to the cpp part.
- class opengate.GANSource(user_info)[source]¶
Bases:
opengate.source.GenericSource.GenericSourceGAN source: the Generator produces particles Input is a neural network Generator trained with a GAN
- class opengate.PencilBeamSource(user_info)[source]¶
Bases:
opengate.source.GenericSource.GenericSourcePencil Beam source
- class opengate.ARFActor(user_info)[source]¶
Bases:
opengate_core.GateARFActor,opengate.ActorBaseThe ARF Actor is attached to a volume. Every time a particle enter, it considers the energy and the direction of the particle. It runs the neural network model to provide the probability of detection in all energy windows.
Output is an (FIXME itk ?numpy ?) image that can be retrieved with self.output_image
- class opengate.ARFTrainingDatasetActor(user_info)[source]¶
Bases:
g4.GateARFTrainingDatasetActor,gate.ActorBaseThe ARFTrainingDatasetActor build a root file with energy, angles, positions and energy windows of a spect detector. To be used by garf_train to train a ARF neural network.
Note: Must inherit from ActorBase not from HitsCollectionActor, even if the cpp part inherit from HitsCollectionActor
- class opengate.DigitizerHitsCollectionActor(user_info)[source]¶
Bases:
opengate_core.GateDigitizerHitsCollectionActor,opengate.ActorBaseBuild a list of hits in a given volume. - the list of attributes to be stored is given in the ‘attributes’ options - output as root
- class opengate.DoseActor(user_info)[source]¶
Bases:
opengate_core.GateDoseActor,opengate.ActorBaseDoseActor: compute a 3D edep/dose map for deposited energy/absorbed dose in the attached volume
- The dose map is parameterized with:
size (number of voxels)
spacing (voxel size)
translation (according to the coordinate system of the “attachedTo” volume)
no rotation
Position: - by default: centered according to the “attachedTo” volume center - if the attachedTo volume is an Image AND the option “img_coord_system” is True:
the origin of the attachedTo image is used for the output dose. Hence, the dose can be superimposed with the attachedTo volume
- Options
edep only for the moment
later: add dose, uncertainty, squared etc
- initialize(volume_engine=None)[source]¶
At the start of the run, the image is centered according to the coordinate system of the mother volume. This function computes the correct origin = center + translation. Note that there is a half-pixel shift to align according to the center of the pixel, like in ITK.
- class opengate.DigitizerAdderActor(user_info)[source]¶
Bases:
opengate_core.GateDigitizerAdderActor,opengate.ActorBaseEquivalent to Gate “adder”: gather all hits of an event in the same volume. Input: a HitsCollection, need aat least TotalEnergyDeposit and PostPosition attributes Output: a Single collections
Policies: - EnergyWinnerPosition: consider position and energy of the hit with the max energy
for all other attributes (Time, etc.): the value of the winner is used.
- EnergyWeightedCentroidPosition: computed the energy-weighted centroid position
for all other attributes (Time, etc.): the value the last seen hit is used.
- class opengate.DigitizerReadoutActor(user_info)[source]¶
Bases:
opengate_core.GateDigitizerReadoutActor,opengate.ActorBaseThis actor is a DigitizerAdderActor + a discretization step: the final position is the center of the volume
- class opengate.DigitizerEnergyWindowsActor(user_info)[source]¶
Bases:
opengate_core.GateDigitizerEnergyWindowsActor,opengate.ActorBaseConsider a list of hits and arrange them according to energy intervals. Input: one DigiCollection Output: as many DigiCollections as the number of energy windows
- class opengate.DigitizerProjectionActor(user_info)[source]¶
Bases:
opengate_core.GateDigitizerProjectionActor,opengate.ActorBaseThis actor takes as input HitsCollections and performed binning in 2D images. If there are several HitsCollection as input, the slices will correspond to each HC. If there are several runs, images will also be slice-stacked.
- class opengate.DigitizerBlurringActor(user_info)[source]¶
Bases:
opengate_core.GateDigitizerBlurringActor,opengate.ActorBaseDigitizer module for blurring an attribute (single value only, not a vector). Usually for energy or time.
- class opengate.DigitizerSpatialBlurringActor(user_info)[source]¶
Bases:
opengate_core.GateDigitizerSpatialBlurringActor,opengate.ActorBaseDigitizer module for blurring a (global) spatial position.
- class opengate.MotionVolumeActor(user_info)[source]¶
Bases:
opengate_core.GateMotionVolumeActor,opengate.ActorBaseEvery run, move a volume according to the given translations and rotations.
- class opengate.PhaseSpaceActor(user_info)[source]¶
Bases:
opengate_core.GatePhaseSpaceActor,opengate.ActorBaseSimilar to HitsCollectionActor : store a list of hits. However only the first hit of given event is stored here.
- class opengate.SimulationStatisticsActor(user_info=None)[source]¶
Bases:
opengate_core.GateSimulationStatisticsActor,opengate.ActorBaseStore statistics about a simulation run.
- class opengate.SourceInfoActor(name)[source]¶
Bases:
opengate_core.GateVActor,opengate.ActorBaseTODO
- class opengate.TestActor(user_info=None)[source]¶
Bases:
opengate_core.GateVActor,opengate.ActorBaseTest actor: only py side (no cpp) For prototyping (slow)
- class opengate.ParticleFilter(user_info)[source]¶
Bases:
opengate_core.GateParticleFilter,opengate.UserElementCommon class for all types of elements (volume, source or actor) Manager a dict (Box) for user parameters: user_info Check that all the required keys are provided
- class opengate.KineticEnergyFilter(user_info)[source]¶
Bases:
opengate_core.GateKineticEnergyFilter,opengate.UserElementCommon class for all types of elements (volume, source or actor) Manager a dict (Box) for user parameters: user_info Check that all the required keys are provided
- class opengate.SimulationUserInfo(simulation)[source]¶
This class is a simple structure that contains all user general options of a simulation.
- opengate.get_element_class(element_type, type_name)[source]¶
Return the class of the given type_name (in the element_type list)
- opengate.get_builder(element_type, type_name)[source]¶
Return a function that build an element of the class type_name Check everything first.
- opengate.new_element(user_info, simulation=None)[source]¶
Create a new element (Volume, Source, Actor, Filter), according to the type name - use the element_builders to find the class to build - create a new element, with the name as parameter to the constructor - initialize the default list of keys in the user_info - set a pointer to the Simulation object
- opengate.copy_user_info(v1, v2)[source]¶
Copy all attributes from v1 to v2, except the name. v1 is assumed to be a UserInfo object with several attribute members. v2 must have the (at least) the same set of attributes. Values are (deep) copied.
- class opengate.MaterialBuilder(material_database)[source]¶
A description of a material, that will can be build on demand. A material is described by a list of components that can be elements or sub-materials.
- class opengate.ElementBuilder(material_database)[source]¶
A description of a G4Element that can be build.
- class opengate.MaterialDatabase[source]¶
Manage a unique list of Geant4 materials and elements. The materials/elements are read in a DB txt file or in NIST. They are only build on demand, during the geometry Construct
- class opengate.MaterialBuilder(material_database)[source]¶
A description of a material, that will can be build on demand. A material is described by a list of components that can be elements or sub-materials.
- class opengate.ElementBuilder(material_database)[source]¶
A description of a G4Element that can be build.
- class opengate.VolumeManager(simulation)[source]¶
Implementation of G4VUserDetectorConstruction. In ‘Construct’ function, build all volumes in the scene. Keep a list of solid, logical volumes, physical volumes, materials.
- __getstate__()[source]¶
This is important : to get actor’s outputs from a simulation run in a separate process, the class must be serializable (pickle). The g4 material databases and the info_volume containing volume from solid have to be removed first.
- class opengate.VolumeEngine(simulation)[source]¶
Bases:
opengate_core.G4VUserDetectorConstruction,opengate.EngineBaseFIXME
- class opengate.SourceManager(simulation)[source]¶
Manage all the sources in the simulation. The function prepare_generate_primaries will be called during the main run loop to set the current time and source.
- class opengate.SourceEngine(source_manager)[source]¶
Bases:
opengate.EngineBaseFIXME
- class opengate.GANSourceDefaultGenerator(user_info)[source]¶
This class manage the base components of a particle generator.
In the constructor, the module ‘gaga’ is imported. It is only imported in the constructor to only required
this module if it is used
‘initialize’ function: the GAN is loaded and the list of keys is initialized
‘generator’ function: default generator
‘get_output_keys’ function: map the user defined keys to the ones of the generator. There are two usages, either
with on single primary (3 values for position, direction), or paired primary (6 values).
‘move_backward’ function: consider all particles positions and move their backward according to their direction,
using the factor provided by the user in ‘user_info.backward_distance’. This is useful to allow generating particles that do not intersect with the detector.
‘copy_generated_particle_to_g4’ function: copy all the particles (pos, dir, time, energy) to the cpp part.
- class opengate.GANSourceConditionalGenerator(user_info, generate_condition_function)[source]¶
Bases:
opengate.source.GANSourceDefaultGenerator.GANSourceDefaultGenerator
- class opengate.GenericSource(user_info)[source]¶
Bases:
opengate.SourceBaseGeneriSource close to the G4 SPS, but a bit simpler.
- class opengate.GANSourceDefaultGenerator(user_info)[source]¶
This class manage the base components of a particle generator.
In the constructor, the module ‘gaga’ is imported. It is only imported in the constructor to only required
this module if it is used
‘initialize’ function: the GAN is loaded and the list of keys is initialized
‘generator’ function: default generator
‘get_output_keys’ function: map the user defined keys to the ones of the generator. There are two usages, either
with on single primary (3 values for position, direction), or paired primary (6 values).
‘move_backward’ function: consider all particles positions and move their backward according to their direction,
using the factor provided by the user in ‘user_info.backward_distance’. This is useful to allow generating particles that do not intersect with the detector.
‘copy_generated_particle_to_g4’ function: copy all the particles (pos, dir, time, energy) to the cpp part.
- class opengate.GANSourceConditionalPairsGenerator(user_info, sphere_radius, generate_condition_function)[source]¶
Bases:
opengate.source.GANSourceDefaultGenerator.GANSourceDefaultGeneratorGenerate pairs of particles with a GAN, considering conditional vectors.
The parameter sphere_radius is required : it is the radius of the sphere that surround the source during the training.
- class opengate.VoxelizedSourcePDFSampler(itk_image, version=1)[source]¶
This is an alternative to GateSPSVoxelsPosDistribution (c++) It is needed because the cond voxel source is used on python side.
There are two versions, version 2 is much slower (do not use)
- class opengate.PencilBeamSource(user_info)[source]¶
Bases:
opengate.source.GenericSource.GenericSourcePencil Beam source
- class opengate.GenericSource(user_info)[source]¶
Bases:
opengate.SourceBaseGeneriSource close to the G4 SPS, but a bit simpler.
- opengate.available_additional_physics_lists = ['G4EmStandardPhysics_option1', 'G4EmStandardPhysics_option2', 'G4EmStandardPhysics_option3',...[source]¶
- opengate.create_modular_physics_list_class(pl_class)[source]¶
Create a class (not on object!) which: - inherit from g4.G4VModularPhysicsList - register a single G4 PhysicList (G4VPhysicsConstructor) - is named with the name of this PhysicList
- opengate.modular_physics_list_constructor(self)[source]¶
Constructor of the above, dynamically created class. - call the constructor of the super class (G4VModularPhysicsList) - Create and register the physic list (G4VPhysicsConstructor)
- opengate.create_modular_physics_list(pl_name)[source]¶
Dynamically create a class with the given PhysicList Only possible if the class exist in g4
- class opengate.ActorEngine(actor_manager, simulation_engine)[source]¶
Bases:
opengate.EngineBaseFIXME
- class opengate.ActionEngine(source)[source]¶
Bases:
opengate_core.G4VUserActionInitialization,opengate.EngineBaseMain object to manage all actions during a simulation.
- class opengate.UIsessionVerbose[source]¶
Bases:
opengate_core.G4UIsessionPrint Geant4 Verbose with color
- class opengate.RunAction[source]¶
Bases:
opengate_core.G4UserRunActionUser action at begin and end of run. Every time a run begin/end, the G4 engine call BeginOfRunAction and EndOfRunAction. The callback is then forwarded to all actors that need it.
- class opengate.PhysicsUserInfo(simulation)[source]¶
This class is a simple structure that contains all user general options of ths physics list.
- class opengate.PhysicsManager(simulation)[source]¶
Everything related to the physics (lists, cuts etc) should be here.
- class opengate.PhysicsEngine(physics_manager)[source]¶
Bases:
opengate.EngineBaseFIXME