Bases: object
Helps with various common ASTRA Toolbox 2D operations.
This class can perform several often used toolbox operations, such as:
Note that this class has a some computational overhead, because it copies a lot of data. If you use many repeated operations, directly using the PyAstraToolbox methods directly is faster.
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: |
---|
Backproject a sinogram.
Parameters: | data (numpy.ndarray or int) – The sinogram data or ID. |
---|---|
Returns: | numpy.ndarray – The backprojection. |
Forward project an image.
Parameters: | data (numpy.ndarray or int) – The image data or ID. |
---|---|
Returns: | numpy.ndarray – The forward projection. |
Reconstruct an image from a sinogram.
Parameters: |
|
---|---|
Returns: | numpy.ndarray – The reconstruction. |
Example of a SIRT reconstruction using CUDA:
proj = ASTRAProjector2D(...)
rec = proj.reconstruct(sinogram,'SIRT_CUDA',iterations=1000)
Implements the proj.T functionality.
Do not use directly, since it can be accessed as member .T of an ASTRAProjector2D object.