Forward and Back Projection
- leapctype.tomographicModels.project(self, g, f, param_id=None)
Calculate the forward projection of f and stores the result in g
The CT geometry parameters and the CT volume parameters must be set prior to running this function. This function take the argument g and returns the same g. Returning g is just there for nesting several algorithms.
- Parameters:
g (C contiguous float32 numpy array or torch tensor) – projection data
f (C contiguous float32 numpy array or torch tensor) – volume data
param_id (int) – optional parameter to project a particular parameter index
- Returns:
g, the same as the input with the same name
- leapctype.tomographicModels.backproject(self, g, f, param_id=None)
Calculate the backprojection (adjoint of the forward projection) of g and stores the result in f
The CT geometry parameters and the CT volume parameters must be set prior to running this function. This function take the argument f and returns the same f. Returning f is just there for nesting several algorithms.
- Parameters:
g (C contiguous float32 numpy array or torch tensor) – projection data
f (C contiguous float32 numpy array or torch tensor) – volume data
param_id (int) – optional parameter to project a particular parameter index
- Returns:
f, the same as the input with the same name
- leapctype.tomographicModels.set_projector(self, which='SF')
Set which projector model to use
Note that all forward projectors use the modified separable footprint model, this function only changes the backprojection model. Voxel-driven backprojection is faster, but less accurate
- Parameters:
which (string) – ‘SF’ for modified Separable Footprint, ‘VD’ for Voxel-Driven
- Returns:
True is the input was valid, False otherwise
- leapctype.tomographicModels.sensitivity(self, f=None)
Performs a calculation of the sensitivity of a CT geometry, i.e., the backprojection of data that is all ones
The CT geometry parameters and the CT volume parameters must be set prior to running this function. One can get the same result by backprojecting an array of projection data with all entries equal to one. The benefit of this function is that it is faster and uses less memory.
In a volume is provided, the result will be stored there, otherwise a new volume will be allocated.
- Parameters:
f (C contiguous float32 numpy array or torch tensor) – (optional argument) volume data to store the result
- Returns:
f, the same as the input
- leapctype.tomographicModels.rowRangeNeededForBackprojection(self, iz=None)
Calculates the detector rows necessary to reconstruct the current volume specification
The CT geometry parameters and the CT volume parameters must be set prior to running this function. For anything but cone-beam or axially-aligned modular-beam data this function will return np.array([0, numRows-1]). For cone-beam or axially-aligned modular-beam data, the function can be used to inform the user of the only detector row indies that are necessary to reconstruct the volume. This can be used to reduce the input data size which can be important to speed up calculations or reduce the CPU and/or GPU memory necessary to perform reconstruction.
- Returns:
rowsNeeded, a 2X1 numpy array where the values are the first and last detector row index needed to reconstruct the volume.
- leapctype.tomographicModels.sliceRangeNeededForProjection(self, doClip=True)
Calculates the volume z-slices necessary to forward project the view seen by the detectors
The CT geometry parameters and the CT volume parameters must be set prior to running this function. For anything but cone-beam or axially-aligned modular-beam data this function will return np.array([0, numZ-1]). For cone-beam or axially-aligned modular-beam data, the function can be used to inform the user of the only z-slices indices that are necessary to forward project the volume (does not include slices which would fall outside all detectors. This can be used to reduce the volume data size which can be important to speed up calculations or reduce the CPU and/or GPU memory necessary to perform reconstruction.
- Parameters:
doClip (boolean) – if True, clips the return values to be between 0 and numZ-1
- Returns:
slicesNeeded, a 2X1 numpy array where the values are the first and last z-slice index needed to project the volume.
- leapctype.tomographicModels.set_volume_mask(self, vol_mask)
Sets the tomographicModels member variable called volume_mask
The purpose of the volume mask is to provide user-specified regions of which voxels to include in forward and back projection algorithms. This mask must by a 3D numpy or torch tensor of the same size as the reconstruction volume. This array must have just ones and zeros, where the zeros mark the voxels that should not be considered in the forward or backprojection algorithms. This masking can remove unwanted regions from the reconstruction or potentially improve the quality of iterative reconstruction algorithms by removing unknowns from the reconstruction problem. Using this mask does not improve the speed of forward or backprojection algorithms. This mask is applied after performing a backprojection and before performing a projection. Note that masks applied to the projection data can be applied as arguments to the various iterative reconstruction algorithms (see “W” or “mask” arguments).
- Parameters:
vol_mask (C contiguous float32 numpy array or torch tensor) – the mask to be applied to the volume
- Returns:
no return value
- leapctype.tomographicModels.clear_volume_mask(self)
Clears the tomographicModels member variable called volume_mask
After running this function, the volume masking will no longer be performed because volume_mask is set to None
- leapctype.tomographicModels.apply_volume_mask(self, f)
Multiplies the given input by the tomographicModels member variable called volume_mask
This function performs the following: f = f * self.volume_mask If the volume_mask has not been set (see set_volume_mask) or does not match the size or type of the input, this function does nothing
- Parameters:
f (C contiguous float32 numpy array or torch tensor) – reconstruction volume
- Returns:
no return value