Commit 93a8d517cc49714941077f091d132f3dc8136a8b
1 parent
84732784
Exists in
master
and in
5 other branches
Changing slice using keyboard is working again
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
invesalius/data/slice_.py
... | ... | @@ -126,6 +126,16 @@ class Slice(object): |
126 | 126 | ps.Publisher().subscribe(self.OnRemoveMasks, 'Remove masks') |
127 | 127 | ps.Publisher().subscribe(self.OnDuplicateMasks, 'Duplicate masks') |
128 | 128 | |
129 | + def GetMaxSliceNumber(self, orientation): | |
130 | + shape = self.matrix.shape | |
131 | + | |
132 | + if orientation == 'AXIAL': | |
133 | + return shape[0] | |
134 | + elif orientation == 'CORONAL': | |
135 | + return shape[1] | |
136 | + elif orientation == 'SAGITAL': | |
137 | + return shape[2] | |
138 | + | |
129 | 139 | def OnRemoveMasks(self, pubsub_evt): |
130 | 140 | selected_items = pubsub_evt.data |
131 | 141 | proj = Project() | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -1330,7 +1330,7 @@ class Viewer(wx.Panel): |
1330 | 1330 | pos = self.scroll.GetThumbPosition() |
1331 | 1331 | |
1332 | 1332 | min = 0 |
1333 | - max = self.actor.GetSliceNumberMax() | |
1333 | + max = self.slice_.GetMaxSliceNumber(self.orientation) | |
1334 | 1334 | |
1335 | 1335 | if (evt.GetKeyCode() == wx.WXK_UP and pos > min): |
1336 | 1336 | self.OnScrollForward() |
... | ... | @@ -1359,7 +1359,7 @@ class Viewer(wx.Panel): |
1359 | 1359 | |
1360 | 1360 | def OnScrollBackward(self, evt=None, obj=None): |
1361 | 1361 | pos = self.scroll.GetThumbPosition() |
1362 | - max = self.actor.GetSliceNumberMax() | |
1362 | + max = self.slice_.GetMaxSliceNumber(self.orientation) | |
1363 | 1363 | |
1364 | 1364 | if(pos < max): |
1365 | 1365 | pos = pos + 1 | ... | ... |