tomopy.prep.normalize

Module for data normalization.

Functions:

minus_log(arr[, ncore, out])

Computation of the minus log of a given array.

normalize(arr, flat, dark[, cutoff, ncore, out])

Normalize raw projection data using the flat and dark field projections.

normalize_bg(tomo[, air, ncore, nchunk])

Normalize 3D tomgraphy data based on background intensity.

normalize_nf(tomo, flats, dark, flat_loc[, ...])

Normalize raw 3D projection data with flats taken more than once during tomography.

normalize_roi(arr[, roi, ncore])

Normalize raw projection data using an average of a selected window on projection images.

tomopy.prep.normalize.minus_log(arr, ncore=None, out=None)[source]

Computation of the minus log of a given array.

Parameters
  • arr (ndarray) – 3D stack of projections.

  • ncore (int, optional) – Number of cores that will be assigned to jobs.

  • out (ndarray, optional) – Output array for result. If same as arr, process will be done in-place.

Returns

ndarray – Minus-log of the input data.

tomopy.prep.normalize.normalize(arr, flat, dark, cutoff=None, ncore=None, out=None)[source]

Normalize raw projection data using the flat and dark field projections.

Parameters
  • arr (ndarray) – 3D stack of projections.

  • flat (ndarray) – 3D flat field data.

  • dark (ndarray) – 3D dark field data.

  • cutoff (float, optional) – Permitted maximum vaue for the normalized data.

  • ncore (int, optional) – Number of cores that will be assigned to jobs.

  • out (ndarray, optional) – Output array for result. If same as arr, process will be done in-place.

Returns

ndarray – Normalized 3D tomographic data.

tomopy.prep.normalize.normalize_bg(tomo, air=1, ncore=None, nchunk=None)[source]

Normalize 3D tomgraphy data based on background intensity.

Weight sinogram such that the left and right image boundaries (i.e., typically the air region around the object) are set to one and all intermediate values are scaled linearly.

Parameters
  • tomo (ndarray) – 3D tomographic data.

  • air (int, optional) – Number of pixels at each boundary to calculate the scaling factor.

  • ncore (int, optional) – Number of cores that will be assigned to jobs.

  • nchunk (int, optional) – Chunk size for each core.

Returns

ndarray – Corrected 3D tomographic data.

tomopy.prep.normalize.normalize_nf(tomo, flats, dark, flat_loc, cutoff=None, ncore=None, out=None)[source]

Normalize raw 3D projection data with flats taken more than once during tomography. Normalization for each projection is done with the mean of the nearest set of flat fields (nearest flat fields).

Parameters
  • tomo (ndarray) – 3D tomographic data.

  • flats (ndarray) – 3D flat field data.

  • dark (ndarray) – 3D dark field data.

  • flat_loc (list of int) – Indices of flat field data within tomography

  • ncore (int, optional) – Number of cores that will be assigned to jobs.

  • out (ndarray, optional) – Output array for result. If same as arr, process will be done in-place.

Returns

ndarray – Normalized 3D tomographic data.

tomopy.prep.normalize.normalize_roi(arr, roi=[0, 0, 10, 10], ncore=None)[source]

Normalize raw projection data using an average of a selected window on projection images.

Parameters
  • arr (ndarray) – 3D tomographic data.

  • roi (list of int, optional) – [top-left, top-right, bottom-left, bottom-right] pixel coordinates.

  • ncore (int, optional) – Number of cores that will be assigned to jobs.

Returns

ndarray – Normalized 3D tomographic data.