tomopy.sim.project

Module for simulation of x-rays.

Functions:

angles(nang[, ang1, ang2]) Return uniformly distributed projection angles in radian.
project(obj, theta[, center, emission, pad, …]) Project x-rays through a given 3D object.
fan_to_para(tomo, dist, geom) Convert fan-beam data to parallel-beam data.
para_to_fan(tomo, dist, geom) Convert parallel-beam data to fan-beam data.
add_gaussian(tomo[, mean, std]) Add Gaussian noise.
add_poisson(tomo) Add Poisson noise.
add_salt_pepper(tomo[, prob, val]) Add salt and pepper noise.
add_focal_spot_blur(tomo, spotsize) Add focal spot blur.
tomopy.sim.project.angles(nang, ang1=0.0, ang2=180.0)[source]

Return uniformly distributed projection angles in radian.

Parameters:
  • nang (int, optional) – Number of projections.
  • ang1 (float, optional) – First projection angle in degrees.
  • ang2 (float, optional) – Last projection angle in degrees.
Returns:

array – Projection angles

tomopy.sim.project.project(obj, theta, center=None, emission=True, pad=True, sinogram_order=False, ncore=None, nchunk=None)[source]

Project x-rays through a given 3D object.

Parameters:
  • obj (ndarray) – Voxelized 3D object.
  • theta (array) – Projection angles in radian.
  • center (array, optional) – Location of rotation axis.
  • emission (bool, optional) – Determines whether output data is emission or transmission type.
  • pad (bool, optional) – Determines if the projection image width will be padded or not. If True, then the diagonal length of the object cross-section will be used for the output size of the projection image width.
  • sinogram_order (bool, optional) – Determines whether output data is a stack of sinograms (True, y-axis first axis) or a stack of radiographs (False, theta first axis).
  • ncore (int, optional) – Number of cores that will be assigned to jobs.
  • nchunk (int, optional) – Chunk size for each core.
Returns:

ndarray – 3D tomographic data.

tomopy.sim.project.project2(objx, objy, theta, center=None, emission=True, pad=True, sinogram_order=False, axis=0, ncore=None, nchunk=None)[source]

Project x-rays through a given 3D object.

Parameters:
  • objx (ndarray) – (x, y) components of vector of a voxelized 3D object.
  • theta (array) – Projection angles in radian.
  • center (array, optional) – Location of rotation axis.
  • emission (bool, optional) – Determines whether output data is emission or transmission type.
  • pad (bool, optional) – Determines if the projection image width will be padded or not. If True, then the diagonal length of the object cross-section will be used for the output size of the projection image width.
  • sinogram_order (bool, optional) – Determines whether output data is a stack of sinograms (True, y-axis first axis) or a stack of radiographs (False, theta first axis).
  • ncore (int, optional) – Number of cores that will be assigned to jobs.
  • nchunk (int, optional) – Chunk size for each core.
Returns:

ndarray – 3D tomographic data.

tomopy.sim.project.project3(objx, objy, objz, theta, center=None, emission=True, pad=True, sinogram_order=False, axis=0, ncore=None, nchunk=None)[source]

Project x-rays through a given 3D object.

Parameters:
  • objx (ndarray) – (x, y) components of vector of a voxelized 3D object.
  • theta (array) – Projection angles in radian.
  • center (array, optional) – Location of rotation axis.
  • emission (bool, optional) – Determines whether output data is emission or transmission type.
  • pad (bool, optional) – Determines if the projection image width will be padded or not. If True, then the diagonal length of the object cross-section will be used for the output size of the projection image width.
  • sinogram_order (bool, optional) – Determines whether output data is a stack of sinograms (True, y-axis first axis) or a stack of radiographs (False, theta first axis).
  • ncore (int, optional) – Number of cores that will be assigned to jobs.
  • nchunk (int, optional) – Chunk size for each core.
Returns:

ndarray – 3D tomographic data.

tomopy.sim.project.fan_to_para(tomo, dist, geom)[source]

Convert fan-beam data to parallel-beam data.

Warning

Not implemented yet.

Parameters:
  • tomo (ndarray) – 3D tomographic data.
  • dist (float) – Distance from fan-beam vertex to rotation center.
  • geom (str) – Fan beam geometry. ‘arc’ or ‘line’.
Returns:

ndarray – Transformed 3D tomographic data.

tomopy.sim.project.para_to_fan(tomo, dist, geom)[source]

Convert parallel-beam data to fan-beam data.

Warning

Not implemented yet.

Parameters:
  • tomo (ndarray) – 3D tomographic data.
  • dist (float) – Distance from fan-beam vertex to rotation center.
  • geom (str) – Fan beam geometry. ‘arc’ or ‘line’.
Returns:

ndarray – Transformed 3D tomographic data.

tomopy.sim.project.add_gaussian(tomo, mean=0, std=None)[source]

Add Gaussian noise.

Parameters:
  • tomo (ndarray) – 3D tomographic data.
  • mean (float, optional) – Mean of the Gaussian distribution.
  • std (float, optional) – Standard deviation of the Gaussian distribution.
Returns:

ndarray – 3D tomographic data after Gaussian noise added.

tomopy.sim.project.add_poisson(tomo)[source]

Add Poisson noise.

Parameters:tomo (ndarray) – 3D tomographic data.
Returns:ndarray – 3D tomographic data after Poisson noise added.
tomopy.sim.project.add_salt_pepper(tomo, prob=0.01, val=None)[source]

Add salt and pepper noise.

Parameters:
  • tomo (ndarray) – 3D tomographic data.
  • prob (float, optional) – Independent probability that each element of a pixel might be corrupted by the salt and pepper type noise.
  • val (float, optional) – Value to be assigned to the corrupted pixels.
Returns:

ndarray – 3D tomographic data after salt and pepper noise added.

tomopy.sim.project.add_focal_spot_blur(tomo, spotsize)[source]

Add focal spot blur.

Warning

Not implemented yet.

Parameters:
  • tomo (ndarray) – 3D tomographic data.
  • spotsize (float) – Focal spot size of circular x-ray source.