Detector Pixel Arrays

The detector pixel arrays are used to store the data about the shape of the pixel array and position of the source. This is used to calculate the ray paths for each projection, and which pixel that a ray may intersect.

Detector Array

Purpose

This class is a template for all detector pixel arrays and should hold all the information that is the same for across each detector type.

Properties

pixel_dims

(1x2 double) The dimensions of the pixel array in the x and y directions.

n_pixels

(1x2 double) The number of pixels in the x and y directions.

Functions

detector_array(pixel_dims, n_pixels)

Constructor for the detector_array class. This just sets the class attributes to the input values.

Parameters:
  • pixel_dims (1x2 double) – is the dimensions of the pixel array in the x and y directions.

  • n_pixels (1x2 double) – is the number of pixels in the x and y directions.

Returns:

detector_array – an instance of the detector_array class.

Return type:

detector_array

Abstract Methods

set_array_angle(self, detect_geom, angle_index)

This method is used to generate all the pixel positions for a given angle. The returned array must be a 3xNxM array, where N and M is the number of pixels in the y and z directions respectively.

Parameters:
  • detect_geom (gantry) – is the detector geometry, so an instance of gantry.

  • angle_index (double) – is the index of the angle that the gantry is at.

Returns:

pixel_positions – a list of the pixel positions for each pixel in the array, where N is the number of pixels in the y direction and M is the number of pixels in the z direction.

Return type:

3xNxM double

hit_pixel(self, detect_geom, angle_index)

This method is used to generate a function which calculates which pixel a ray may intersect. This is an abstract method and should be implemented in the subclasses, so cannot be called from this class. If you create a new detector array, and you do not plan to use it with the deterministic_scatter() function, then you can simply call a not implemented error.

Parameters:
  • detect_geom (gantry) – an instance of the gantry.

  • angle_index (double) – is the index of the angle that the gantry is at.

Returns:

hit_pixel_at_angle – a function that calculates the intersected pixel for a given ray. See hit_pixel_at_angle() for more information.

Return type:

function

Nested Functions

hit_pixel_at_angle(ray_starts, ray_dirs)

This function is used to calculate which pixel a ray may intersect. This is a nested function that must be returned from the hit_pixel() method.

Parameters:
  • ray_starts (3xN double) – An array of the starting positions of the rays.

  • ray_dirs (3xN double) – An array of the directions of the rays.

Returns:

  • pixel (2xN double) – the \((y, z)\) pixels that the rays intersect, with zeros for each of the ray does not intersect any pixel.

  • ray_len (1xN double) – the lengths of the rays to the pixel, with zeros if the ray does not intersect any pixel.

  • angles (1xN double) – the angles of the rays with respect to he normal vector to the pixel, with zeros if the ray does not intersect any pixel.

  • hit (1xN logical) – a logical array, where true means that the ray intersects a pixel, and false means that the ray does not intersect a pixel.

Potential Future Changes

A ray_per_pixel parameter in the set_array_angle() is not implemented yet. This could be implemented in the future for anti-aliasing purposes.

Passing the detector geometry is a shortcut to getting a lot of information. This could be changed to passing vector from the detector array to the source centre and distance from the source to the detector array.

The available classes for the detector pixel arrays are:

Flat Detector

Purpose

The flat_detector class is a subclass of the class flat_array. The geometry of this is a flat detector panel, with the source emmitting rays perpendicular to the direction of the array.

Functions

flat_detector(pixel_dims, n_pixels)

Constructor for the flat_detector class. Identical to detector_array

Parameters:
  • pixel_dims (1x2 double) – is the dimensions of the pixel array in the x and y directions.

  • n_pixels (1x2 double) – is the number of pixels in the x and y directions.

Returns:

flat_detector – an instance of the flat_detector class.

Return type:

flat_detector

Methods

flat_detector.set_array_angle(detect_geom, angle_index, ray_per_pixel=1)
Parameters:
  • detect_geom (gantry) – an instance of the gantry.

  • angle_index (double) – is the index of the angle that the gantry is at.

Returns:

pixel_positions – all the pixel positions for a given angle for a flat detector panel.

Return type:

3xNxM double

flat_detector.hit_pixel(detect_geom, angle_index)
Parameters:
  • detect_geom (gantry) – an instance of the gantry.

  • angle_index (double) – is the index of the angle that the gantry is at.

Returns:

hit_pixel_at_angle – a function that calculates the intersected pixel for a given ray. See hit_pixel_at_angle() for more information.

Curved Detector

Purpose

The curved_detector class is a subclass of the class detector_array. The geometry of this is a cylindrical detector panel, where the array of sensors is placed along an arc. The width of the pixel is considered a chord length of the arc, so the angle subtended by each pixel is calculated using this chord length.

Functions

curved_detector(pixel_dims, n_pixels)

Constructor for the curved_detector class. Identical to detector_array

Parameters:
  • pixel_dims (1x2 double) – is the dimensions of the pixel array in the x and y directions.

  • n_pixels (1x2 double) – is the number of pixels in the x and y directions.

Returns:

curved_detector – an instance of the curved_detector class.

Return type:

curved_detector

Methods

curved_detector.set_array_angle(detect_geom, angle_index)

This method returns all the pixel positions for a given angle for a curved detector panel.

Parameters:
  • detect_geom (gantry) – an instance of the gantry.

  • angle_index (double) – is the index of the angle that the gantry is at.

Returns:

pixel_positions – all the pixel positions for a given angle for a curved detector panel.

Return type:

3xNxM double

curved_detector.hit_pixel(detect_geom, angle_index)

This method returns a function that calculates the position of the pixel at a given angle for a curved detector panel, along with the length of the ray and the angle of the ray with respect to the normal vector to the pixel. It uses the cyclinder intersection method here.

Parameters:
  • detect_geom (gantry) – an instance of the gantry.

  • angle_index (double) – is the index of the angle that the gantry is at.

Returns:

hit_pixel_at_angle – a function that calculates the intersected pixel for a given ray. See hit_pixel_at_angle() for more information.