7.5.2. algotom.util.simulation
¶
Module of simulation methods:
Methods for designing a customized 2D phantom.
Method for calculating a sinogram of a phantom based on the Fourier slice theorem.
Methods for adding artifacts to a simulated sinogram.
Functions:
|
Create an elliptic mask. |
|
Create a rectangular mask. |
|
Create an isosceles triangle mask. |
|
Create line patterns for testing the resolution of a reconstructed image. |
|
Create a face phantom for testing reconstruction methods. |
|
Create a sinogram (series of 1D projections) from a 2D image based on the Fourier slice theorem (Ref. |
|
Add Gaussian noise to an image. |
|
Add stripe artifacts to a sinogram. |
|
Convert a simulated sinogram to an equivalent X-ray image. |
|
Fluctuate the background of a sinogram image using a Gaussian profile beam. |
- algotom.util.simulation.make_elliptic_mask(size, center, length, angle)[source]¶
Create an elliptic mask.
- Parameters
size (int) – Size of a square array.
center (float or tuple of float) – Ellipse center.
length (float or tuple of float) – Lengths of ellipse axes.
angle (float) – Rotation angle (Degree) of the ellipse.
- Returns
array_like – Square array.
- algotom.util.simulation.make_rectangular_mask(size, center, length, angle)[source]¶
Create a rectangular mask.
- Parameters
size (int) – Size of a square array.
center (float or tuple of float) – Center of the mask.
length (float or tuple of float) – Lengths of the rectangular mask.
angle (float) – Rotation angle (Degree) of the mask.
- Returns
array_like – Square array.
- algotom.util.simulation.make_triangular_mask(size, center, length, angle)[source]¶
Create an isosceles triangle mask.
- Parameters
size (int) – Size of a square array.
center (float or tuple of float) – Center of the mask.
length (float or tuple of float) – Lengths of the mask.
angle (float) – Rotation angle (Degree) of the mask.
- Returns
array_like – Square array.
- algotom.util.simulation.make_line_target(size)[source]¶
Create line patterns for testing the resolution of a reconstructed image.
- Parameters
size (int) – Size of a square array.
- Returns
array_like – Square array.
- algotom.util.simulation.make_face_phantom(size)[source]¶
Create a face phantom for testing reconstruction methods.
- Parameters
size (int) – Size of a square array.
- Returns
array_like – Square array.
- algotom.util.simulation.make_sinogram(mat, angles, pad_rate=0.5, pad_mode='edge')[source]¶
Create a sinogram (series of 1D projections) from a 2D image based on the Fourier slice theorem (Ref. [1]).
- Parameters
mat (array_like) – Square array.
angles (array_like) – 1D array. List of angles (in radian) for projecting.
pad_rate (float) – To apply padding before the FFT. The padding width equals to (pad_rate * image_width).
pad_mode (str) – Padding method. Full list can be found at numpy_pad documentation.
References
- algotom.util.simulation.add_noise(mat, noise_ratio=0.1)[source]¶
Add Gaussian noise to an image.
- Parameters
mat (array_like) – 2D array
noise_ratio (float) – Ratio between the noise level and the mean of the array.
- Returns
array_like
- algotom.util.simulation.add_stripe_artifact(sinogram, size, position, strength_ratio=0.2, stripe_type='partial')[source]¶
Add stripe artifacts to a sinogram.
- Parameters
sinogram (array_like) – 2D array. Sinogram image.
size (int) – Size of stripe artifact.
position (int) – Position of the stripe.
strength_ratio (float) – To define the strength of the artifact. The value is in the range of [0.0, 1.0].
stripe_type ({“partial”, “full”, “dead”, “fluctuating”}) – Type of stripe as classified in Ref. [1].
- Returns
array_like
References
- algotom.util.simulation.convert_to_Xray_image(sinogram, global_max=None)[source]¶
Convert a simulated sinogram to an equivalent X-ray image.
- Parameters
sinogram (array_like) – 2D array.
global_max (float) – Maximum value used for normalizing array values to stay in the range of [0.0, 1.0].
- Returns
array_like
- algotom.util.simulation.add_background_fluctuation(sinogram, strength_ratio=0.2)[source]¶
Fluctuate the background of a sinogram image using a Gaussian profile beam.
- Parameters
sinogram (array_like) – 2D array. Sinogram image.
strength_ratio (float) – To define the strength of the variation. The value is in the range of [0.0, 1.0].
- Returns
array_like