CT Volume
- leapctype.tomographicModels.set_volume(self, numX, numY, numZ, voxelWidth=None, voxelHeight=None, offsetX=None, offsetY=None, offsetZ=None)
Set the CT volume parameters
The samples are given by
\[\begin{split}\begin{eqnarray*} x[i] &:=& voxelWidth\left(i - \frac{numX-1}{2}\right) + offsetX, \qquad i = 0,1,\dots,numX-1 \\ y[j] &:=& voxelWidth\left(j - \frac{numY-1}{2}\right) + offsetY, \qquad j = 0,1,\dots,numY-1 \\ z[k] &:=& voxelHeight\left(k - \frac{numZ-1}{2}\right) + offsetZ, \qquad k = 0,1,\dots,numZ-1 \end{eqnarray*}\end{split}\]For convenience we also provide an automated volume specification function: set_default_volume(). See also the set_diameterFOV() function which affects the circular mask applied to the z-slices of the reconstruction.
- Parameters:
numX (int) – number of voxels in the x-dimension
numY (int) – number of voxels in the y-dimension
numZ (int) – number of voxels in the z-dimension
voxelWidth (float) – voxel pitch (size) in the x and y dimensions
voxelHeight (float) – voxel pitch (size) in the z dimension
offsetX (float) – shift the volume in the x-dimension, measured in mm
offsetY (float) – shift the volume in the y-dimension, measured in mm
offsetZ (float) – shift the volume in the z-dimension, measured in mm
- Returns:
True if the parameters were valid, false otherwise
- leapctype.tomographicModels.set_default_volume(self, scale=1.0)
Sets the default volume parameters
The default volume parameters are those that fill the field of view of the CT system and use the native voxel sizes. Note that the CT geometry parameters must be specified before running this function.
- Parameters:
scale (float) – this value scales the voxel size by this value to create denser or sparser voxel representations (not recommended for fast reconstruction)
- Returns:
True if the operation was successful, false otherwise (this usually happens if the CT geometry has not yet been set)
- leapctype.tomographicModels.set_numZ(self, numZ)
Set the number of voxels in the z-dimension
- leapctype.tomographicModels.set_offsetZ(self, offsetZ)
Set offsetZ parameter which defines the central z-slice location (mm) of the volume
- leapctype.tomographicModels.set_diameterFOV(self, d)
Set the diameterFOV parameter
This function sets the parameter that specifies the diameter of the circular mask on the reconstruction z-slices. If this parameter is not specified, then the mask diameter will be calculated based on the size of the reconstructable field of view as determined by the CT geometry parameters (and setting of the offsetScan parameter). Applying this mask removes artifacts outside the field of view that can be distracting. It also provides speed improvements and for cone-beam geometries can help algorithms to use less memory. If one does not want any masking applied, just provide a very large number to this function’s argument.
- Parameters:
d (float) – the diameter (mm) of the circular mask on the reconstruction z-slices
- leapctype.tomographicModels.windowFOV(self, f)
Sets all voxels outside the field of view to zero
The CT geometry parameters and the CT volume parameters must be set prior to running this function.
- Parameters:
f (C contiguous float32 numpy array or torch tensor) – volume data to operate on
- Returns:
f, the same as the input
- leapctype.tomographicModels.voxelSamples(self, centerCoords=False)
Returns 3D meshgrid of the voxel x,y,z sample locations
- leapctype.tomographicModels.x_samples(self, centerCoords=False)
Returns an array of the x sample locations
- leapctype.tomographicModels.y_samples(self, centerCoords=False)
Returns an array of the y sample locations
- leapctype.tomographicModels.z_samples(self, centerCoords=False)
Returns an array of the z sample locations