tomophantom.TomoP3D#

Copyright 2023 The University of Manchester & Diamond Light Source Licensed under the Apache License, Version 2.0.

These are modules for generation of 3D and 4D (dynamic extensions) phantoms and their analytical data.

API Summary:

  • Model - generates a 3D phantom from the Library (Phantom3DLibrary)

  • ModelSub - generates a vertical subset (cutoff) for model from the Library (Phantom3DLibrary)

  • ModelTemporal - generates a (3D + t) 4D model from the Library (Phantom3DLibrary)

  • ModelTemporalSub - generates a vertical subset (cutoff) of 4D model from the Library (Phantom3DLibrary)

  • ModelSino - generates 3D projection data for a model from the Library (Phantom3DLibrary)

  • ModelSinoSub - generates a vertical subset (cutoff) for 3D projection data for a model from the Library (Phantom3DLibrary)

  • ModelSinoTemporal - generates (3D + t) 4D projection data for a temporal model from the Library (Phantom3DLibrary)

  • ModelSinoTemporalSub - generates (3D + t) 4D projection data (subset) for a temporal model from the Library (Phantom3DLibrary)

  • Object - generates a 3D phantom from a given object described in the dictionary.

  • ObjectSino - generates a 3D projection data from a given object described in the dictionary.

tomophantom.TomoP3D.Model(model_no: int, phantom_size: Union[int, Tuple[int, int, int]], models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates a 3D phantom based on the model no. in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int, Tuple(int)) – A scalar or a tuple with phantom dimensions.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 3D phantom.

Return type

np.ndarray

tomophantom.TomoP3D.ModelSino(model_no: int, phantom_size: int, detector_horiz: int, detector_vert: int, angles: numpy.ndarray, models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates a 3D analytical sinogram for corresponding models in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int) – A scalar for squared phantom dimensions (2D slice).

  • detector_horiz (int) – Size of the horizontal detector in pixels.

  • detector_vert (int) – Size of the vertical detector in pixels.

  • angles (np.ndarray) – Angles vector in degrees.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 3D projection data of the following shape [detector_vert, AngTot, detector_horiz].

Return type

np.ndarray

tomophantom.TomoP3D.ModelSinoSub(model_no: int, phantom_size: int, detector_horiz: int, detector_vert: int, sub_index: tuple, angles: numpy.ndarray, models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates a 3D analytical sinogram with vertical cutoff using sub_index tuple for corresponding models in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int) – A scalar for squared phantom dimensions (2D slice).

  • detector_horiz (int) – Size of the horizontal detector in pixels.

  • detector_vert (int) – Size of the vertical detector in pixels.

  • sub_index (Tuple[int, int]) – a tuple containing 2 indeces (lower, upper) to select a vertical subset.

  • angles (np.ndarray) – Angles vector in degrees.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 3D projection data of the following shape [detector_vert, AngTot, detector_horiz].

Return type

np.ndarray

tomophantom.TomoP3D.ModelSinoTemporal(model_no: int, phantom_size: int, detector_horiz: int, detector_vert: int, angles: numpy.ndarray, models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates a 4D (3D+time) analytical sinogram for corresponding models in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Temporal model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int) – A scalar for squared phantom dimensions (2D slice).

  • detector_horiz (int) – Size of the horizontal detector in pixels.

  • detector_vert (int) – Size of the vertical detector in pixels.

  • angles (np.ndarray) – Angles vector in degrees.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 4D projection data of the following shape [time_frames, detector_vert, AngTot, detector_horiz].

Return type

np.ndarray

tomophantom.TomoP3D.ModelSinoTemporalSub(model_no: int, phantom_size: int, detector_horiz: int, detector_vert: int, sub_index: tuple, angles: numpy.ndarray, models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates a 4D analytical sinogram with vertical cutoff using sub_index tuple for corresponding models in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Temporal model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int) – A scalar for squared phantom dimensions (2D slice).

  • detector_horiz (int) – Size of the horizontal detector in pixels.

  • detector_vert (int) – Size of the vertical detector in pixels.

  • sub_index (Tuple[int, int]) – a tuple containing 2 indeces (lower, upper) to select a vertical subset.

  • angles (np.ndarray) – Angles vector in degrees.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 3D projection data of the following shape [time, detector_vert, AngTot, detector_horiz].

Return type

np.ndarray

tomophantom.TomoP3D.ModelSub(model_no: int, phantom_size: Union[int, Tuple[int, int, int]], sub_index: Tuple[int, int], models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates a subset of 3D phantom (vertical cutoff) based on the model no. in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int, Tuple(int)) – A scalar or a tuple with phantom dimensions.

  • sub_index (Tuple[int, int]) – a tuple containing 2 indeces (lower, upper) to select a vertical subset.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 3D phantom.

Return type

np.ndarray

tomophantom.TomoP3D.ModelTemporal(model_no: int, phantom_size: Union[int, Tuple[int, int, int]], models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates 4D (3D+time) phantom based on the model no. in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int, Tuple(int)) – A scalar or a tuple with phantom dimensions.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 4D phantom.

Return type

np.ndarray

tomophantom.TomoP3D.ModelTemporalSub(model_no: int, phantom_size: Union[int, Tuple[int, int, int]], sub_index: Tuple[int, int], models_library_path: pathlib.Path) numpy.ndarray[source]#

Generates a subset of 4D phantom (vertical cutoff) based on the model no. in the library file Phantom3DLibrary.dat.

Parameters
  • model_no (int) – Model number from the Phantom3DLibrary.dat library file.

  • phantom_size (int, Tuple(int)) – A scalar or a tuple with phantom dimensions.

  • sub_index (Tuple[int, int]) – a tuple containing 2 indeces (lower, upper) to select a vertical subset.

  • models_library_path (Path) – A path to the library file.

Returns

The generated 4D phantom.

Return type

np.ndarray

tomophantom.TomoP3D.Object(phantom_size: Union[int, Tuple[int, int, int]], obj_params: Union[list, dict]) numpy.ndarray[source]#

Generates a 3D object for the standalone geometrical figure that is parametrised in the “obj_params” dictionary.

Parameters
  • phantom_size (int, Tuple(int)) – A scalar or a tuple with phantom dimensions.

  • obj_params (a list of dicts or dict) – A dictionary with parameters of an object, see demos.

Returns

The generated 3D object.

Return type

np.ndarray

tomophantom.TomoP3D.ObjectSino(phantom_size: int, detector_horiz: int, detector_vert: int, angles: numpy.ndarray, obj_params: Union[list, dict]) numpy.ndarray[source]#

Generates a 3D analytical projection data for the standalone geometrical figure that is parametrised in the “obj_params” dictionary.

Parameters
  • phantom_size (int) – A scalar for phantom dimensions.

  • detector_horiz (int) – Size of the horizontal detector in pixels.

  • detector_vert (int) – Size of the vertical detector in pixels.

  • angles (np.ndarray) – Angles vector in degrees.

  • obj_params (a list of dicts or dict) – A dictionary with parameters of an object, see demos.

Returns

The generated 3D projection data for an object.

Return type

np.ndarray