tomosipo.Operator module

class tomosipo.Operator.BackprojectionOperator(parent)[source]

Bases: object

Transpose of the Forward operator

The idea of having a dedicated class for the backprojection operator, which just saves a link to the “real” operator has been shamelessly ripped from OpTomo.

We have the following property:

>>> import tomosipo as ts
>>> vg = ts.volume(shape=10)
>>> pg = ts.parallel(angles=10, shape=10)
>>> A = ts.operator(vg, pg)
>>> A.T is A.T.T.T
True

It is nice that we do not allocate a new object every time we use A.T. If we did, users might save the transpose in a separate variable for ‘performance reasons’, writing

>>> A = ts.operator(vg, pg)
>>> A_T = A.T

This is a waste of time.

property T

The transpose of the backprojection operator

This property returns the transpose (forward projection) operator.

property domain

The domain (projection geometry) of the operator

property domain_shape

The expected shape of the input (projection) data

property range

The range (volume geometry) of the operator

property range_shape

The expected shape of the output (volume) data

transpose()[source]

Return forward projection operator

class tomosipo.Operator.Operator(volume_geometry, projection_geometry, voxel_supersampling=1, detector_supersampling=1, additive=False)[source]

Bases: object

A linear tomographic projection operator

An operator describes and computes the projection from a volume onto a projection geometry.

property T

The transpose operator

This property returns the transpose (backprojection) operator.

property domain

The domain (volume geometry) of the operator

property domain_shape

The expected shape of the input (volume) data

property range

The range (projection geometry) of the operator

property range_shape

The expected shape of the output (projection) data

transpose()[source]

Return backprojection operator

tomosipo.Operator.operator(volume_geometry, projection_geometry, voxel_supersampling=1, detector_supersampling=1, additive=False)[source]

Create a new tomographic operator

Parameters:

volume_geometry: VolumeGeometry

The domain of the operator.

projection_geometry: ProjectionGeometry

The range of the operator.

voxel_supersampling: int (optional)

Specifies the amount of voxel supersampling, i.e., how many (one dimension) subvoxels are generated from a single parent voxel. The default is 1.

detector_supersampling: int (optional)

Specifies the amount of detector supersampling, i.e., how many rays are cast per detector. The default is 1.

additive: bool (optional)

Specifies whether the operator should overwrite its range (forward) and domain (transpose). When additive=True, the operator adds instead of overwrites. The default is additive=False.

returns:

A linear tomographic projection operator

rtype:

Operator

tomosipo.Operator.to_astra_compatible_operator_geometry(vg, pg)[source]

Convert volume vector geometry to volume geometry (if necessary)

ASTRA does not support arbitrarily oriented volume geometries. If vg is a VolumeVectorGeometry, we rotate and translate both vg and pg such that vg is axis-aligned, and positioned on the origin, which makes it ASTRA-compatible.

Parameters:
  • vg – volume geometry

  • pg – projection geometry

Returns:

A non-vector volume geometry centered on the origin and its corresponding projection geometry.

Return type:

(VolumeGeometry, ProjectionGeometry)