A projector using the ASTRA toolbox: the ASTRAProjector module

class nnfbp.ASTRAProjector.ASTRAProjector2D(proj_geom, vol_geom, offsets=None)[source]

Bases: object

Implementation of the projector interface using the ASTRA toolbox with CUDA.

A projector needs to implement:

  • Forward projecting
  • Back projecting
  • Creating a FBP reconstruction with a custom filter

You can use this class as an abstracted weight matrix \(W\): multiplying an instance proj of this class by an image results in a forward projection of the image, and multiplying proj.T by a sinogram results in a backprojection of the sinogram:

proj = ASTRAProjector2D(...)
fp = proj*image
bp = proj.T*sinogram
Parameters:
  • proj_geom (dict) – The projection geometry.
  • vol_geom (dict) – The volume geometry.
  • offsets (numpy.ndarray) – Optional offsets for the detectors
backProject(sinogram)[source]

Backproject a sinogram.

Parameters:sinogram (numpy.ndarray) – The sinogram data
Returns:numpy.ndarray – The backprojection.
forwProject(image)[source]

Forward project an image.

Parameters:image (numpy.ndarray) – The image data.
Returns:numpy.ndarray – The forward projection.
reconstruct(method, sinogram, nIters=1, fbpfilter=None)[source]

Helper function to reconstruct a sinogram using the ASTRA toolbox.

This function does not have to be implemented by other projectors, as it is not used by PyNN-FBP.

Parameters:
  • method (string) – Name of the reconstruction algorithm.
  • sinogram (numpy.ndarray) – The sinogram data
  • nIters (int) – Number of iterations to run.
  • fbpfilter (string) – Optional string to specify FBP filter (hamming, hann, etc)
Returns:

numpy.ndarray – The reconstruction.

reconstructWithFilter(sinogram, filt)[source]

Create a FBP reconstruction of the sinogram with a custom filter

Parameters:
  • sinogram (numpy.ndarray) – The sinogram data
  • filt (numpy.ndarray) – 1D custom filter
Returns:

numpy.ndarray – The reconstruction.

class nnfbp.ASTRAProjector.ASTRAProjector2DTranspose(parentProj)[source]

Implements the proj.T functionality.

Do not use directly, since it can be accessed as member .T of an ASTRAProjector2D object.

Previous topic

Training data used during network training: the TrainingData module

Next topic

A simple projector using the CPU: the SimpleCPUProjector module

This Page