CT Simulation Functions
- leapctype.tomographicModels.rayTrace(self, g=None, oversampling=1)
Performs analytic ray-tracing simulation through a phantom composed of geometrical objects
See the addObject function for how to build the phantom description The CT geometry parameters must be specified prior to running this functions
- Parameters:
g (C contiguous float32 numpy array) – CT projection data
oversampling (int) – the oversampling factor for each ray
- Returns:
g
- leapctype.tomographicModels.addObject(self, f, typeOfObject, c, r, val, A=None, clip=None, oversampling=1)
Adds a geometric object to the phantom
This function operates in two modes: (1) specifying a voxelized phantom and (2) specifying a phantom to be used in an analytic ray-tracing simulation (see rayTrace). If a volume is given (first argument of this function), then the specified object will be added to the voxel data. If a volume is not given then the object will be added to a stack of objects that define a phantom to be used for an analytic ray-tracing simulation.
The order in which multiple object are defined is important. Background objects must be specified first and foreground objects defined last. If you reverse the order, then the foreground objects will be effectively overriden by the background objects.
The CT volume or CT geometry parameters must be specified prior to running this functions.
- Parameters:
f (C contiguous float32 numpy array) – CT volume
type (int) – ELLIPSOID=0, PARALLELEPIPED=1, CYLINDER_X=2, CYLINDER_Y=3, CYLINDER_Z=4, CONE_X=5, CONE_Y=6, CONE_Z=7
c (3X1 numpy array) – x,y,z coordinates of the center of the object
r (3X1 numpy array) – radii in the x,y,z directions of the object
val (float) – the values to ascribe inside this object
A (3x3 numpy array) – rotation matrix to rotate the object about its center
clip (3X1 numpy array) – specifies the clipping planes, if any
- leapctype.tomographicModels.scalePhantom(self, c)
Scales the size of the phantom by the provided factor
One must have a phantom already defined before running this function.
- Parameters:
c (float or list of three float) – the scaling values (values greater than one make the phantom larger)
- leapctype.tomographicModels.clearPhantom(self)
Clears all phantom objects
- leapctype.tomographicModels.set_FORBILD(self, f=None, includeEar=True, oversampling=1)
Sets the FORBILD head phantom
This function operates in two modes: (1) specifying a voxelized phantom and (2) specifying a phantom to be used in an analytic ray-tracing simulation (see rayTrace). If a volume is given (first argument of this function), then the specified object will be added to the voxel data. If a volume is not given then all the objects of the FORBILD head phantom will be added to a stack of objects that define a phantom to be used for an analytic ray-tracing simulation.
Note that the values of the FORBILD head phantom are all scaled by 0.02 which is the LAC of water at around 60 keV. The FOV is about [-96, 96, -120, 120, -125, 125]
- Parameters:
f (C contiguous float32 numpy array) – CT volume
includeEar (boolean) – specifies whether the air bubbles in the ear are to be included or not
oversampling (int) – the oversampling factor of the voxelization
- leapctype.tomographicModels.voxelize(self, f, oversampling=1)
Voxelizes a phantom defined by geometric objects.
One must have a phantom already defined before running this function.
- Parameters:
f (C contiguous float32 numpy array or torch tensor) – volume data
oversampling (int) – the oversampling factor of the voxelization