httomolibgpu.recon.rotation#
Modules for finding the axis of rotation for 180 or 360 degrees scans.
- httomolibgpu.recon.rotation.find_center_360(data: <cp.ndarray>, ind: int | None = None, win_width: int = 10, side: Literal['left', 'right'] | None=None, denoise: bool = True, norm: bool = False, use_overlap: bool = False) ndarray>][source]#
Find the center-of-rotation (COR) in a 360-degree scan and also an offset to perform data transformation from 360 to 180 degrees scan. See [17].
- Parameters:
data (cp.ndarray) – 3D tomographic data as a Cupy array.
ind (int, optional) – Index of the slice to be used for estimate the CoR and the overlap. If ‘None’ is given, the zero slice will be used.
win_width (int, optional) – Window width used for finding the overlap area.
side ({None, left, right}, optional) – Chose between “left”, “right” and “None” corresponds to fully automated determination of the side.
denoise (bool, optional) – Apply the Gaussian filter if True.
norm (bool, optional) – Apply the normalisation if True.
use_overlap (bool, optional) – Use the combination of images in the overlap area for calculating correlation coefficients if True.
- Returns:
cor (float) – Center-of-rotation.
overlap (float) – Width of the overlap area between two halves of the sinogram.
side (str) – Overlap side (left or right) between two halves of the sinogram.
overlap_position (float) – Position of the window in the first image giving the best correlation metric.
- httomolibgpu.recon.rotation.find_center_metric_recon(data: <cp.ndarray>, angles: <cp.ndarray>, metric_type: Literal['entropy', 'tv', 'sharpness']='tv', range: int = 10, step: float | int = 0.5, reconstruction_method: Literal['LPRec3d_tomobar', 'FBP3d_tomobar', 'SIRT3d_tomobar', 'CGLS3d_tomobar']='LPRec3d_tomobar', ind: int | None = None, recon_iterations: int | None = None, cor_initialisation_value: float | None = None, squared_mask_x_y_size: list | None = None, gaussian_filter_sigma: float | None = None, save_recon_tiff: PathLike | None = None) <cp.ndarray>[source]#
Find the rotation axis location using different metrics that are applied to the result of the reconstruction. This method iteratively assesses the quality of the reconstruction while changing the CoR value within the provided range. This approach for the CoR finding is suitable for limited angle (missing wedge) data, when the symmetry and consistency of the sinogram is lost. See more about the method and its parameters in Find center by metric.
- Parameters:
data (cp.ndarray) – 3D [angles, 1, detX] tomographic data as a CuPy array.
angles (np.ndarray) – An array of angles given in radians.
metric_type (str,) – Type of image quality metric to use on the reconstructed image. Available metrics are
'entropy','tv','sharpness'.range (int) – CoR search range/radius. The search will be performed in the range:
[-range:cor_initialisation_value:range].step (float) – Step for CoR value.
reconstruction_method (str,) – Type of the reconstruction method to be used. Choose from:
"LPRec3d_tomobar","FBP3d_tomobar","SIRT3d_tomobar","CGLS3d_tomobar". Default'LPRec3d_tomobar'.ind (int, optional) – Index of the slice to be used for estimate the CoR. If ‘None’ is given, the zero slice will be used.
recon_iterations (int, optional) – Set only for iterative methods:
'SIRT3d_tomobar','CGLS3d_tomobar'.cor_initialisation_value (float, optional) – The initial approximation for the centre of rotation. If the value is None, use the horizontal centre of the projection/sinogram image.
squared_mask_x_y_size (list, optional) – Apply a square mask to the reconstructed image. Selection of the mask is crucial for this algorithm to work successfully. The mask is defined as a
listwith 3 values[X, Y, size]. The positive offsetsX, Yplace the mask with respect to the left top corner of the reconstructed image and the third parameter is the size of the cropped image in percents with respect to the whole reconstructed image. Example:squared_mask_x_y_size = [10, 20, 50]will apply a mask that is 10 pixels away from the left top corner in the horizontal direction and 20 pixels away in the vertical direction, the mask will be 50% in size of the reconstructed image size. The default value whensquared_mask_x_y_size = Noneis the mask in the center of the reconstructed image (not always the best position as many ring artifacts are present) with a size of 50% of the reconstructed image size.gaussian_filter_sigma (float, optional) – Enable gaussian filtering of the reconstructed image, highly recommended for noisy data. Good range of values 1.0-4.0.
save_recon_tiff (path, optional) – Path to output directory for the saved reconstruction image when
CoR = cor_initialisation_valueand also the masked image. Useful for debugging.
- Returns:
Rotation axis location with a subpixel precision.
- Return type:
float32
- httomolibgpu.recon.rotation.find_center_pc(proj1: <cp.ndarray>, proj2: <cp.ndarray>, tol: float = 0.5, rotc_guess: float | str | None = None) <cp.ndarray>[source]#
Find rotation axis location by finding the offset between the first projection and a mirrored projection 180 degrees apart using phase correlation in Fourier space. The phase_cross_correlation function uses cross-correlation in Fourier space, optionally employing an upsampled matrix-multiplication DFT to achieve arbitrary subpixel precision. See [5].
- Parameters:
proj1 (cp.ndarray) – Projection from the 0th degree angle.
proj2 (cp.ndarray) – Projection from the 180th degree angle.
tol (float, optional) – Subpixel accuracy. Defaults to 0.5.
rotc_guess (float, optional) – Initial guess value for the rotation center. Defaults to None.
- Returns:
Rotation axis location.
- Return type:
np.float32
- httomolibgpu.recon.rotation.find_center_vo(data: <cp.ndarray>, ind: int | None = None, average_radius: int = 0, cor_initialisation_value: float | None = None, smin: int = -50, smax: int = 50, srad: float = 6.0, step: float = 0.5, ratio: float = 0.5, drop: int = 20) <cp.ndarray>[source]#
Find the rotation axis location (aka the centre of rotation) using Nghia Vo’s method. See the paper [18].
- Parameters:
data (cp.ndarray) – 3D [angles, detY, detX] tomographic data or a 2D [angles, detX] sinogram as a CuPy array.
ind (int, optional) – Index of the slice to be used to estimate the CoR. If None is given, then the central sinogram will be extracted from the data array with a possible averaging, see .
average_radius (int) – Averaging multiple sinograms around the ind-indexed sinogram to improve the signal-to-noise ratio. It is recommended to keep this parameter smaller than 10.
cor_initialisation_value (float, optional) – The initial approximation for the centre of rotation. If the value is None, use the horizontal centre of the projection/sinogram image.
smin (int) – Coarse search radius. Reference to the horizontal center of the sinogram.
smax (int) – Coarse search radius. Reference to the horizontal center of the sinogram.
srad (float) – Fine search radius.
step (float) – Step of fine searching.
ratio (float) – The ratio between the FOV of the camera and the size of object. It’s used to generate the mask.
drop (int) – Drop lines around vertical center of the mask.
- Returns:
Rotation axis location with a subpixel precision.
- Return type:
float32