corrct.alignment.cone_beam

Calibrate cone-beam reconstruction geometry.

@author: Nicola VIGANÒ, ESRF - The European Synchrotron, Grenoble, France, and CEA-IRIG, Grenoble, France

Module Contents

Classes

ConeBeamGeometry

Store the acquisition geometry parameters, used for creating reconstruction geometries.

FitConeBeamGeometry

Cone-beam geometry calibration object.

Functions

_class_to_json

_get_rot_axis_angle_deg

tune_acquisition_geometry

Tune the acquisition geometry, based on calibration data self-consistency.

API

corrct.alignment.cone_beam._class_to_json(obj: object) str[source]
corrct.alignment.cone_beam._get_rot_axis_angle_deg(center_1_vu: collections.abc.Sequence[float] | numpy.typing.NDArray, center_2_vu: collections.abc.Sequence[float] | numpy.typing.NDArray, decimals: int | None = 4, dtype: numpy.typing.DTypeLike = np.float32) float[source]
class corrct.alignment.cone_beam.ConeBeamGeometry[source]

Store the acquisition geometry parameters, used for creating reconstruction geometries.

A description of the geometry / meaning of the fields can be found here:

  • Noo, F., Clackdoyle, R., Mennessier, C., White, T. A. & Roney, T. J. (2000). Phys. Med. Biol. 45, 3489–3508. doi: 10.1088/0031-9155/45/11/327

theta_deg: float

0.0

phi_deg: float

0.0

eta_deg: float

0.0

D_pix: float

0.0

R_pix: float

0.0

v0_pix: float

0.0

u0_pix: float

0.0

det_size_v_pix: int

0

det_size_u_pix: int

0

pix_size_um: float

0.0

__str__() str[source]

Return a human readable representation of the object.

Returns

str The human readable representation of the object.

get_prj_geom(translate_z_to_center: bool = True) corrct.models.ProjectionGeometry[source]

Create the geometry for reconstruction.

Returns

Dict The geometry to be used for reconstruction.

get_vol_geom(up_sampling: int = 1) corrct.models.VolumeGeometry[source]

Generate volume geometry.

Returns

VolumeGeometry The volume geometry.

update(field: str, val: float, is_relative: bool = True, decimals: int | None = 3) corrct.alignment.cone_beam.ConeBeamGeometry[source]

Return a copy of the original data, with a replaced field.

Parameters

field : str The field to replace. val : float The new value of the field. is_relative : bool, optional Whether the value is relative to the previous. The default is True. decimals : int | None, optional The number of decimals (precision) to use for the updated values, by default 3 decimals.

Returns

AcquisitionGeometry The updated geometry.

get_tuning_params(field: str, val_range: collections.abc.Sequence[float] | numpy.typing.NDArray, is_relative: bool = True) collections.abc.Sequence[corrct.alignment.cone_beam.ConeBeamGeometry][source]

Generate sequences of acquisition geometries, with a slight variation over a field’s value.

Parameters

field : str The field to tune. val_range : Sequence[float] | NDArray The value range. is_relative : bool, optional Whether the values are relative. The default is True.

Returns

Sequence[AcquisitionGeometry] The list of new acquisition geometries.

to_json() str[source]

Save instance to JSON.

Returns

str The JSON representation.

from_json(data_json: str) None[source]

Load instance from JSON.

Parameters

data : str The JSON data to load.

Raises

ValueError In case we were to load more than one instance, or different classes.

class corrct.alignment.cone_beam.FitConeBeamGeometry(prj_size_vu: collections.abc.Sequence[int] | numpy.typing.NDArray, points_ell1: collections.abc.Sequence[collections.abc.Sequence[float]] | numpy.typing.NDArray, points_ell2: collections.abc.Sequence[collections.abc.Sequence[float]] | numpy.typing.NDArray, points_axis: collections.abc.Sequence[collections.abc.Sequence[float]] | numpy.typing.NDArray | None = None, pix_size_um: float | None = None, use_l1_norm: bool = False, verbose: bool = True, plot_result: bool = False)[source]

Cone-beam geometry calibration object.

This method is based on the following article:

  • Noo, F., Clackdoyle, R., Mennessier, C., White, T. A. & Roney, T. J. (2000). Phys. Med. Biol. 45, 3489–3508. doi: 10.1088/0031-9155/45/11/327

Initialization

Initialize a cone-beam geometry calibration object.

Parameters

prj_size_vu : Sequence[int] | NDArray Size of the projections. points_ell1 : Sequence[Sequence[float]] | NDArray Points of first ellipse. points_ell2 : Sequence[Sequence[float]] | NDArray Points of second ellipse. points_axis : Sequence[Sequence[float]] | NDArray | None, optional Points of the rotation axis, by default None pix_size_um : float | None, optional The size of the pixel edge in micrometers. Default is None. use_l1_norm : bool, optional Whether to use the l1-norm or the least-squares (l2-norm) fit for optimization. Default is False. verbose : bool, optional Whether to produce verbose output, by default True plot_result : bool, optional Whether to plot the results of the geometry, by default False It requires verbose to be True.

acq_geom: corrct.alignment.cone_beam.ConeBeamGeometry

None

_initialize(use_l1_norm: bool) None[source]
fit(r: float, e: float = 1, meas_D_pix: float | None = None) corrct.alignment.cone_beam.ConeBeamGeometry[source]

Fit the cone-beam geometry parameters, that will be used for producing the projection geometry.

Parameters

r : float The radius of the circle performed by the spheres in pixels. e : float, optional Either 1 or -1, indicating whether the source is between the circles or not. The default is 1. meas_D_pix : float, optional The measured source-detector distance in pixels. This parameter is only necessary when the computed source-detector distance is invalid or zero.

Raises

ValueError In case of flipped ellipses or invalid computed source-detector distance.

static _fit_distance_det2src(ellipse_1: corrct.alignment.fitting.Ellipse, ellipse_2: corrct.alignment.fitting.Ellipse, e: float = 1) float[source]
corrct.alignment.cone_beam.tune_acquisition_geometry(acq_geom_init: corrct.alignment.cone_beam.ConeBeamGeometry, data: numpy.typing.NDArray, angles_rot_rad: collections.abc.Sequence[float] | numpy.typing.NDArray, params: dict[str, collections.abc.Sequence[float] | numpy.typing.NDArray], data_mask: numpy.typing.NDArray | None = None, verbose: bool = True) corrct.alignment.cone_beam.ConeBeamGeometry[source]

Tune the acquisition geometry, based on calibration data self-consistency.

Parameters

acq_geom : ConeBeamGeometry The cone-beam geometry to refine. data : NDArray The calibration projection data. angles : Sequence[float] | NDArray Angles of the projections. params : dict[str, Sequence[float] | NDArray] Parameters to tune as a dictionary. The acquisition parameters to tune are the keys, and their test values are the dictionary values. data_mask : NDArray | None, optional Pixel mask of the data, to mask out dead or hot pixels. The default is None. verbose : bool, optional Whether to output verbose information or not, by default False.