pytomography.transforms.SPECT
#
Submodules#
Package Contents#
Classes#
obj2obj transform used to model the effects of attenuation in SPECT. |
|
obj2obj transform used to model the effects of PSF blurring in SPECT. The smoothing kernel used to apply PSF modeling uses a Gaussian kernel with width \(\sigma\) dependent on the distance of the point to the detector; that information is specified in the |
|
im2im transformation used to set pixel values equal to zero at the first and last few z slices. This is often required when reconstructing DICOM data due to the finite field of view of the projection data, where additional axial slices are included on the top and bottom, with zero measured detection events. This transform is included in the system matrix, to model the sharp cutoff at the finite FOV. |
- class pytomography.transforms.SPECT.SPECTAttenuationTransform(CT)[source]#
Bases:
pytomography.transforms.Transform
obj2obj transform used to model the effects of attenuation in SPECT.
- Parameters:
CT (torch.tensor) – Tensor of size [batch_size, Lx, Ly, Lz] corresponding to the attenuation coefficient in \({\text{cm}^{-1}}\) at the photon energy corresponding to the particular scan
- __call__(object_i, i, norm_constant=None)#
Applies attenuation modeling to an object that’s being detected on the right of its first axis.
- Parameters:
object_i (torch.tensor) – Tensor of size [batch_size, Lx, Ly, Lz] being projected along
axis=1
.i (int) – The projection index: used to find the corresponding angle in image space corresponding to
object_i
. In particular, the x axis (tensor axis=1) of the object is aligned with the detector at angle i.norm_constant (torch.tensor, optional) – A tensor used to normalize the output during back projection. Defaults to None.
- Returns:
Tensor of size [batch_size, Lx, Ly, Lz] such that projection of this tensor along the first axis corresponds to an attenuation corrected projection.
- Return type:
torch.tensor
- class pytomography.transforms.SPECT.SPECTPSFTransform(psf_meta)[source]#
Bases:
pytomography.transforms.Transform
obj2obj transform used to model the effects of PSF blurring in SPECT. The smoothing kernel used to apply PSF modeling uses a Gaussian kernel with width \(\sigma\) dependent on the distance of the point to the detector; that information is specified in the
PSFMeta
parameter.- Parameters:
psf_meta (PSFMeta) – Metadata corresponding to the parameters of PSF blurring
- configure(object_meta, image_meta)#
Function used to initalize the transform using corresponding object and image metadata
- Parameters:
object_meta (ObjectMeta) – Object metadata.
image_meta (ImageMeta) – Image metadata.
- Return type:
None
- compute_kernel_size()#
Function used to compute the kernel size used for PSF blurring. In particular, uses the
max_sigmas
attribute ofPSFMeta
to determine what the kernel size should be such that the kernel encompasses at leastmax_sigmas
at all points in the object.- Returns:
The corresponding kernel size used for PSF blurring.
- Return type:
int
- get_sigma(radius, dx, shape, collimator_slope, collimator_intercept)#
Uses PSF Meta data information to get blurring \(\sigma\) as a function of distance from detector. It is assumed that
sigma=collimator_slope*d + collimator_intercept
where \(d\) is the distance from the detector.- Parameters:
radius (float) – The distance from the detector
dx (float) – Transaxial plane pixel spacing
shape (tuple) – Tuple containing (Lx, Ly, Lz): dimensions of object space
collimator_slope (float) – See collimator intercept
collimator_intercept (float) – Collimator slope and collimator intercept are defined such that sigma(d) = collimator_slope*d + collimator_intercept
detector. (where sigma corresponds to sigma of a Gaussian function that characterizes blurring as a function of distance from the) –
- Returns:
An array of length Lx corresponding to blurring at each point along the 1st axis in object space
- Return type:
array
- __call__(object_i, i, norm_constant=None)#
Applies PSF modeling for the situation where an object is being detector by a detector at the \(+x\) axis.
- Parameters:
object_i (torch.tensor) – Tensor of size [batch_size, Lx, Ly, Lz] being projected along its first axis
i (int) – The projection index: used to find the corresponding angle in image space corresponding to
object_i
. In particular, the x axis (tensor axis=1) of the object is aligned with the detector at angle i.norm_constant (torch.tensor, optional) – A tensor used to normalize the output during back projection. Defaults to None.
- Returns:
Tensor of size [batch_size, Lx, Ly, Lz] such that projection of this tensor along the first axis corresponds to n PSF corrected projection.
- Return type:
torch.tensor
- class pytomography.transforms.SPECT.CutOffTransform(file_NM)[source]#
Bases:
pytomography.transforms.Transform
im2im transformation used to set pixel values equal to zero at the first and last few z slices. This is often required when reconstructing DICOM data due to the finite field of view of the projection data, where additional axial slices are included on the top and bottom, with zero measured detection events. This transform is included in the system matrix, to model the sharp cutoff at the finite FOV.
- Parameters:
file_NM (str) – Filepath of the DICOM file corresponding to the reconstructed object. This is needed to obtain the number of blank z-slices on the top and bottom of the projections corresponding to the particular scanner.
- __call__(image, norm_constant=None, mode='forward_project')#
Applies the transformation.
- Parameters:
image (torch.Tensor) – Tensor of size [batch_size, Ltheta, Lr, Lz] which transform is appplied to
norm_constant (torch.Tensor | None, optional) – A tensor used to normalize the output during back projection. Defaults to None.
mode (str, optional) – Whether or not this is being used in forward (‘forward_project’) or backward projection (‘back_project’). Defaults to ‘forward_project’.
- Returns:
Original image, but with certain z-slices equal to zero.
- Return type:
torch.tensor