Skip to content
Snippets Groups Projects

Simple 3d slicer

1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
+ 1
1
@@ -288,7 +288,7 @@ def slices(vol, axis = 0, position = None, n_slices = 5, cmap = "viridis", img_h
return fig
def _get_slice_range(position: int, n_slices: int, n_total):
"""Returns the range of slices to be displayed around the given position."""
"""Helper function for `slices`. Returns the range of slices to be displayed around the given position."""
start_idx = position - n_slices // 2
end_idx = position + n_slices // 2 if n_slices % 2 == 0 else position + n_slices // 2 + 1
slice_idxs = np.arange(start_idx, end_idx)
Loading