3.10.1.11.1.3. opengate.geometry.utility¶
3.10.1.11.1.3.1. Functions¶
|
|
|
|
|
Consider the point x in the current volume and return the coordinate of x in the top volume |
|
Print a tree of volume |
https://stackoverflow.com/questions/53808503/how-to-test-if-a-matrix-is-a-rotation-matrix |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calculate the rotation and translation needed |
|
|
|
Generate translations and rotations to repeat volumes in a circle. |
|
Generate a list of 3-vectors to be used as 'translation' parameter of a repeated volume. |
|
3.10.1.11.1.3.2. Module Contents¶
- opengate.geometry.utility.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.
- opengate.geometry.utility.is_rotation_matrix(R)[source]¶
https://stackoverflow.com/questions/53808503/how-to-test-if-a-matrix-is-a-rotation-matrix
- opengate.geometry.utility.ensure_is_g4_transform(translation=(0, 0, 0), rotation=Rotation.identity().as_matrix())[source]¶
- opengate.geometry.utility.get_transform_world_to_local(volume, repetition_index=None)[source]¶
Calculate the rotation and translation needed to transform from the world reference frame into the local reference frame of this volume.
If repetition_index is None: Returns two lists, the first with translation vectors, the second with rotation matrices. Each list entry corresponds to one physical volume of the Gate volume, i.e. one repetition. For non-repeated volumes, the lists will contain one item only.
If repetition_index is a valid integer, return the translation and rotation for that repeated physical volume only.
- opengate.geometry.utility.get_circular_repetition(number_of_repetitions, first_translation, angular_step_deg='auto_full_circle', start_angle_deg=0.0, additional_rotation=Rotation.identity().as_matrix(), axis=(0, 0, 1))[source]¶
Generate translations and rotations to repeat volumes in a circle.
This helper function generates translations and rotations for a volume to be repeated in a circle, e.g. in a PET ring. The returned lists with translations and rotations can be used as input to the translation and rotation parameter of any repeatable volume in Gate.
- Args:
number_of_repetitions (int) : How many times should the volume be repeated? first_translation (3-vector) : Where should the first copy of the volume be placed (wrt. to the mother volume)? angular_step_deg (float, optional) : The angular step in degrees between subsequent repetitions.
Accepts a number or two special arguments, ‘auto_full_circle’ and ‘auto_half_circle’, to determine the angular step automatically. Default: ‘auto_full_circle’
- start_angle_deg (int, optional)The angle at which the repetition starts.
The first volume copy is placed at first_translation and then rotated by start_angle_deg. Default: 0.
- additional_rotation (3x3 rotation matrix, optional)Additional rotation to be applied to all copies,
e.g. if the volume is tilted. Default: 3x3 identity.
- axis (3-vector, optional)The axis (in the mother’s frame of reference) around which
the circular repetition is performed. Default: [0, 0, 1], i.e. z-axis, circle in the x-y-plane.
- Returns:
list : A list of translation vectors, one for each repetition. list : A list of rotation matrices, one for each repetition.
- opengate.geometry.utility.get_grid_repetition(size, spacing, start=None, return_lut=False)[source]¶
Generate a list of 3-vectors to be used as ‘translation’ parameter of a repeated volume.
- Args:
- size (list, np.ndarray)3-item list or numpy array specifying the number of repetitions
along the axes x, y, z.
- spacing (list, np.ndarray)3-item list or numpy array specifying the spacing along the axes x, y, z
between the translation vectors.
- start (optional): Optional 3-item list or numpy array specifying the first translation vector on the grid.
If not provided, the grid is centered around (0,0,0).
- return_lut (bool, optional)If true, the functions also returns a dictionary mapping copy index
to the respective translation vector for later reference.
- Returns:
list : A list of translations vectors. dict : (Optional) A dictionary mapping copy index to the respective translation vector. Only if return_lut is True.