Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mrpro/operators/SliceProjectionOp.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __init__(
def _find_width(slice_profile: TensorFunction) -> int:
# figure out how far along the profile we have to consider values
# clip up to 0.01 of intensity on both sides
test_values = torch.arange(-max_shape, max_shape, max_shape)
test_values = torch.linspace(-max_shape, max_shape, 4 * max_shape + 1)
profile = slice_profile(test_values)
cdf = torch.cumsum(profile, -1) / profile.sum()
left = test_values[(cdf > 0.01).int().argmax()]
Expand Down
11 changes: 11 additions & 0 deletions tests/operators/test_slice_projection_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,14 @@ def test_slice_projection_op_cuda() -> None:
assert result.is_cuda

# Creation on GPU is not supported (see docstring)


def test_slice_projection_op_width() -> None:
"""Test profile width via the adjoint"""
width = 11
input_shape = SpatialDimension(100, 100, 100)
slice_profile = SliceSmoothedRectangular(width, 0)
operator = SliceProjectionOp(input_shape=input_shape, slice_profile=slice_profile, slice_shift=-0.5)
slices = torch.ones(1, 1, 100, 100)
(volume,) = operator.adjoint(slices)
assert (volume[:, 50, 50] > 0).sum() == width
Loading