From b72bf48b49281dacf20d0e8c265966457c383f45 Mon Sep 17 00:00:00 2001 From: Vivek Gopalakrishnan Date: Mon, 20 May 2024 10:45:33 -0400 Subject: [PATCH 1/2] Flip projected fiducials if reverse_x_axis is True --- diffdrr/drr.py | 2 ++ notebooks/api/00_drr.ipynb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/diffdrr/drr.py b/diffdrr/drr.py index f0e631339..24bedeaf8 100644 --- a/diffdrr/drr.py +++ b/diffdrr/drr.py @@ -189,6 +189,8 @@ def perspective_projection( x = torch.einsum("ij, bnj -> bni", self.detector.intrinsic, x) z = x[..., -1].unsqueeze(-1).clone() x = x / z + if self.detector.reverse_x_axis: + x[..., 1] = self.detector.width - x[..., 1] return x[..., :2] # %% ../notebooks/api/00_drr.ipynb 13 diff --git a/notebooks/api/00_drr.ipynb b/notebooks/api/00_drr.ipynb index 62889ea49..b8a3e0b8d 100644 --- a/notebooks/api/00_drr.ipynb +++ b/notebooks/api/00_drr.ipynb @@ -322,6 +322,8 @@ " x = torch.einsum(\"ij, bnj -> bni\", self.detector.intrinsic, x)\n", " z = x[..., -1].unsqueeze(-1).clone()\n", " x = x / z\n", + " if self.detector.reverse_x_axis:\n", + " x[..., 1] = self.detector.width - x[..., 1]\n", " return x[..., :2]" ] }, From 0f71affd645c12fbc56ebdc07c6de5a4c97ea559 Mon Sep 17 00:00:00 2001 From: Vivek Gopalakrishnan Date: Mon, 20 May 2024 10:45:44 -0400 Subject: [PATCH 2/2] Update introduction --- notebooks/tutorials/introduction.ipynb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/notebooks/tutorials/introduction.ipynb b/notebooks/tutorials/introduction.ipynb index f94edcf9f..523c0d9fb 100644 --- a/notebooks/tutorials/introduction.ipynb +++ b/notebooks/tutorials/introduction.ipynb @@ -424,8 +424,7 @@ "\n", "- `bone_attenuation_multiplier = 0` completely removes bones\n", "- `bone_attenuation_multiplier > 1` increases the contrast of bones relative to soft tissue\n", - "\n", - "This roughly simulates increasing the kVp of the X-ray imaging system." + " " ] }, {