from diffdrr.drr import DRR
from diffdrr.utils import convert
from diffpose.deepfluoro import DeepFluoroDataset
= torch.device("cuda")
device
= DeepFluoroDataset(id_number=1)
specimen = 256
height = (1536 - 100) / height
subsample = 0.194 * subsample
delx
= DRR(
drr
specimen.volume,
specimen.spacing,=specimen.focal_len / 2,
sdr=height,
height=delx,
delx=specimen.x0,
x0=specimen.y0,
y0=True,
reverse_x_axis
).to(device)
= specimen[52]
_, pose = convert(pose.get_rotation(), "matrix", "euler_angles", output_convention="ZYX")
R = R.to(device)
R = pose.get_translation().to(device)
t
= JacobianDRR(drr, R, t, "euler_angles", "ZYX")
jacdrr = jacdrr()
I0, J0
= dict(cmap="turbo", norm="symlog")
kwargs **kwargs) plot_img_jacobian(I0, J0,
jacobians
Computing pixel-wise gradients wrt pose parameters
JacobianDRR
JacobianDRR (drr, rotation, translation, parameterization, convention=None)
Computes the Jacobian of a DRR wrt pose parameters.
gradient_matching
gradient_matching (J0, J1)
plot_img_jacobian
plot_img_jacobian (I, J, **kwargs)