FP

This is a CPU implementation of a simple forward projection algorithm for 2D data sets. It takes a projector and a volume as input, and returns the projection data.

Supported geometries: parallel, parallel_vec, fanflat, fanflat_vec, matrix.

Configuration options

Name

Description

ProjectorId

Projector object ID.

ProjectionDataId

Data object ID to store the result. The computed forward projection is added to this data.

VolumeDataId

Volume data object ID.

option.SinogramMaskId

If specified, data object ID of a projection-data-sized volume to be used as a mask.

option.VolumeMaskId

If specified, the data object ID of a volume-data-sized volume to be used as a mask.

Example

import astra
import matplotlib.pyplot as plt
import numpy as np

# Create geometries and projector
N = 256
N_ANGLES = 180
det_spacing = 1.0
angles = np.linspace(0, np.pi, N_ANGLES)
proj_geom = astra.create_proj_geom('parallel', det_spacing, N, angles)
vol_geom = astra.create_vol_geom(N, N)
projector_id = astra.create_projector('linear', proj_geom, vol_geom)

# Generate phantom image
phantom_id, phantom = astra.data2d.shepp_logan(vol_geom)

# Calculate forward projection
projection_id = astra.data2d.create('-sino', proj_geom)
cfg = astra.astra_dict('FP')
cfg['ProjectorId'] = projector_id
cfg['ProjectionDataId'] = projection_id
cfg['VolumeDataId'] = phantom_id
algorithm_id = astra.algorithm.create(cfg)

astra.algorithm.run(algorithm_id)

projection = astra.data2d.get(projection_id)
plt.imshow(projection, cmap='gray')

# Clean up
astra.data2d.delete([projection_id, phantom_id])
astra.projector.delete(projector_id)
astra.algorithm.delete(algorithm_id)