Voxelized source#
Description#
A voxelized source can be created as follows:
source = sim.add_source('VoxelSource', 'vox')
source.particle = 'e-'
source.activity = 4000 * Bq
source.image = 'an_activity_image.mhd'
source.direction.type = 'iso'
source.energy.mono = 100 * keV
source.attached_to = 'my_volume_name'
This code create a voxelized source. The 3D activity distribution is read from the given image. This image is internally normalized such that the sum of all pixels values is 1, leading to a 3D probability distribution. Particles will be randomly located somewhere in the image according to this probability distribution. Note that once an activity voxel is chosen from this distribution, the location of the particle inside the voxel is performed uniformly. In the given example, 4 kBq of electrons of 140 keV will be generated.
Like all objects, by default, the source is located according to the
coordinate system of its attached_to volume. For example, if the attached_to
volume is a box, it will be the center of the box. If it is a voxelized
volume (typically a CT image), it will the center of this image: the
image own coordinate system (ITK’s origin) is not considered here. If
you want to align a voxelized activity with a CT image that have the
same coordinate system you should compute the correct translation. This
is done by the function
gate.image.get_translation_between_images_center()
. See the contrib
example dose_rate.py
.
Reference#
- 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.
- class VoxelSource(*args, **kwargs)[source]#
VoxelSource = 3D activity distribution. Sampled with cumulative distribution functions.
User input parameters and default values:
activity:
Default value: 0
Description: Activity of the source in Bq (exclusive with ‘n’)
attached_to:
Default value: world
Description: Name of the volume to which the source is attached.
direction:
Default value: {‘type’: ‘iso’, ‘theta’: [0, 3.141592653589793], ‘phi’: [0, 6.283185307179586], ‘momentum’: [0, 0, 1], ‘focus_point’: [0, 0, 0], ‘sigma’: [0, 0], ‘acceptance_angle’: {‘skip_policy’: ‘SkipEvents’, ‘volumes’: [], ‘intersection_flag’: False, ‘normal_flag’: False, ‘normal_vector’: [0, 0, 1], ‘normal_tolerance’: 0.05235987755982989}, ‘accolinearity_flag’: False, ‘accolinearity_fwhm’: 0.008726646259971648, ‘histogram_theta_weights’: [], ‘histogram_theta_angles’: [], ‘histogram_phi_weights’: [], ‘histogram_phi_angles’: []}
Description: Define the direction of the primary particles
direction_relative_to_attached_volume:
Default value: False
Description: Should we update the direction of the particle when the volume is moved (with dynamic parametrisation)?
end_time:
Default value: None
Description: End time of the source
energy:
Default value: {‘type’: ‘mono’, ‘mono’: 0, ‘sigma_gauss’: 0, ‘is_cdf’: False, ‘min_energy’: None, ‘max_energy’: None, ‘spectrum_type’: None, ‘spectrum_weights’: [], ‘spectrum_energies’: [], ‘spectrum_energy_bin_edges’: [], ‘spectrum_histogram_interpolation’: None}
Description: Define the energy of the primary particles
half_life:
Default value: -1
Description: Half-life decay (-1 if no decay). Only when used with ‘activity’
image:
Default value: None
Description: Filename of the image of the 3D activity distribution (will be automatically normalized to sum=1)
ion:
Default value: {‘Z’: 0, ‘A’: 0, ‘E’: 0}
Description: If the particle is an ion, you must set Z: Atomic Number, A: Atomic Mass (nn + np +nlambda), E: Excitation energy (i.e. for metastable)
mother:
Deprecated: The user input parameter ‘mother’ is deprecated. Use ‘attached_to’ instead.
n:
Default value: 0
Description: Number of particle to generate (exclusive with ‘activity’)
name (must be provided):
Default value: None
particle:
Default value: gamma
Description: Name of the particle generated by the source (gamma, e+ … or an ion such as ‘ion 9 18’)
position:
Default value: {‘type’: ‘point’, ‘radius’: 0, ‘sigma_x’: 0, ‘sigma_y’: 0, ‘size’: [0, 0, 0], ‘translation’: [0, 0, 0], ‘rotation’: array([[1., 0., 0.],, [0., 1., 0.],, [0., 0., 1.]]), ‘confine’: None}
Description: Define the position of the primary particles
start_time:
Default value: None
Description: Starting time of the source
tac_activities:
Default value: None
Description: TAC: Time Activity Curve, this set the vector for the activities. Must be used with tac_times.
tac_times:
Default value: None
Description: TAC: Time Activity Curve, this set the vector for the times. Must be used with tac_activities.
user_particle_life_time:
Default value: -1
Description: FIXME
weight:
Default value: -1
Description: Particle initial weight (for variance reduction technique)
weight_sigma:
Default value: -1
Description: if not negative, the weights of the particle are a Gaussian distribution with this sigma