LION.operators.ct.ct_geometry

Classes

Geometry(**kwargs)

Class holding a CT geometry.

Functions

check_geometry(geometry)

Check that a CT geometry is complete and consistent, and raise a ValueError listing every problem if not.


class LION.operators.ct.ct_geometry.Geometry(**kwargs)[source]

Bases: OperatorParameters

Class holding a CT geometry.

The image is given by any two of image_shape (pixels), image_size (mm) and voxel_size (mm), the detector by any two of detector_shape, detector_size and pixel_size: size = shape * spacing. The geometry keeps the values that were set, and computes the third one when it is read, so it is never out of date when the others change, e.g. geo = Geometry.default_parameters(); geo.image_shape = ....

check_geometry() checks that a geometry is complete and consistent. It runs when an operator is built from the geometry and when the geometry is saved. __init__ only checks what is given at once (three values of a triple that disagree), because a geometry can be filled in afterwards.

The parameters given as keywords, LIONParameter(n_iters=10). A dict value becomes a LIONParameter, unless it is a spec (a dict with "_target_", see LION.utils.spec), which describes an object and stays a dict.

spec_kwargs()[source]

The values a spec of this geometry holds (LION.utils.spec), after check_geometry(): only the values that were set.

serialize()[source]

The geometry as a dict, after check_geometry(): only the values that were set, not the computed ones.

make_operator()[source]

The CT operator for this geometry (CTProjectionOp).

property split_count

CT splits along the angles: one unit per angle.

split(indices)[source]

A copy of the geometry with only the angles indices.

split_measurements(y, indices)[source]

The projections at the angles indices of the sinogram(s) y (the angles are its second last dimension, batched or not).

load(fname)[source]

Load a geometry saved as JSON (see init_from_parameter).

classmethod init_from_parameter(parameter)[source]

The Geometry of a geometry saved as JSON and loaded as a LIONParameter.

Where a file has all three values of a triple, the spacing is computed again from the size and shape (with a warning if the stored one disagreed).

static default_parameters()[source]

LION’s default CT geometry: fan beam: source to centre 575 mm, source to detector 1050 mm, a 900 x 1 mm detector, 512x512 images of 300 mm, 360 angles over 360 degrees.

static sparse_view_parameters()[source]

The default geometry with 50 angles over 360 degrees (sparse view).

static sparse_angle_parameters()[source]

The default geometry with 60 angles over 60 degrees (limited angle).

static parallel_default_parameters(image_shape=None)[source]

A parallel beam with image_shape (1 x 512 x 512 by default) images of 1 mm pixels and a matching detector, 360 angles over 360 degrees.

static parallel_sparse_view_parameters(image_shape=None)[source]

A parallel beam with image_shape (1 x 512 x 512 by default) images of 1 mm pixels and a matching detector, 50 angles over 360 degrees (sparse view).

static parallel_sparse_angle_parameters(image_shape=None)[source]

A parallel beam with image_shape (1 x 512 x 512 by default) images of 1 mm pixels and a matching detector, 60 angles over 60 degrees (limited angle).

LION.operators.ct.ct_geometry.check_geometry(geometry)[source]

Check that a CT geometry is complete and consistent, and raise a ValueError listing every problem if not.

Run when an operator is built from the geometry (CTProjectionOp) and when the geometry is saved. Checks:

  • mode is “fan” or “parallel”;

  • image and detector: at least two of shape, size and spacing are set, and if all three are, they agree (size = shape * spacing);

  • shapes are positive whole numbers (3 for the image, 2 for the detector), sizes and spacings positive;

  • image_pos is 3 finite numbers;

  • angles is a 1-D array of finite numbers;

  • fan beam: dso and dsd are positive, with dsd >= dso.