ct_utils.py¶

Source: LION/CTtools/ct_utils.py

LION.CTtools.ct_utils.from_HU_to_normal(img)[source]¶

Converts image in Hounsfield Units (air-> -1000, bone->500) into a [0-1] image. Comercial scanners use a piecewise linear function. Check STIR for real values. (https://raw.githubusercontent.com/UCL/STIR/85cc1940c297b1749cf44a9fba937d7cefdccd47/src/utilities/share/ct_slopes.json)

LION.CTtools.ct_utils.from_normal_to_HU(img)[source]¶

Convert a LION-normalised CT image in [0, 1] to HU.

This is the inverse of from_HU_to_normal() on its represented Hounsfield-unit interval, mapping 0 to -1000 HU and 1 to 2000 HU. Values are not clipped so reconstruction overshoots remain visible.

LION.CTtools.ct_utils.from_HU_to_mu(img)[source]¶

Converts image in Hounsfield Units (air-> -1000, bone->500) into linear attenuation coefficient (air-> 0.0012, bone->1.52 g/cm^3). Approximate. Comercial scanners use a piecewise linear function. Check STIR for real values. (https://raw.githubusercontent.com/UCL/STIR/85cc1940c297b1749cf44a9fba937d7cefdccd47/src/utilities/share/ct_slopes.json)

LION.CTtools.ct_utils.sinogram_add_noise(proj, I0=1000, sigma=5, sigma_blur=0.3015, ks_value=3, flat_field=None, dark_field=None, enable_gradients=False)[source]¶

Wraper for _sinogram_add_noise to support gradients

LION.CTtools.ct_utils.from_HU_to_material_id(img)[source]¶

Converts an image in Hounsfield units into a material index May require some image filtering preprocessing

LION.CTtools.ct_utils.make_operator(geometry)[source]¶

Construct a differentiable LION CT projection operator.

Parameters:

geometry (Geometry) – Fan- or parallel-beam acquisition geometry.

Returns:

LION wrapper around the matching tomosipo operator.

Return type:

CTProjectionOp

LION.CTtools.ct_utils.forward_projection(image, geometry, backend='tomosipo')[source]¶

Produces a noise free forward projection, given np.array image, a size (in real world units), a sinogram shape and size, distances from source to detector DSD and distance from source to object DSO. May support other backends than tomosipo

Parameters:
  • image (ndarray | Tensor)

  • geometry (Geometry)

  • backend (str)

Return type:

Tensor