From 93a8d517cc49714941077f091d132f3dc8136a8b Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Fri, 24 Dec 2010 14:12:37 +0000 Subject: [PATCH] Changing slice using keyboard is working again --- invesalius/data/slice_.py | 10 ++++++++++ invesalius/data/viewer_slice.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/invesalius/data/slice_.py b/invesalius/data/slice_.py index c853e7a..a3abefa 100644 --- a/invesalius/data/slice_.py +++ b/invesalius/data/slice_.py @@ -126,6 +126,16 @@ class Slice(object): ps.Publisher().subscribe(self.OnRemoveMasks, 'Remove masks') ps.Publisher().subscribe(self.OnDuplicateMasks, 'Duplicate masks') + def GetMaxSliceNumber(self, orientation): + shape = self.matrix.shape + + if orientation == 'AXIAL': + return shape[0] + elif orientation == 'CORONAL': + return shape[1] + elif orientation == 'SAGITAL': + return shape[2] + def OnRemoveMasks(self, pubsub_evt): selected_items = pubsub_evt.data proj = Project() diff --git a/invesalius/data/viewer_slice.py b/invesalius/data/viewer_slice.py index 6a7b0dd..8363e5b 100755 --- a/invesalius/data/viewer_slice.py +++ b/invesalius/data/viewer_slice.py @@ -1330,7 +1330,7 @@ class Viewer(wx.Panel): pos = self.scroll.GetThumbPosition() min = 0 - max = self.actor.GetSliceNumberMax() + max = self.slice_.GetMaxSliceNumber(self.orientation) if (evt.GetKeyCode() == wx.WXK_UP and pos > min): self.OnScrollForward() @@ -1359,7 +1359,7 @@ class Viewer(wx.Panel): def OnScrollBackward(self, evt=None, obj=None): pos = self.scroll.GetThumbPosition() - max = self.actor.GetSliceNumberMax() + max = self.slice_.GetMaxSliceNumber(self.orientation) if(pos < max): pos = pos + 1 -- libgit2 0.21.2