Skip to content
Snippets Groups Projects
Commit 0c260783 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Avoid copying of projection matrices on each kernel call

parent ecd51deb
No related merge requests found
Subproject commit 32dd8e7e0f43fc80a5ef905535c5212dea0c0773 Subproject commit 1d10af309ff19d637bf4e991f4cb0aa58b561840
...@@ -155,7 +155,7 @@ class ConeBeamProjector: ...@@ -155,7 +155,7 @@ class ConeBeamProjector:
if self._projection_matrices_numpy is None: if self._projection_matrices_numpy is None:
return return
self._projection_matrices = torch.stack(tuple( self._projection_matrices = torch.stack(tuple(
map(torch.from_numpy, self._projection_matrices_numpy))).cpu().contiguous() map(torch.from_numpy, self._projection_matrices_numpy))).cuda().contiguous()
inv_spacing = np.array([1/s for s in reversed(self._volume_spacing)], np.float32) inv_spacing = np.array([1/s for s in reversed(self._volume_spacing)], np.float32)
...@@ -167,6 +167,6 @@ class ConeBeamProjector: ...@@ -167,6 +167,6 @@ class ConeBeamProjector:
inv_matrices = map(lambda x: (np.linalg.inv(x[:3, :3]) * inv_matrices = map(lambda x: (np.linalg.inv(x[:3, :3]) *
inv_spacing).astype(np.float32), self._projection_matrices_numpy) inv_spacing).astype(np.float32), self._projection_matrices_numpy)
self._inverse_matrices = torch.stack(tuple(map(torch.from_numpy, inv_matrices))).cpu().contiguous() self._inverse_matrices = torch.stack(tuple(map(torch.from_numpy, inv_matrices))).cuda().contiguous()
self._source_points = torch.stack(tuple(map(torch.from_numpy, source_points))).cpu().contiguous() self._source_points = torch.stack(tuple(map(torch.from_numpy, source_points))).cuda().contiguous()
self._projection_multiplier = 1. self._projection_multiplier = 1.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment