Analytic Reconstruction (FBP)
- leapctype.tomographicModels.FBP(self, g, f=None, inplace=False)
Performs a Filtered Backprojection (FBP) reconstruction of the projection data, g, and stores the result in f
This function performs analytic reconstruction (i.e., FBP) of nearly all LEAP geometries: parallel-, fan-, cone-, and (axially-aligned) modular-beam geometries, including both flat and curved detectors, axial or helical scans, Attenuated Radon Transform, symmetric object, etc. Note that FDK is an FBP-type algorithm, so for simplicity we just called it FBP in LEAP. The same goes for other analytic reconstructions.
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
inplace (bool) – if true, then the filtering operations will be done in-place (i.e., the value in g will be altered) to save on memory usage
- Returns:
f, the same as the input with the same name
- leapctype.tomographicModels.FBP_slice(self, g, islice=None, coord='z')
Performs FBP on a single slice
The CT geometry and CT volume parameters must be set prior to running this function. This slice index is the index within the current volume specification. This function does not change any LEAP parameters.
- Parameters:
g (C contiguous float32 numpy array or torch tensor) – projection data
islice (int) – the index of the slice to reconstruct
coord (string) – specifies which axis to reconstruct: can be ‘x’, ‘y’, or ‘z’; ‘z’ is the default
- Returns:
reconstructed slice of the same type as the projection data
- leapctype.tomographicModels.FBP_adjoint(self, g, f)
Performs the adjoint of the Filtered Backprojection (FBP) reconstruction of the volume data, f, and stores the result in g
This function performs the adjoint of analytic reconstruction (i.e., adjoint of FBP) of nearly all LEAP geometries: parallel-, fan-, cone-, and (axially-aligned) modular-beam geometries, including both flat and curved detectors, axial or helical scans, Attenuated Radon Transform, symmetric object, etc. Note that FDK is an FBP-type algorithm, so for simplicity we just called it FBP in LEAP. The same goes for other analytic reconstructions.
This function will not provide an exact adjoint of FBP for fan-beam or helical scans.
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
- Returns:
g, the same as the input with the same name
- leapctype.tomographicModels.BPF(self, g, f)
Performs a Backprojection Filtration (BPF) reconstruction of the projection data, 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. This reconstruction only works for parallel-beam data
- Parameters:
g (C contiguous float32 numpy array or torch tensor) – projection data
f (C contiguous float32 numpy array or torch tensor) – volume data
- Returns:
f, the same as the input with the same name
- leapctype.tomographicModels.filterProjections(self, g, g_out=None)
Filters the projection data, g, so that its (weighted) backprojection results in an FBP reconstruction.
More specifically, the same results as the FBP function can be achieved by running the following functions
filterProjections(g)weightedBackproject(g,f)The CT geometry 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
- Returns:
g, the same as the input with the same name
- leapctype.tomographicModels.HilbertFilterProjections(self, g)
Applies the Hilbert filter to the projection data, g, which is a subset of the operations in some reconstruction algorithms
The CT geometry 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
- Returns:
g, the same as the input with the same name
- leapctype.tomographicModels.rampFilterProjections(self, g, scalar=1.0)
Applies the ramp filter to the projection data, g, which is a subset of the operations in the filterProjections function.
The CT geometry 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
scalar – optional scalar to be applied (defaults to 1.0)
- Returns:
g, the same as the input with the same name
- leapctype.tomographicModels.weightedBackproject(self, g, f)
Calculate the weighted backprojection 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.
If preceeded by the filterProjections function, this function can produce and FBP reconstruction. Some geometries require a weighted backprojection for FBP reconstruction, such as fan-beam, helical cone-beam, Attenuated Radon Transform, and symmetric objects. Those geometries do not require a weighted backprojection (i.e., backprojection would suffice) for FBP reconstruction, we still recommend using this function to perform two-step FBP reconstructions because it performs some subtle operations that are only appropriate for FBP reconstruction; for example, using extrapolation in the row direction for axial cone-beam FBP (FDK).
- Parameters:
g (C contiguous float32 numpy array or torch tensor) – projection data
f (C contiguous float32 numpy array or torch tensor) – volume data
- Returns:
f, the same as the input with the same name
- leapctype.tomographicModels.rampFilterVolume(self, f)
Applies the 2D ramp filter to the volume data, f, for each z-slice
- Parameters:
f (C contiguous float32 numpy array or torch tensor) – volume data
- Returns:
f, the same as the input with the same name
- leapctype.tomographicModels.set_rampFilter(self, which)
Set the ramp filter to use: 0, 2, 4, 6, 8, 10, or 12
- Parameters:
which (int) – the order of the finite difference used in the ramp filter, higher numbers produce a sharper reconstruction. Shepp-Logan filter is the default value (2) and Ram-Lak is 12.
- Returns:
True is the input was valid.
- leapctype.tomographicModels.set_FBPlowpass(self, W=1.0)
Applies a low-pass filter of the specified FWHM to the ramp filter
- Parameters:
W (float) – the FWHM (in detector pixels) of a low pass filter applied to the ramp filter; must be >= 2.0
- leapctype.tomographicModels.get_FBPscalar(self)
Returns the FBP scaling factor
- leapctype.tomographicModels.set_truncatedScan(self, aFlag)
Set the truncatedScan parameter
One should perform a truncated scan FBP reconstruction, when the object being imaged extends past both the right and left sides of the detector, i.e., the projections are truncated. In this case, you should use the command: leapct.set_truncatedScan(True) prior to executing an FBP reconstruction, so that it uses extrapolation of the signal instead of zero-padding when applying the ramp filter this reduces cupping artifacts and other truncation artifacts.
- Parameters:
aFlag (bool) – Set to True to perform a truncated FBP reconstruction, whenever the FBP function is called
- leapctype.tomographicModels.set_offsetScan(self, aFlag)
Set the offsetScan parameter
This function is used to perform an FBP reconstruction where the projections are truncated on either the left or the right side (i.e., the object extends past the detector on the left or right side) In this case, you should use the command: leapct.set_offsetScan(True) This can happen if the detector is shifted horizontally (do this with the centerCol parameter) and/or the source is shifted horizontally (do this with the tau parameter). This is sometimes refered to as a half-fan or half-cone or half-scan. Sometimes this is not on purpose, but in most cases this is done deliberately because it enables one to nearly double the diameter of the field of view which is needed for large objects.
- Parameters:
aFlag (bool) – Set to True to perform an offset scan FBP reconstruction, whenever the FBP function is called
- leapctype.tomographicModels.LT(self, g, f=None, inplace=False)
Performs a Lambda/Local Tomography (LT) reconstruction of the projection data, g, and stores the result in f
This function performs Lambda/Local Tomography (LT) reconstruction of nearly all LEAP geometries: parallel-, fan-, cone-, and (axially-aligned) modular-beam geometries, including both flat and curved detectors, axial or helical scans, Attenuated Radon Transform, symmetric object, etc. LT reconstructions work even when the projections are truncated and reconstruct the 2D ramp filtered volume which is essentially an edge map.
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
inplace (bool) – if true, then the filtering operations will be done in-place (i.e., the value in g will be altered) to save on memory usage
- Returns:
f, the same as the input with the same name
- leapctype.tomographicModels.inconsistencyReconstruction(self, g, f=None, inplace=False)
Performs an Inconsistency Reconstruction of the projection data, g, and stores the result in f
An Inconsistency Reconstruction is an FBP reconstruction except it replaces the ramp filter with a derivative. For scans with angular ranges of 360 or more this will result in a pure noise reconstruction if the geometry is calibrated and there are no biases in the data. This can be used as a robust way to find the centerCol parameter or estimate detector tilt. 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
inplace (bool) – if true, then the filtering operations will be done in-place (i.e., the value in g will be altered) to save on memory usage
- Returns:
f, the same as the input with the same name
- leapctype.tomographicModels.space_carving(self, projection_mask, vol_mask)
Space Carving Segmentation-Reconstruction Algorithm
The CT geometry parameters and the CT volume parameters must be set prior to running this function. The volume mask will be set to zero where the rays of the zero values of the projection_mask input argument are located. The space carving reconstruction algorithm is given by
\[\begin{eqnarray} f_{mask} &:=& 1 - u\left( P^T(1-g_{mask}) \right) \end{eqnarray}\]where \(g_{mask}\) is the projection mask, \(f_{mask}\) is the volume mask, and \(u(\cdot)\) is the step or heaviside function.
- Parameters:
projection_mask (C contiguous float32 numpy or torch array) – projection mask/segmentation data (all values should be 0 or 1)
vol_mask (C contiguous float32 numpy or torch array) – volume mask/segmentation data
- Returns:
vol_mask, the same as the input with the same name