Detector Movement

The detector movement is controlled by the super class gantry. The available classes are:

Gantry Class

Purpose

The gantry class is used to control the movement of the gantry, it is used to store the parameters of the how your image will be created through the movement of the gantry.

The get_rot_mat() method is used to get the rotation matrix for the gantry, this is not intended to be used by the user but is used by classes which are intended to be attached to the gantry.

Properties

dist_to_detector

(double) from source to detector

rot_radius

(double) The radius of rotation of the gantry. This is calculated as dist_to_detector/2. This is a precalculation to save time in the method get_rot_mat().

to_source_vec = [0;1;0]

(3x1 double) Vector from source to centre of detector. The initial value is [0;1;0] as the source will always start in the positive y position. This is used in the detector_array classes to calculate the ray paths for each projection.

num_rotations

(double) Number of rotations the gantry will make, i.e. the number of projections. This is required in the function compute_sinogram()

rot_angle

(double) The angle of rotation for each projection. Calculated as total_rotation/num_rotations. This is a precalculation to save time in the method get_rot_mat().

scan_angles

(double) The angles at which the gantry will rotate to. This is for the user to get the scan angles for use with reconstruction algorithms.

Functions

gantry(dist_to_detector, num_rotations, total_rotation=2*pi)

Constructor for the gantry class.

Parameters:
  • dist_to_detector (double) – is the distance from the source to the detector.

  • num_rotations (double) – is the number of rotations the gantry will make, i.e. the number of projections.

  • total_rotation (double) – is the total rotation of the gantry in radians (default \(2\pi\)).

Returns:

gantry – The gantry object.

Return type:

gantry

Methods

get_rot_mat()

Returns the rotation matrix for the gantry. This is used to rotate any objects attached to the gantry.

Returns:

The rotation matrix for the gantry.

get_source_pos(index, pixel_positions)
Parameters:
  • index (double) – The index rotation of the gantry.

  • pixel_positions (3xN double) – The position of the pixel on the detector.

Returns the position of the source for every pixel position. This is used to calculate the ray paths for each projection. For this gantry, the source position is independent of the pixel position and a single point, dependent on the index of the rotation, so a list of the same source position the same size as the pixel position is returned.

Returns:

source_pos – The positions of the source.

Return type:

3xN double

Potential Future Changes

This class will likely be changed to be an abstract class, and then a new class will be created for each type of gantry. This will allow for more specific gantry types to be created, such as axial or helical gantry, and for the user to be able to create their own gantry types.

Parallel Gantry Class

Purpose

The parallel gantry class is a subclass of the gantry class. It has the same properties and methods as the gantry class, but has a different method for getting the source position. This is because the source position is dependent on the pixel position for the parallel gantry.

Methods

get_source_pos(index, pixel_positions)
Parameters:
  • index (double) – The index rotation of the gantry.

  • pixel_positions (3x1 double) – The position of the pixel on the detector.

Returns the positions of the source, directly above the pixel positions. This is used to calculate the ray paths for each projection. For this gantry, the source position is dependent on the pixel position, so the source position is calculated for each pixel position.

Returns:

source_pos – The position of the source relative to each pixel position.

Return type:

3xN double