DRR

Module for computing digitally reconstructed radiographs

DRR

DRR is a PyTorch module that compues differentiable digitally reconstructed radiographs. The viewing angle for the DRR (known generally in computer graphics as the camera pose) is parameterized by the following parameters:

  • SDD : source-to-detector distance (i.e., the focal length of the C-arm)
  • \(\mathbf R \in \mathrm{SO}(3)\) : a rotation
  • \(\mathbf t \in \mathbb R^3\) : a translation
Tip

DiffDRR can take a rotation parameterized in any of the following forms to move the detector plane:

If using Euler angles, the parameters are

  • alpha : Azimuthal angle
  • beta : Polar angle
  • gamma : Plane rotation angle
  • bx : X-dir translation
  • by : Y-dir translation
  • bz : Z-dir translation
  • convention : Order of angles (e.g., ZYX)

(bx, by, bz) are translational parameters and (alpha, beta, gamma) are rotational parameters.


source

DRR

 DRR (subject:torchio.data.subject.Subject, sdd:float, height:int,
      delx:float, width:int|None=None, dely:float|None=None, x0:float=0.0,
      y0:float=0.0, p_subsample:float|None=None, reshape:bool=True,
      reverse_x_axis:bool=False, patch_size:int|None=None,
      renderer:str='siddon', **renderer_kwargs)

PyTorch module that computes differentiable digitally reconstructed radiographs.

Type Default Details
subject Subject TorchIO wrapper for the CT volume
sdd float Source-to-detector distance (i.e., the C-arm’s focal length)
height int Height of the rendered DRR
delx float X-axis pixel size
width int | None None Width of the rendered DRR (default to height)
dely float | None None Y-axis pixel size (if not provided, set to delx)
x0 float 0.0 Principal point X-offset
y0 float 0.0 Principal point Y-offset
p_subsample float | None None Proportion of pixels to randomly subsample
reshape bool True Return DRR with shape (b, 1, h, w)
reverse_x_axis bool False If pose includes reflection (i.e., E(3), not SE(3)), reverse x-axis
patch_size int | None None Render patches of the DRR in series
renderer str siddon Rendering backend, either “siddon” or “trilinear”
renderer_kwargs

The forward pass of the DRR module generated DRRs from the input CT volume. The pose parameters (i.e., viewing angles) from which the DRRs are generated are passed to the forward call.


source

DRR.forward

 DRR.forward (*args, parameterization:str=None, convention:str=None,
              mask_to_channels:bool=False, **kwargs)

Generate DRR with rotational and translational parameters.


source

DRR.perspective_projection

 DRR.perspective_projection (pose:diffdrr.pose.RigidTransform,
                             pts:torch.Tensor)

source

DRR.inverse_projection

 DRR.inverse_projection (pose:diffdrr.pose.RigidTransform,
                         pts:torch.Tensor)