Skip to content

Commit c2bb01a

Browse files
committed
Make filter_intersections_outside_volume False by default
1 parent 37c96ec commit c2bb01a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

diffdrr/renderers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(
1515
self,
1616
mode: str = "nearest", # Interpolation mode for grid_sample
1717
stop_gradients_through_grid_sample: bool = False, # Apply torch.no_grad when calling grid_sample
18-
filter_intersections_outside_volume: bool = True, # Use alphamin/max to filter the intersections
18+
filter_intersections_outside_volume: bool = False, # Use alphamin/max to filter the intersections
1919
reducefn: str = "sum", # Function for combining samples along each ray
2020
eps: float = 1e-8, # Small constant to avoid div by zero errors
2121
):
@@ -51,7 +51,7 @@ def forward(
5151

5252
# Calculate the midpoint of every pair of adjacent intersections
5353
# These midpoints lie exclusively in a single voxel
54-
alphamid = (alphas[..., 0:-1] + alphas[..., 1:]) / 2
54+
alphamid = (alphas[..., :-1] + alphas[..., 1:]) / 2
5555

5656
# Get the XYZ coordinate of each midpoint (normalized to [-1, +1]^3)
5757
xyzs = _get_xyzs(alphamid, source, target, dims, self.eps)

notebooks/api/01_renderers.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
" self,\n",
118118
" mode: str = \"nearest\", # Interpolation mode for grid_sample\n",
119119
" stop_gradients_through_grid_sample: bool = False, # Apply torch.no_grad when calling grid_sample\n",
120-
" filter_intersections_outside_volume: bool = True, # Use alphamin/max to filter the intersections\n",
120+
" filter_intersections_outside_volume: bool = False, # Use alphamin/max to filter the intersections\n",
121121
" reducefn: str = \"sum\", # Function for combining samples along each ray\n",
122122
" eps: float = 1e-8, # Small constant to avoid div by zero errors\n",
123123
" ):\n",
@@ -153,7 +153,7 @@
153153
"\n",
154154
" # Calculate the midpoint of every pair of adjacent intersections\n",
155155
" # These midpoints lie exclusively in a single voxel\n",
156-
" alphamid = (alphas[..., 0:-1] + alphas[..., 1:]) / 2\n",
156+
" alphamid = (alphas[..., :-1] + alphas[..., 1:]) / 2\n",
157157
"\n",
158158
" # Get the XYZ coordinate of each midpoint (normalized to [-1, +1]^3)\n",
159159
" xyzs = _get_xyzs(alphamid, source, target, dims, self.eps)\n",

0 commit comments

Comments
 (0)