tomophantom.TomoP3D#

Modules for generating 3D synthetic phantoms and their analytical projection data. The dynamic phantoms (resulting in 4D arrays) can also be generated.

API Summary:

tomophantom.TomoP3D.Model(model_no: int, phantom_size: int | Tuple[int, int, int], models_library_path: Path) <np.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: <np.ndarray>, models_library_path: ~pathlib._local.Path) <np.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: <np.ndarray>, models_library_path: ~pathlib._local.Path) <np.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: <np.ndarray>, models_library_path: ~pathlib._local.Path) <np.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: <np.ndarray>, models_library_path: ~pathlib._local.Path) <np.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: int | Tuple[int, int, int], sub_index: Tuple[int, int], models_library_path: Path) <np.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: int | Tuple[int, int, int], models_library_path: Path) <np.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: int | Tuple[int, int, int], sub_index: Tuple[int, int], models_library_path: Path) <np.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: int | Tuple[int, int, int], obj_params: list | dict) <np.ndarray>[source]#

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

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 Object API.

Returns:

The generated 3D object.

Return type:

np.ndarray

tomophantom.TomoP3D.ObjectSino(phantom_size: int, detector_horiz: int, detector_vert: int, angles: <np.ndarray>, obj_params: list | dict) <np.ndarray>[source]#

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

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 Object API.

Returns:

The generated 3D projection data for an object.

Return type:

np.ndarray