tomosipo.astra module

ASTRA conversion and projection code

There are two geometry conversion methods:

  • from_astra

  • to_astra

An important method is create_astra_projector, which creates an ASTRA projector from a pair of geometries.

Moreover, there is projection code that is centered around the following ASTRA APIs:

  1. astra.experimental.direct_FPBP3D (modern)

  2. astra.experimental.do_composite (legacy)

The first is used in modern tomosipo code: it takes an existing ASTRA projector and a link to a numpy or gpu array.

The second is a legacy approach that is kept for debugging and testing purposes. It takes multiple Data objects describing volumes (both data and geometry) and projection geometries (both data and geometry). On this basis, it creates a projector and passes it to ASTRA, which performs an all-to-all (back)projection.

tomosipo.astra.backward(*data, voxel_supersampling=1, detector_supersampling=1, additive=False, projector=None)[source]

Backproject

Backprojects all projection datasets on all volumes.

Parameters:
  • *dataData objects Data to use for forward and back projection. At least one data object relating to a VolumeGeometry and at least one data object relating to a projection geometry is required.

  • detector_supersamplingint For the forward projection, DetectorSuperSampling^2 rays will be used. This should only be used if your detector pixels are larger than the voxels in the reconstruction volume. (default: 1)

  • voxel_supersamplingint For the backward projection, VoxelSuperSampling^3 rays will be used. This should only be used if your voxels in the reconstruction volume are larger than the detector pixels. (default: 1)

  • projector

    ?? It is possible to provide a pre-generated ASTRA projector. Use ts.Operator.astra_projector to generate an astra projector.

Returns:

Return type:

tomosipo.astra.create_astra_projector(volume_geometry, projection_geometry, *, voxel_supersampling=1, detector_supersampling=1)[source]
tomosipo.astra.direct_bp(projector, vol_data, proj_data, additive=False)[source]

Project forward or backward

Forward/back projects a volume onto a projection dataset.

Parameters:
  • projector

    ?? It is possible to provide a pre-generated ASTRA projector. Use ts.Operator.astra_projector to generate an astra projector.

  • vol_data – TODO

  • proj_data – TODO

  • additive – bool If True, add projection data to existing data. Otherwise overwrite data.

Returns:

Return type:

tomosipo.astra.direct_fp(projector, vol_data, proj_data, additive=False)[source]

Project forward or backward

Forward/back projects a volume onto a projection dataset.

Parameters:
  • projector

    ?? It is possible to provide a pre-generated ASTRA projector. Use ts.Operator.astra_projector to generate an astra projector.

  • vol_data – TODO

  • proj_data – TODO

  • additive – bool If True, add projection data to existing data. Otherwise overwrite data.

Returns:

Return type:

tomosipo.astra.direct_project(projector, vol_link, proj_link, forward=None, additive=False)[source]

Project forward or backward

Forward/back projects a volume onto a projection dataset.

Parameters:
  • projector

    ?? It is possible to provide a pre-generated ASTRA projector. Use ts.Operator.astra_projector to generate an astra projector.

  • vol_link – TODO

  • proj_link – TODO

  • forward – bool True for forward project, False for backproject.

  • additive – bool If True, add projection data to existing data. Otherwise overwrite data.

Returns:

Return type:

tomosipo.astra.fdk(vol_data, proj_data, *, voxel_supersampling=1, detector_supersampling=1)[source]

Do an FDK reconstruction of the given geometry.

Expects a single volume dataset and a single projection dataset to be associated with the geometry.

Parameters:
  • vol_data – Volume dataset to use.

  • proj_data – Projection dataset to use.

  • detector_supersamplingint For the forward projection, DetectorSuperSampling^2 rays will be used. This should only be used if your detector pixels are larger than the voxels in the reconstruction volume. (default: 1)

  • voxel_supersamplingint For the backward projection, VoxelSuperSampling^3 rays will be used. This should only be used if your voxels in the reconstruction volume are larger than the detector pixels. (default: 1)

Returns:

Return type:

tomosipo.astra.forward(*data, voxel_supersampling=1, detector_supersampling=1, additive=False, projector=None)[source]

Forward project

Projects all volumes on all projection datasets.

Parameters:
  • *dataData objects Data to use for forward and back projection. At least one data object relating to a VolumeGeometry and at least one data object relating to a projection geometry is required.

  • detector_supersamplingint For the forward projection, DetectorSuperSampling^2 rays will be used. This should only be used if your detector pixels are larger than the voxels in the reconstruction volume. (default: 1)

  • voxel_supersamplingint For the backward projection, VoxelSuperSampling^3 rays will be used. This should only be used if your voxels in the reconstruction volume are larger than the detector pixels. (default: 1)

  • projector

    ?? It is possible to provide a pre-generated ASTRA projector. Use ts.Operator.astra_projector to generate an astra projector.

Returns:

Return type:

tomosipo.astra.from_astra(astra_geom)[source]

Import ASTRA geometry to tomosipo

Parameters:

astra_geom – A 3D ASTRA volume or projection geometry.

Returns:

A tomosipo 3D volume or projection geometry.

tomosipo.astra.project(*data, voxel_supersampling=1, detector_supersampling=1, forward=None, additive=False, projector=None)[source]

Project forward or backward

Projects all volumes on all projection datasets.

Parameters:
  • *dataData objects Data to use for forward and back projection. At least one data object relating to a VolumeGeometry and at least one data object relating to a projection geometry is required.

  • detector_supersamplingint For the forward projection, DetectorSuperSampling^2 rays will be used. This should only be used if your detector pixels are larger than the voxels in the reconstruction volume. (default: 1)

  • voxel_supersamplingint For the backward projection, VoxelSuperSampling^3 rays will be used. This should only be used if your voxels in the reconstruction volume are larger than the detector pixels. (default: 1)

  • forward – bool True for forward project, False for backproject.

  • additive – bool If True, add projection data to existing data. Otherwise overwrite data.

  • projector

    ?? It is possible to provide a pre-generated ASTRA projector. Use ts.Operator.astra_projector to generate an astra projector.

Returns:

Return type:

tomosipo.astra.to_astra(x)[source]

Convert tomosipo geometry to ASTRA

Parameters:

x – A 3D tomosipo volume or projection geometry.

Returns:

A 3D ASTRA volume or projection geometry.