3.10.1.20.1.3. opengate.sources.gansources¶
3.10.1.20.1.3.1. Classes¶
This is an alternative to GateSPSVoxelsPosDistribution (c++) |
|
GAN source: the Generator produces particles |
|
GAN source: the Generator produces pairs of particles (for PET) |
|
This class manage the base components of a particle generator. |
|
Like GANSourceDefaultGenerator but for pairs of particle (PET) |
|
This class manage the base components of a particle generator. |
|
Generate pairs of particles with a GAN, considering conditional vectors. |
3.10.1.20.1.3.2. Functions¶
3.10.1.20.1.3.3. Module Contents¶
- class opengate.sources.gansources.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.sources.gansources.VoxelizedSourceConditionGenerator(activity_source_filename, rs=np.random, use_activity_origin=False)[source]¶
- class opengate.sources.gansources.GANSource(user_info)[source]¶
Bases:
opengate.sources.generic.GenericSourceGAN source: the Generator produces particles Input is a neural network Generator trained with a GAN
- class opengate.sources.gansources.GANPairsSource(user_info)[source]¶
Bases:
GANSourceGAN source: the Generator produces pairs of particles (for PET) Input is a neural network Generator trained with a GAN
- class opengate.sources.gansources.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.
- get_gan_key_index(all_keys, user_keys, n)[source]¶
Consider ‘user_keys’ in the list of all keys and return the indexes Special case: if the key name is a float value, we consider the value instead of the index.
- class opengate.sources.gansources.GANSourceDefaultPairsGenerator(user_info)[source]¶
Bases:
GANSourceDefaultGeneratorLike GANSourceDefaultGenerator but for pairs of particle (PET)
- class opengate.sources.gansources.GANSourceConditionalGenerator(user_info, generate_condition_function)[source]¶
Bases:
GANSourceDefaultGeneratorThis 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.sources.gansources.GANSourceConditionalPairsGenerator(user_info, sphere_radius, generate_condition_function)[source]¶
Bases:
GANSourceDefaultPairsGeneratorGenerate 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.