linear operators

class parallelproj.LinearOperator[source]

Bases: ABC

abstract base class for linear operators

__call__(x)[source]

alias to apply(x)

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

__init__()[source]
Return type

None

abstract _adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

abstract _apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

adjoint(y)[source]

adjoint step x = conj(scale) * A^H y

Parameters

y (array (numpy, cupy, torch tensor, ...)) –

Return type

numpy or cupy array

adjointness_test(xp, dev, verbose=False, iscomplex=False, **kwargs)[source]

test whether the adjoint is correctly implemented

Parameters
  • xp (ModuleType) – array module to use

  • dev (str) – device (cpu or cuda)

  • verbose (bool, optional) – verbose output

  • iscomplex (bool, optional) – use complex arrays

  • **kwargs (dict) – passed to np.isclose

apply(x)[source]

forward step y = scale * Ax

Parameters

x (array (numpy, cupy, torch tensor, ...)) –

Return type

numpy or cupy array

abstract property in_shape: tuple[int, ...]

shape of the input array

norm(xp, dev, num_iter=30, iscomplex=False, verbose=False)[source]

estimate norm of the linear operator using power iterations

Parameters
  • xp (ModuleType) – array module to use

  • dev (str) – device (cpu or cuda)

  • num_iter (int, optional) – number of power iterations

  • iscomplex (bool, optional) – use complex arrays

  • verbose (bool, optional) – verbose output

Returns

the norm of the linear operator

Return type

float

abstract property out_shape: tuple[int, ...]

shape of the output array

property scale: int | float | complex

scalar factor applied to the linear operator

class parallelproj.MatrixOperator(A)[source]

Bases: LinearOperator

Linear Operator defined by dense matrix multiplication

Parameters

A (npt.ArrayLike) –

__init__(A)[source]

init method

Parameters

A (2D complex array (numpy, cupy, torch)) –

Return type

None

_adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

_apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

property in_shape: tuple[int]

shape of the input array

property out_shape: tuple[int]

shape of the output array

class parallelproj.ElementwiseMultiplicationOperator(values)[source]

Bases: LinearOperator

Element-wise multiplication operator (multiplication with a diagonal matrix)

Parameters

values (npt.ArrayLike) –

__init__(values)[source]

init method

Parameters

values (numpy or cupy array) – values of the diagonal matrix

_adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

_apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

property in_shape: tuple[int, ...]

shape of the input array

property out_shape: tuple[int, ...]

shape of the output array

class parallelproj.GaussianFilterOperator(in_shape, sigma, **kwargs)[source]

Bases: LinearOperator

Gaussian filter operator

Parameters
__init__(in_shape, sigma, **kwargs)[source]

init method

Parameters
  • in_shape (tuple[int, ...]) – shape of the input array

  • sigma (float | array) – standard deviation of the gaussian filter

  • **kwargs (sometype) – passed to the ndimage gaussian_filter function

_adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

_apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

property in_shape: tuple[int, ...]

shape of the input array

property out_shape: tuple[int, ...]

shape of the output array

class parallelproj.CompositeLinearOperator(operators)[source]

Bases: LinearOperator

Composite Linear Operator defined by a sequence of Linear Operators

Given a tuple of operators (A_0, …, A_{n-1}) the composite operator is defined as A(x) = A0( A1( … ( A_{n-1}(x) ) ) )

Parameters

operators (tuple[LinearOperator, ...]) –

__init__(operators)[source]

init method

Parameters

operators (tuple[LinearOperator, ...]) – tuple of linear operators

_adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

_apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

property in_shape: tuple[int, ...]

shape of the input array

property operators: tuple[parallelproj.operators.LinearOperator, ...]

tuple of linear operators

property out_shape: tuple[int, ...]

shape of the output array

class parallelproj.VstackOperator(operators)[source]

Bases: LinearOperator

Stacking operator for stacking multiple linear operators vertically

Parameters

operators (tuple[LinearOperator, ...]) –

__init__(operators)[source]

init method

Parameters

operators (tuple[LinearOperator, ...]) – tuple of linear operators

Return type

None

_adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

_apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

property in_shape: tuple[int, ...]

shape of the input array

property out_shape: tuple[int, ...]

shape of the output array

class parallelproj.SubsetOperator(operators)[source]

Bases: object

Operator split into subsets

Parameters

operators (tuple[LinearOperator, ...]) –

__call__(x)[source]

Call self as a function.

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

list[Union[collections.abc.Buffer, numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]]

__init__(operators)[source]

init method

Parameters

operators (tuple[LinearOperator, ...]) – tuple of linear operators

Return type

None

adjoint(y)[source]

A_i^H y_i for all subsets i

Parameters

y (list[Union[collections.abc.Buffer, numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

adjoint_subset(x, i)[source]

A_i^H x for a given subset i

Parameters
Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

apply(x)[source]

A_i x for all subsets i

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

list[Union[collections.abc.Buffer, numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]]

apply_subset(x, i)[source]

A_i x for a given subset i

Parameters
Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

norms(xp, dev)[source]

norm(A_i) for all subsets i

Parameters
  • xp (module) –

  • dev (str) –

Return type

list[float]

high-level projection operators

class parallelproj.ParallelViewProjector2D(image_shape, radial_positions, view_angles, radius, image_origin, voxel_size)[source]

Bases: LinearOperator

2D non-TOF parallel view projector

Parameters
__init__(image_shape, radial_positions, view_angles, radius, image_origin, voxel_size)[source]

init method

Parameters
  • image_shape (tuple[int, int]) – shape of the input image (n1, n2)

  • radial_positions (npt.ArrayLike (numpy, cupy or torch array)) – radial positions of the projection views in world coordinates

  • angles (view) – angles of the projection views in radians

  • radius (float) – radius of the scanner

  • image_origin (tuple[float, float]) – world coordinates of the [0,0] voxel

  • voxel_size (tuple[float, float]) – the voxel size in both directions

  • view_angles (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

None

_adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

_apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

property in_shape: tuple[int, int]

shape of the input array

property out_shape: tuple[int, int]

shape of the output array

show_views(views_to_show=None, image=None, **kwargs)[source]

visualize the geometry of certrain projection views

Parameters
  • views_to_show (numpy array of integers) – view numbers to show

  • image (numpy array or cupy array, optional) – show an image inside the projector geometry

  • **kwargs (some type) – passed to matplotlib.pyplot.imshow

Return type

None

class parallelproj.ParallelViewProjector3D(image_shape, radial_positions, view_angles, radius, image_origin, voxel_size, ring_positions, span=1, max_ring_diff=None)[source]

Bases: LinearOperator

3D non-TOF parallel view projector

Parameters
__init__(image_shape, radial_positions, view_angles, radius, image_origin, voxel_size, ring_positions, span=1, max_ring_diff=None)[source]

init method

Parameters
  • image_shape (tuple[int, int, int]) – shape of the input image (n0, n1, n2) (last direction is axial)

  • radial_positions (npt.ArrayLike (numpy, cupy or torch array)) – radial positions of the projection views in world coordinates

  • angles (view) – angles of the projection views in radians

  • radius (float) – radius of the scanner

  • image_origin (tuple[float, float, float]) – world coordinates of the [0,0,0] voxel

  • voxel_size (tuple[float, float, float]) – the voxel size in all directions (last direction is axial)

  • ring_positions (numpy or cupy array) – position of the rings in world coordinates

  • span (int) – span of the sinogram - default is 1

  • max_ring_diff (int | None) – maximum ring difference - default is None (no limit)

  • view_angles (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

None

_adjoint(y)[source]

adjoint step x = A^H y

Parameters

y (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

_apply(x)[source]

forward step y = Ax

Parameters

x (Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) –

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

property in_shape: tuple[int, int, int]

shape of the input array

property out_shape: tuple[int, int, int]

shape of the output array

low-level non-TOF projector API

parallelproj.joseph3d_fwd(xstart, xend, img, img_origin, voxsize, threadsperblock=32, num_chunks=1)[source]

Non-TOF Joseph 3D forward projector

Parameters
  • xstart (npt.ArrayLike (numpy/cupy array or torch tensor)) – start world coordinates of the LORs, shape (nLORs, 3)

  • xend (npt.ArrayLike (numpy/cupy array or torch tensor)) – end world coordinates of the LORs, shape (nLORs, 3)

  • img (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the 3D image to be projected

  • img_origin (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the world coordinates of the image origin (voxel [0,0,0])

  • voxsize (npt.ArrayLike (numpy/cupy array or torch tensor)) – array containing the voxel size

  • threadsperblock (int, optional) – by default 32

  • num_chunks (int, optional) – break down the projection in hybrid mode into chunks to save memory on the GPU, by default 1

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

parallelproj.joseph3d_back(xstart, xend, img_shape, img_origin, voxsize, img_fwd, threadsperblock=32, num_chunks=1)[source]

Non-TOF Joseph 3D back projector

Parameters
  • xstart (npt.ArrayLike (numpy/cupy array or torch tensor)) – start world coordinates of the LORs, shape (nLORs, 3)

  • xend (npt.ArrayLike (numpy/cupy array or torch tensor)) – end world coordinates of the LORs, shape (nLORs, 3)

  • img_shape (tuple[int, int, int]) – the shape of the back projected image

  • img_origin (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the world coordinates of the image origin (voxel [0,0,0])

  • voxsize (npt.ArrayLike (numpy/cupy array or torch tensor)) – array containing the voxel size

  • img_fwd (npt.ArrayLike (numpy/cupy array or torch tensor)) – array of length nLORs containing the values to be back projected

  • threadsperblock (int, optional) – by default 32

  • num_chunks (int, optional) – break down the back projection in hybrid mode into chunks to save memory on the GPU, by default 1

Return type

Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

low-level TOF projector API

parallelproj.joseph3d_fwd_tof_sino(xstart, xend, img, img_origin, voxsize, tofbin_width, sigma_tof, tofcenter_offset, nsigmas, ntofbins, threadsperblock=32, num_chunks=1)[source]

TOF Joseph 3D sinogram forward projector

Parameters
  • xstart (npt.ArrayLike (numpy/cupy array or torch tensor)) – start world coordinates of the LORs, shape (nLORs, 3)

  • xend (npt.ArrayLike (numpy/cupy array or torch tensor)) – end world coordinates of the LORs, shape (nLORs, 3)

  • img (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the 3D image to be projected

  • img_origin (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the world coordinates of the image origin (voxel [0,0,0])

  • voxsize (npt.ArrayLike (numpy/cupy array or torch tensor)) – array containing the voxel size

  • tofbin_width (float) – width of the TOF bin in spatial units (same units as xstart)

  • sigma_tof (npt.ArrayLike (numpy/cupy array or torch tensor)) – sigma of Gaussian TOF kernel in spatial units (same units as xstart) can be an array of length 1 -> same sigma for all LORs or an array of length nLORs -> LOR dependent sigma

  • tofcenter_offset (npt.ArrayLike (numpy/cupy array or torch tensor)) – center offset of the central TOF bin in spatial units (same units as xstart) can be an array of length 1 -> same offset for all LORs or an array of length nLORs -> LOR dependent offset

  • nsigmas (float) – number of sigmas to consider when Gaussian kernel is evaluated (truncated)

  • ntofbins (int) – total number of TOF bins

  • threadsperblock (int, optional) – by default 32

  • num_chunks (int, optional) – break down the projection in hybrid mode into chunks to save memory on the GPU, by default 1

Return type

npt.ArrayLike (numpy/cupy array or torch tensor)

parallelproj.joseph3d_back_tof_sino(xstart, xend, img_shape, img_origin, voxsize, img_fwd, tofbin_width, sigma_tof, tofcenter_offset, nsigmas, ntofbins, threadsperblock=32, num_chunks=1)[source]

TOF Joseph 3D sinogram back projector

Parameters
  • xstart (npt.ArrayLike (numpy/cupy array or torch tensor)) – start world coordinates of the LORs, shape (nLORs, 3)

  • xend (npt.ArrayLike (numpy/cupy array or torch tensor)) – end world coordinates of the LORs, shape (nLORs, 3)

  • img_shape (tuple[int, int, int]) – the shape of the back projected image

  • img_origin (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the world coordinates of the image origin (voxel [0,0,0])

  • voxsize (npt.ArrayLike (numpy/cupy array or torch tensor)) – array containing the voxel size

  • img_fwd (npt.ArrayLike (numpy/cupy array or torch tensor)) – array of size nLOR*ntofbins containing the values to be back projected

  • tofbin_width (float) – width of the TOF bin in spatial units (same units as xstart)

  • sigma_tof (npt.ArrayLike (numpy/cupy array or torch tensor)) – sigma of Gaussian TOF kernel in spatial units (same units as xstart) can be an array of length 1 -> same sigma for all LORs or an array of length nLORs -> LOR dependent sigma

  • tofcenter_offset (npt.ArrayLike (numpy/cupy array or torch tensor)) – center offset of the central TOF bin in spatial units (same units as xstart) can be an array of length 1 -> same offset for all LORs or an array of length nLORs -> LOR dependent offset

  • nsigmas (float) – number of sigmas to consider when Gaussian kernel is evaluated (truncated)

  • ntofbins (int) – total number of TOF bins

  • threadsperblock (int, optional) – by default 32

  • num_chunks (int, optional) – break down the projection in hybrid mode into chunks to save memory on the GPU, by default 1

Return type

npt.ArrayLike (numpy/cupy array or torch tensor)

low-level TOF listmode projector API

parallelproj.joseph3d_fwd_tof_lm(xstart, xend, img, img_origin, voxsize, tofbin_width, sigma_tof, tofcenter_offset, nsigmas, tofbin, threadsperblock=32, num_chunks=1)[source]

TOF Joseph 3D listmode forward projector

Parameters
  • xstart (npt.ArrayLike (numpy/cupy array or torch tensor)) – start world coordinates of the event LORs, shape (num_events, 3)

  • xend (npt.ArrayLike (numpy/cupy array or torch tensor)) – end world coordinates of the event LORs, shape (num_events, 3)

  • img (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the 3D image to be projected

  • img_origin (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the world coordinates of the image origin (voxel [0,0,0])

  • voxsize (npt.ArrayLike (numpy/cupy array or torch tensor)) – array containing the voxel size

  • tofbin_width (float) – width of the TOF bin in spatial units (same units as xstart)

  • sigma_tof (npt.ArrayLike (numpy/cupy array or torch tensor)) – sigma of Gaussian TOF kernel in spatial units (same units as xstart) can be an array of length 1 -> same sigma for all LORs or an array of length nLORs -> LOR dependent sigma

  • tofcenter_offset (npt.ArrayLike (numpy/cupy array or torch tensor)) – center offset of the central TOF bin in spatial units (same units as xstart) can be an array of length 1 -> same offset for all events or an array of length num_events -> event dependent offset

  • nsigmas (float) – number of sigmas to consider when Gaussian kernel is evaluated (truncated)

  • tofbin (npt.ArrayLike (numpy/cupy array or torch tensor)) – array containing the tof bin of the events

  • threadsperblock (int, optional) – by default 32

  • num_chunks (int, optional) – break down the projection in hybrid mode into chunks to save memory on the GPU, by default 1

Return type

npt.ArrayLike (numpy/cupy array or torch tensor)

parallelproj.joseph3d_back_tof_lm(xstart, xend, img_shape, img_origin, voxsize, img_fwd, tofbin_width, sigma_tof, tofcenter_offset, nsigmas, tofbin, threadsperblock=32, num_chunks=1)[source]

TOF Joseph 3D listmode back projector

Parameters
  • xstart (npt.ArrayLike (numpy/cupy array or torch tensor)) – start world coordinates of the event LORs, shape (nLORs, 3)

  • xend (npt.ArrayLike (numpy/cupy array or torch tensor)) – end world coordinates of the event LORs, shape (nLORs, 3)

  • img_shape (tuple[int, int, int]) – the shape of the back projected image

  • img_origin (npt.ArrayLike (numpy/cupy array or torch tensor)) – containing the world coordinates of the image origin (voxel [0,0,0])

  • voxsize (npt.ArrayLike (numpy/cupy array or torch tensor)) – array containing the voxel size

  • img_fwd (npt.ArrayLike (numpy/cupy array or torch tensor)) – array of size num_events containing the values to be back projected

  • tofbin_width (float) – width of the TOF bin in spatial units (same units as xstart)

  • sigma_tof (npt.ArrayLike (numpy/cupy array or torch tensor)) – sigma of Gaussian TOF kernel in spatial units (same units as xstart) can be an array of length 1 -> same sigma for all LORs or an array of length num_events -> event dependent sigma

  • tofcenter_offset (npt.ArrayLike (numpy/cupy array or torch tensor)) – center offset of the central TOF bin in spatial units (same units as xstart) can be an array of length 1 -> same offset for all LORs or an array of length num_events -> event dependent offset

  • nsigmas (float) – number of sigmas to consider when Gaussian kernel is evaluated (truncated)

  • tofbin (npt.ArrayLike) – array with the tofbin of the events

  • threadsperblock (int, optional) – by default 32

  • num_chunks (int, optional) – break down the projection in hybrid mode into chunks to save memory on the GPU, by default 1

Return type

npt.ArrayLike (numpy/cupy array or torch tensor)