7.2.2. algotom.prep.conversion
¶
Module of conversion methods in the preprocessing stage:
Stitching images.
Joining images if there is no overlapping.
Converting a 360-degree sinogram with offset center-of-rotation (COR) to a 180-degree sinogram.
Extending a 360-degree sinogram with offset COR for direct reconstruction instead of converting it to a 180-degree sinogram.
Converting a 180-degree sinogram to a 360-sinogram.
Generating a sinogram from a helical data.
Functions:
|
Generate a linear-ramp weighting matrix for image stitching. |
|
Stitch projection images or sinogram images using a linear ramp. |
|
Join projection images or sinogram images. |
|
Stitch list of projection images or sinogram images using a linear ramp. |
|
Join list of projection images or sinogram images. |
|
Convert a 360-degree sinogram to a 180-degree sinogram. |
|
Convert a 180-degree sinogram to a 360-degree sinogram (Ref. |
|
Extend a 360-degree sinogram (with offset center-of-rotation) for later reconstruction (Ref. |
|
Generate a 180-degree/360-degree sinogram from a helical-scan dataset which is a hdf/nxs object (Ref. |
|
Generate a full sinogram from a helical-scan dataset which is a hdf/nxs object (Ref. |
- algotom.prep.conversion.make_weight_matrix(mat1, mat2, overlap, side)[source]¶
Generate a linear-ramp weighting matrix for image stitching.
- Parameters
mat1 (array_like) – 2D array. Projection image or sinogram image.
mat2 (array_like) – 2D array. Projection image or sinogram image.
overlap (int) – Width of the overlap area between two images.
side ({0, 1}) – Only two options: 0 or 1. It is used to indicate the overlap side respects to image 1. “0” corresponds to the left side. “1” corresponds to the right side.
- algotom.prep.conversion.stitch_image(mat1, mat2, overlap, side, wei_mat1=None, wei_mat2=None, norm=True, total_width=None)[source]¶
Stitch projection images or sinogram images using a linear ramp.
- Parameters
mat1 (array_like) – 2D array. Projection image or sinogram image.
mat2 (array_like) – 2D array. Projection image or sinogram image.
overlap (float) – Width of the overlap area between two images.
side ({0, 1}) – Only two options: 0 or 1. It is used to indicate the overlap side respects to image 1. “0” corresponds to the left side. “1” corresponds to the right side.
wei_mat1 (array_like, optional) – Weighting matrix used for image 1.
wei_mat2 (array_like, optional) – Weighting matrix used for image 2.
norm (bool, optional) – Enable/disable normalization before stitching.
total_width (int, optional) – Final width of the stitched image.
- Returns
array_like – Stitched image.
- algotom.prep.conversion.join_image(mat1, mat2, joint_width, side, norm=True, total_width=None)[source]¶
Join projection images or sinogram images. This is useful for fixing the problem of non-overlap between images.
- Parameters
mat1 (array_like) – 2D array. Projection image or sinogram image.
mat2 (array_like) – 2D array. Projection image or sinogram image.
joint_width (float) – Width of the joint area between two images.
side ({0, 1}) – Only two options: 0 or 1. It is used to indicate the overlap side respects to image 1. “0” corresponds to the left side. “1” corresponds to the right side.
norm (bool) – Enable/disable normalization before joining.
total_width (int, optional) – Final width of the joined image.
- Returns
array_like – Stitched image.
- algotom.prep.conversion.stitch_image_multiple(list_mat, list_overlap, norm=True, total_width=None)[source]¶
Stitch list of projection images or sinogram images using a linear ramp.
- Parameters
list_mat (list of array_like) – List of 2D array. Projection image or sinogram image.
list_overlap (list of tuple of floats) – List of [overlap, side]. overlap : Width of the overlap area between two images. side : Overlap side between two images.
norm (bool, optional) – Enable/disable normalization before stitching.
total_width (int, optional) – Final width of the stitched image.
- Returns
array_like – Stitched image.
- algotom.prep.conversion.join_image_multiple(list_mat, list_joint, norm=True, total_width=None)[source]¶
Join list of projection images or sinogram images. This is useful for fixing the problem of non-overlap between images.
- Parameters
list_mat (list of array_like) – List of 2D array. Projection image or sinogram image.
list_joint (list of tuple of floats) – List of [joint_width, side]. joint_width : Width of the joint area between two images. side : Overlap side between two images.
norm (bool, optional) – Enable/disable normalization before stitching.
total_width (int, optional) – Final width of the stitched image.
- Returns
array_like – Stitched image.
- algotom.prep.conversion.convert_sinogram_360_to_180(sino_360, cor, wei_mat1=None, wei_mat2=None, norm=True, total_width=None)[source]¶
Convert a 360-degree sinogram to a 180-degree sinogram.
- Parameters
sino_360 (array_like) – 2D array. 360-degree sinogram.
cor (float or tuple of float) – Center-of-rotation or (Overlap_area, overlap_side).
wei_mat1 (array_like, optional) – Weighting matrix used for the 1st haft of the sinogram.
wei_mat2 (array_like, optional) – Weighting matrix used for the 2nd haft of the sinogram.
norm (bool, optional) – Enable/disable normalization before stitching.
total_width (int, optional) – Final width of the stitched image.
- Returns
sino_stitch (array_like) – Converted sinogram.
cor (float) – Updated center-of-rotation referred to the converted sinogram.
- algotom.prep.conversion.convert_sinogram_180_to_360(sino_180, center)[source]¶
Convert a 180-degree sinogram to a 360-degree sinogram (Ref. [1]).
- Parameters
sino_180 (array_like) – 2D array. 180-degree sinogram.
center (float) – Center-of-rotation.
- Returns
array_like – 360-degree sinogram.
References
- algotom.prep.conversion.extend_sinogram(sino_360, cor, apply_log=True)[source]¶
Extend a 360-degree sinogram (with offset center-of-rotation) for later reconstruction (Ref. [1]).
- Parameters
sino_360 (array_like) – 2D array. 360-degree sinogram.
cor (float or tuple of float) – Center-of-rotation or (Overlap_area, overlap_side).
apply_log (bool, optional) – Apply the logarithm function if True.
- Returns
sino_pad (array_like) – Extended sinogram.
cor (float) – Updated center-of-rotation referred to the converted sinogram.
References
- algotom.prep.conversion.generate_sinogram_helical_scan(index, tomo_data, num_proj, pixel_size, y_start, y_stop, pitch, scan_type='180', angles=None, flat=None, dark=None, mask=None, crop=(0, 0, 0, 0))[source]¶
Generate a 180-degree/360-degree sinogram from a helical-scan dataset which is a hdf/nxs object (Ref. [1]).
- Parameters
index (int) – Index of the sinogram.
tomo_data (hdf object.) – 3D array.
num_proj (int) – Number of projections per 180-degree.
pixel_size (float) – Pixel size. The unit must be the same as y-position.
y_start (float) – Y-position of the stage at the beginning of the scan.
y_stop (float) – Y-position of the stage at the end of the scan.
pitch (float) – The distance which the y-stage is translated in one full rotation.
scan_type ({“180”, “360”}) – One of two options: “180” for generating a 180-degree sinogram or “360” for generating a 360-degree sinogram.
angles (array_like, optional) – 1D array. Angles (degree) corresponding to acquired projections.
flat (array_like, optional) – Flat-field image used for flat-field correction.
dark (array_like, optional) – Dark-field image used for flat-field correction.
mask (array_like, optional) – Used for removing streak artifacts caused by blobs in the flat-field image.
crop (tuple of int, optional) – Used for cropping images.
- Returns
sinogram (array_like) – 2D array. 180-degree sinogram or 360-degree sinogram.
list_angle (array_like) – 1D array. List of angles corresponding to the generated sinogram.
References
- algotom.prep.conversion.generate_full_sinogram_helical_scan(index, tomo_data, num_proj, pixel_size, y_start, y_stop, pitch, scan_type='180', angles=None, flat=None, dark=None, mask=None, crop=(0, 0, 0, 0))[source]¶
Generate a full sinogram from a helical-scan dataset which is a hdf/nxs object (Ref. [1]). Full sinogram is all 1D projections of the same slice of a sample staying inside the field of view.
- Parameters
index (int) – Index of the sinogram.
tomo_data (hdf object.) – 3D array.
num_proj (int) – Number of projections per 180-degree.
pixel_size (float) – Pixel size. The unit must be the same as y-position.
y_start (float) – Y-position of the stage at the beginning of the scan.
y_stop (float) – Y-position of the stage at the end of the scan.
pitch (float) – The distance which the y-stage is translated in one full rotation.
scan_type ({“180”, “360”}) – Data acquired is the 180-degree type or 360-degree type [1].
angles (array_like, optional) – 1D array. Angles (degree) corresponding to acquired projections.
flat (array_like, optional) – Flat-field image used for flat-field correction.
dark (array_like, optional) – Dark-field image used for flat-field correction.
mask (array_like, optional) – Used for removing streak artifacts caused by blobs in the flat-field image.
crop (tuple of int, optional) – Used for cropping images.
- Returns
sinogram (array_like) – 2D array. Full sinogram.
list_angle (array_like) – 1D array. List of angles corresponding to the generated sinogram.
References