Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions tomobar/methodsDIR.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* :func:`RecToolsDIR.FBP` Filtered Back Projection 2D/3D (ASTRA with the custom built filter).
"""

from typing import Literal
import numpy as np
import scipy.fftpack

Expand Down Expand Up @@ -36,33 +37,36 @@ def __init__(
CenterRotOffset, # Centre of Rotation (CoR) scalar or a vector
AnglesVec, # Array of angles in radians
ObjSize, # A scalar to define reconstructed object dimensions
projector: Literal["fourier", "astra"] = "astra",
device_projector="gpu", # Choose the device to be 'cpu' or 'gpu' OR provide a GPU index (integer) of a specific device
):
device_projector, GPUdevice_index = _parse_device_argument(device_projector)

if DetectorsDimV == 0 or DetectorsDimV is None:
self.geom = "2D"
self.Atools = AstraTools2D(
DetectorsDimH,
DetectorsDimH_pad,
AnglesVec,
CenterRotOffset,
ObjSize,
device_projector,
GPUdevice_index,
)
if projector == "astra":
self.Atools = AstraTools2D(
DetectorsDimH,
DetectorsDimH_pad,
AnglesVec,
CenterRotOffset,
ObjSize,
device_projector,
GPUdevice_index,
)
else:
self.geom = "3D"
self.Atools = AstraTools3D(
DetectorsDimH,
DetectorsDimH_pad,
DetectorsDimV,
AnglesVec,
CenterRotOffset,
ObjSize,
device_projector,
GPUdevice_index,
)
if projector == "astra":
self.Atools = AstraTools3D(
DetectorsDimH,
DetectorsDimH_pad,
DetectorsDimV,
AnglesVec,
CenterRotOffset,
ObjSize,
device_projector,
GPUdevice_index,
)

def FORWPROJ(self, data: np.ndarray, **kwargs) -> np.ndarray:
"""Module to perform forward projection of 2d/3d data numpy array
Expand Down
Loading
Loading