tomopy.prep.alignment
¶
Functions:
align_seq (prj, ang[, fdir, iters, pad, …]) |
Aligns the projection image stack using the sequential re-projection algorithm [C8]. |
align_joint (prj, ang[, fdir, iters, pad, …]) |
Aligns the projection image stack using the joint re-projection algorithm [C8]. |
add_jitter (prj[, low, high]) |
Simulates jitter in projection images. |
add_noise (prj[, ratio]) |
Adds Gaussian noise with zero mean and a given standard deviation as a ratio of the maximum value in data. |
blur_edges (prj[, low, high]) |
Blurs the edge of the projection images. |
shift_images (prj, sx, sy) |
Shift projections images for a given set of shift values in horizontal and vertical directions. |
scale (prj) |
Linearly scales the projection images in the range between -1 and 1. |
tilt (obj[, rad, phi]) |
Tilt object at a given angle from the rotation axis. |
-
tomopy.prep.alignment.
align_seq
(prj, ang, fdir='.', iters=10, pad=(0, 0), blur=True, center=None, algorithm='sirt', upsample_factor=10, rin=0.5, rout=0.8, save=False, debug=True)[source]¶ Aligns the projection image stack using the sequential re-projection algorithm [C8].
Parameters: prj (ndarray) – 3D stack of projection images. The first dimension is projection axis, second and third dimensions are the x- and y-axes of the projection image, respectively.
ang (ndarray) – Projection angles in radians as an array.
iters (scalar, optional) – Number of iterations of the algorithm.
pad (list-like, optional) – Padding for projection images in x and y-axes.
blur (bool, optional) – Blurs the edge of the image before registration.
center (array, optional) – Location of rotation axis.
algorithm ({str, function}) – One of the following string values.
upsample_factor (integer, optional) – The upsampling factor. Registration accuracy is inversely propotional to upsample_factor.
rin (scalar, optional) – The inner radius of blur function. Pixels inside rin is set to one.
rout (scalar, optional) – The outer radius of blur function. Pixels outside rout is set to zero.
save (bool, optional) – Saves projections and corresponding reconstruction for each algorithm iteration.
debug (book, optional) – Provides debugging info such as iterations and error.
Returns: - ndarray – 3D stack of projection images with jitter.
- ndarray – Error array for each iteration.
-
tomopy.prep.alignment.
align_joint
(prj, ang, fdir='.', iters=10, pad=(0, 0), blur=True, center=None, algorithm='sirt', upsample_factor=10, rin=0.5, rout=0.8, save=False, debug=True)[source]¶ Aligns the projection image stack using the joint re-projection algorithm [C8].
Parameters: prj (ndarray) – 3D stack of projection images. The first dimension is projection axis, second and third dimensions are the x- and y-axes of the projection image, respectively.
ang (ndarray) – Projection angles in radians as an array.
iters (scalar, optional) – Number of iterations of the algorithm.
pad (list-like, optional) – Padding for projection images in x and y-axes.
blur (bool, optional) – Blurs the edge of the image before registration.
center (array, optional) – Location of rotation axis.
algorithm ({str, function}) – One of the following string values.
upsample_factor (integer, optional) – The upsampling factor. Registration accuracy is inversely propotional to upsample_factor.
rin (scalar, optional) – The inner radius of blur function. Pixels inside rin is set to one.
rout (scalar, optional) – The outer radius of blur function. Pixels outside rout is set to zero.
save (bool, optional) – Saves projections and corresponding reconstruction for each algorithm iteration.
debug (book, optional) – Provides debugging info such as iterations and error.
Returns: - ndarray – 3D stack of projection images with jitter.
- ndarray – Error array for each iteration.
-
tomopy.prep.alignment.
scale
(prj)[source]¶ Linearly scales the projection images in the range between -1 and 1.
Parameters: prj (ndarray) – 3D stack of projection images. The first dimension is projection axis, second and third dimensions are the x- and y-axes of the projection image, respectively. Returns: ndarray – Scaled 3D stack of projection images.
-
tomopy.prep.alignment.
tilt
(obj, rad=0, phi=0)[source]¶ Tilt object at a given angle from the rotation axis.
Warning
Not implemented yet.
Parameters: - obj (ndarray) – 3D discrete object.
- rad (scalar, optional) – Radius in polar cordinates to define tilt angle. The value is between 0 and 1, where 0 means no tilt and 1 means a tilt of 90 degrees. The tilt angle can be obtained by arcsin(rad).
- phi (scalar, optional) – Angle in degrees to define tilt direction from the rotation axis. 0 degree means rotation in sagittal plane and 90 degree means rotation in coronal plane.
Returns: ndarray – Tilted 3D object.
-
tomopy.prep.alignment.
add_jitter
(prj, low=0, high=1)[source]¶ Simulates jitter in projection images. The jitter is simulated by drawing random samples from a uniform distribution over the half-open interval [low, high).
Parameters: - prj (ndarray) – 3D stack of projection images. The first dimension is projection axis, second and third dimensions are the x- and y-axes of the projection image, respectively.
- low (float, optional) – Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0.
- high (float) – Upper boundary of the output interval. All values generated will be less than high. The default value is 1.0.
Returns: ndarray – 3D stack of projection images with jitter.
-
tomopy.prep.alignment.
add_noise
(prj, ratio=0.05)[source]¶ Adds Gaussian noise with zero mean and a given standard deviation as a ratio of the maximum value in data.
Parameters: - prj (ndarray) – 3D stack of projection images. The first dimension is projection axis, second and third dimensions are the x- and y-axes of the projection image, respectively.
- ratio (float, optional) – Ratio of the standard deviation of the Gaussian noise distribution to the maximum value in data.
Returns: ndarray – 3D stack of projection images with added Gaussian noise.
-
tomopy.prep.alignment.
blur_edges
(prj, low=0, high=0.8)[source]¶ Blurs the edge of the projection images.
Parameters: - prj (ndarray) – 3D stack of projection images. The first dimension is projection axis, second and third dimensions are the x- and y-axes of the projection image, respectively.
- low (scalar, optional) – Min ratio of the blurring frame to the image size.
- high (scalar, optional) – Max ratio of the blurring frame to the image size.
Returns: ndarray – Edge-blurred 3D stack of projection images.