DRR
DRR
DRR (volume:np.ndarray, spacing:np.ndarray, height:int, delx:float, width:int|None=None, dely:float|None=None, p_subsample:float|None=None, reshape:bool=True, params:torch.Tensor|None=None)
Torch module that computes differentiable digitally reconstructed radiographs.
Type | Default | Details | |
---|---|---|---|
volume | np.ndarray | CT volume | |
spacing | np.ndarray | Dimensions of voxels in the CT volume | |
height | int | Height of the rendered DRR | |
delx | float | X-axis pixel size | |
width | int | None | None | Width of the rendered DRR (if not provided, set to height ) |
dely | float | None | None | Y-axis pixel size (if not provided, set to delx ) |
p_subsample | float | None | None | Proportion of pixels to randomly subsample |
reshape | bool | True | Return DRR with shape (b, h, w) |
params | torch.Tensor | None | None | The parameters of the camera, including SDR, rotations, and translations. |
X-ray pose parameters
The viewing angle for the DRR (known generally in computer graphics as pose parameters) is parameterized by the following:
sdr
: Source-to-Detector radius (half of the source-to-detector distance)theta
: Azimuthal anglephi
: Polar anglegamma
: Plane rotation anglebx
: X-dir translationby
: Y-dir translationbz
: Z-dir translation
Translational (bx, by, bz)
and rotational (theta, phi, gamma)
parameters are grouped. The rotational pose parameters are detailed in Spherical Coordiantes Tutorial.
DRR.forward
DRR.forward ()
Forward call if DRR has been initialized with params.
The forward pass of the DRR
module can be used if the module has viewing angle stored as nn.Parameters
. Either pass parameters to the constructor or use _update_params
to set them.
If params
are passed to the DRR
constructor, they are instantiated as nn.Parameters
of the module. This makes them able to be optimized with any PyTorch optimizer.
DRR.project
DRR.project (sdr:float, theta:float, phi:float, gamma:float, bx:float, by:float, bz:float)
Instead of initializing the DRR
module with parameters, they can be passed to project
to compute a DRR. This acts as a differentiable renderer (i.e., reconstruction), but is not differentiable with respect to the pose parameters (i.e., registration).
Note: .project
doesn’t support batched DRR synthesis.