tomophantom.TomoP2D
#
Copyright 2023 The University of Manchester & Diamond Light Source Licensed under the Apache License, Version 2.0.
These are modules for generation of 2D and 3D (dynamic extensions) phantoms and their analytical data.
API Summary:
Model - generates a 2D phantom from the Library (Phantom2DLibrary)
ModelTemporal - generates a (2D+t) 3D model from the Library (Phantom2DLibrary)
ModelSino - generates 2D sinogram for a model from the Library (Phantom2DLibrary)
ModelSinoTemporal - generates (2D+t) sinogram for a temporal model from the Library (Phantom2DLibrary)
Object - generates a 2D phantom from a given object described in the dictionary.
ObjectSino - generates a 2D sinogram from a given object described in the dictionary.
SinoNum - calculates a sinogram numerically from any given 2D array.
- tomophantom.TomoP2D.Model(model_no: int, phantom_size: int, models_library_path: pathlib.Path) numpy.ndarray [source]#
Generate 2D phantoms based on the model no. in the library file Phantom2DLibrary.dat.
- Parameters
model_no (int) – Model number from the Phantom2DLibrary.dat library file.
phantom_size (int) – A size of the generated phantom (squared).
models_library_path (Path) – A path to the library file.
- Returns
The generated 2D phantom (N x N).
- Return type
np.ndarray
- tomophantom.TomoP2D.ModelSino(model_no: int, phantom_size: int, detector_size: int, angles: numpy.ndarray, models_library_path: pathlib.Path) numpy.ndarray [source]#
Generate 2D analytical sinogram for corresponding models in the library file Phantom2DLibrary.dat.
- Parameters
model_no (int) – Model number from the Phantom2DLibrary.dat library file.
phantom_size (int) – A size of the phantom (squared).
detector_size (int) – A size of the horizontal detector.
angles (np.ndarray) – Angles vector in degrees.
models_library_path (Path) – A path to the library file.
- Returns
The generated 2D analytical sinogram (angles_total x detector_size).
- Return type
np.ndarray
- tomophantom.TomoP2D.ModelSinoTemporal(model_no: int, phantom_size: int, detector_size: int, angles: numpy.ndarray, models_library_path: pathlib.Path) numpy.ndarray [source]#
Generate 2D+time (temporal )analytical sinogram for corresponding models in the library file Phantom2DLibrary.dat.
- Parameters
model_no (int) – Temporal model number from the Phantom2DLibrary.dat library file.
phantom_size (int) – A size of the phantom (squared).
detector_size (int) – A size of the horizontal detector.
angles (np.ndarray) – Angles vector in degrees.
models_library_path (Path) – A path to the library file.
- Returns
The generated 2D+time analytical sinogram (time_frames x detector_size x angles_total).
- Return type
np.ndarray
- tomophantom.TomoP2D.ModelTemporal(model_no: int, phantom_size: int, models_library_path: pathlib.Path) numpy.ndarray [source]#
Generate 2D+time temporal phantoms based on the model no. in the library file Phantom2DLibrary.dat. Note that temporal phantom numbers begin at 100 onwards.
- Parameters
model_no (int) – Temporal model number from the Phantom2DLibrary.dat library file.
phantom_size (int) – A size of the generated phantom (squared).
models_library_path (Path) – A path to the library file.
- Returns
The generated 2D+time phantom (time_frames x N x N).
- Return type
np.ndarray
- tomophantom.TomoP2D.Object(phantom_size: int, obj_params: Union[list, dict]) numpy.ndarray [source]#
- Generate a 2D analytical phantom for the standalone
geometrical object that is parametrised in the “obj_params” dictionary.
- Parameters
phantom_size (int) – A size of the phantom (squared).
obj_params (list of dict or a dict) – A dictionary with parameters of an object, see Demos.
- Returns
The generated 2D analytical object.
- Return type
np.ndarray
- tomophantom.TomoP2D.ObjectSino(phantom_size: int, detector_size: int, angles: numpy.ndarray, obj_params: Union[list, dict]) numpy.ndarray [source]#
- Generate a 2D analytical sinogram for the standalone
geometrical object that is parametrised in the “obj_params” dictionary.
- Parameters
phantom_size (int) – A size of the phantom (squared).
detector_size (int) – A size of the horizontal detector.
angles (np.ndarray) – Angles vector in degrees.
obj_params (list of dicts or a dict) – A dictionary with parameters of an object, see Demos.
- Returns
The generated 2D analytical sinogram of an object.
- Return type
np.ndarray
- tomophantom.TomoP2D.SinoNum(input: numpy.ndarray, detector_X: int, angles: numpy.ndarray) numpy.ndarray [source]#
Numerical calculation of 2D sinogram from the 2D input.
- Parameters
input (np.ndarray) – 2D object (e.g. a phantom).
detector_X (int) – The size of the detector X.
angles (np.ndarray) – Angles vector in degrees.
- Raises
ValueError – if input is 3D
- Returns
Numerical sinogram calculated from the object
- Return type
np.ndarray