Skip to content

Commit

Permalink
BUG: in index selection for ants.plot
Browse files Browse the repository at this point in the history
  • Loading branch information
stnava committed Jan 4, 2023
1 parent 8c10b7d commit 26ef67f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ants/viz/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2407,6 +2407,14 @@ def reorient_slice(x, axis):
nonzero = np.where(img_arr.sum(axis=(1, 2)) > 0.01)[0]
min_idx = nonzero[0] + slice_buffer[0]
max_idx = nonzero[-1] - slice_buffer[1]
if min_idx > max_idx:
temp = min_idx
min_idx = max_idx
max_idx = temp
if max_idx > nonzero.max():
max_idx = nonzero.max()
if min_idx < 0:
min_idx = 0
slice_idxs = np.linspace(min_idx, max_idx, nslices).astype("int")
if reverse:
slice_idxs = np.array(list(reversed(slice_idxs)))
Expand Down

0 comments on commit 26ef67f

Please sign in to comment.