detector
Set up the 7 degrees-of-freedom parameters for the C-arm
Tip
The Detector is usually initialized in the DRR module and shouldn’t need to be called directly.
Detector
def Detector(
sdd:float, # Source-to-detector distance (in units length)
height:int, # Y-direction length (in units pixels)
width:int, # X-direction length (in units pixels)
delx:float, # X-direction spacing (in units length / pixel)
dely:float, # Y-direction spacing (in units length / pixel)
x0:float, # Principal point x-coordinate (in units length)
y0:float, # Principal point y-coordinate (in units length)
reorient:torch.Tensor, # Frame-of-reference change matrix
n_subsample:int | None=None, # Number of target points to randomly sample
reverse_x_axis:bool=False, # If pose includes reflection (in E(3) not SE(3)), reverse x-axis
):
Construct a 6 DoF X-ray detector system. This model is based on a C-Arm.
Detector.forward
def forward(
extrinsic:RigidTransform, calibration:RigidTransform
):
Create source and target points for X-rays to trace through the volume.
Intrinsic matrix parsing
From a calibrated camera’s intrinsic matrix, calculate the following properties:
- Focal length (in units length)
- Principal point (in units length)
get_focal_length
def get_focal_length(
intrinsic, # Intrinsic matrix (3 x 3 tensor)
delx:float, # X-direction spacing (in units length)
dely:float, # Y-direction spacing (in units length)
)->float: # Focal length (in units length)
get_principal_point
def get_principal_point(
intrinsic, # Intrinsic matrix (3 x 3 tensor)
height:int, # Y-direction length (in units pixels)
width:int, # X-direction length (in units pixels)
delx:float, # X-direction spacing (in units length)
dely:float, # Y-direction spacing (in units length)
):
parse_intrinsic_matrix
def parse_intrinsic_matrix(
intrinsic, # Intrinsic matrix (3 x 3 tensor)
height:int, # Y-direction length (in units pixels)
width:int, # X-direction length (in units pixels)
delx:float, # X-direction spacing (in units length)
dely:float, # Y-direction spacing (in units length)
):
make_intrinsic_matrix
def make_intrinsic_matrix(
detector:Detector
):