Loss functions for registration and reconstruction tasks
Image similarity metrics
Compute the similarity between a fixed X-ray \(\mathbf I\) and a moving X-ray \(\mathbf{\hat I}\), where \(\mathbf{\hat I}\) is rendered from an estimated camera pose (registration) or volume (reconstruction).
We implement patchwise variants of the following metrics:
Normalized Cross Correlation (NCC)
Multiscale Normalized Cross Correlation (mNCC)
Gradient Normalized Cross Correlation (gNCC)
Tip
If patch_size=None, the similarity metric is computed over the entire image.
Compute Normalized Cross Correlation between the image gradients of two batches of images.
Geodesic distances for SE(3)
One can define geodesic pseudo-distances on \(\mathbf{SO}(3)\) and \(\mathbf{SE}(3)\).1 This let’s us measure registration error (in radians and millimeters, respectively) on poses, rather than needed to compute the projection of fiducials.
We implement two geodesics on \(\mathbf{SE}(3)\):
The logarithmic geodesic
The double geodesic
Logarithmic Geodesic
Given two rotation matrices \(\mathbf R_A, \mathbf R_B \in \mathbf{SO}(3)\), the angular distance between their axes of rotation is
where \(\log(\cdot)\) is the logarithm map on \(\mathbf{SO}(3)\).2 Using the logarithm map on \(\mathbf{SE}(3)\), this generalizes to a geodesic loss function on camera poses \({\mathbf T}_A, {\mathbf T}_B \in \mathbf{SE}(3)\):
We can also formulate a geodesic distance on \(\mathbf{SE}(3)\) with units of length. Using the camera’s focal length \(f\), we convert the angular distance to an arc length:
When combined with the Euclidean distance on the translations \(d_t(\mathbf t_A, \mathbf t_B) = \| \mathbf t_A - \mathbf t_B \|\), this yields the double geodesic loss on \(\mathbf{SE}(3)\):3