Skip to content

Commit 19ebfa8

Browse files
authored
Update OrthoSlicer3D._set_position in viewers.py
wrong indices to original data leading to weird selection of voxels for weird affine transforms and weird volumes this bug is also related to strange behavior with special acquisition, for example with small animal settings such as rodents leading to wrong location of origin (0,0,0) with image.orthoview()
1 parent a2e5dee commit 19ebfa8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nibabel/viewers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ def _set_position(self, x, y, z, notify=True):
399399
# deal with slicing appropriately
400400
self._position[:3] = [x, y, z]
401401
idxs = np.dot(self._inv_affine, self._position)[:3]
402-
for ii, (size, idx) in enumerate(zip(self._sizes, idxs)):
402+
idxs_new_order = idxs[self._order]
403+
for ii, (size, idx) in enumerate(zip(self._sizes, idxs_new_order)):
403404
self._data_idx[ii] = max(min(int(round(idx)), size - 1), 0)
404405
for ii in range(3):
405406
# sagittal: get to S/A

0 commit comments

Comments
 (0)