A simple projector using the CPU: the SimpleCPUProjector module

class nnfbp.SimpleCPUProjector.Projector(recSize, angles)[source]

Bases: object

Implementation of the projector interface using the CPU.

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 = Projector(...)
fp = proj*image
bp = proj.T*sinogram
Parameters:
  • recSize (int) – Width/height of the reconstruction volume. (only 2D squares are supported)
  • angles (numpy.ndarray) – Array with angles in radians.
backProject(sino)[source]

Backproject a sinogram.

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

Calculated the power of two larger than val. Used internally.

filterSinogram(filt, sino)[source]

Filter a sinogram sino with filter filt. Used internally.

forwProject(image)[source]

Forward project an image.

Parameters:image (numpy.ndarray) – The image data.
Returns:numpy.ndarray – The forward projection.
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.SimpleCPUProjector.ProjectorTranspose(parentProj)[source]

Implements the proj.T functionality.

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

Previous topic

A projector using the ASTRA toolbox: the ASTRAProjector module

Next topic

A simple projector using PyCUDA: the SimplePyCUDAProjector module

This Page