Commit 179e48933dcdc8bda4ad2b62213321f169ceac42
1 parent
aebc68be
Exists in
master
and in
68 other branches
ENH: Redesign Change slice from 3D plane to event release of the scroll, because…
… the problem of slow, when there is volume.
Showing
1 changed file
with
15 additions
and
11 deletions
Show diff stats
invesalius/data/viewer_slice.py
... | ... | @@ -1010,14 +1010,12 @@ class Viewer(wx.Panel): |
1010 | 1010 | def set_scroll_position(self, position): |
1011 | 1011 | self.scroll.SetThumbPosition(position) |
1012 | 1012 | self.OnScrollBar() |
1013 | - | |
1014 | - def OnScrollBar(self, evt=None): | |
1015 | - pos = self.scroll.GetThumbPosition() | |
1016 | - self.set_slice_number(pos) | |
1013 | + | |
1014 | + def UpdateSlice3D(self, pos): | |
1017 | 1015 | original_orientation = project.Project().original_orientation |
1018 | - | |
1016 | + pos = self.scroll.GetThumbPosition() | |
1019 | 1017 | if (self.orientation == "CORONAL") and \ |
1020 | - (original_orientation == const.AXIAL): | |
1018 | + (original_orientation == const.AXIAL): | |
1021 | 1019 | pos = abs(self.scroll.GetRange() - pos) |
1022 | 1020 | elif(self.orientation == "AXIAL") and \ |
1023 | 1021 | (original_orientation == const.CORONAL): |
... | ... | @@ -1025,7 +1023,13 @@ class Viewer(wx.Panel): |
1025 | 1023 | elif(self.orientation == "AXIAL") and \ |
1026 | 1024 | (original_orientation == const.SAGITAL): |
1027 | 1025 | pos = abs(self.scroll.GetRange() - pos) |
1028 | - | |
1026 | + ps.Publisher().sendMessage('Change slice from slice plane',\ | |
1027 | + (self.orientation, pos)) | |
1028 | + | |
1029 | + def OnScrollBar(self, evt=None): | |
1030 | + pos = self.scroll.GetThumbPosition() | |
1031 | + self.set_slice_number(pos) | |
1032 | + #self.UpdateSlice3D(pos) | |
1029 | 1033 | self.pos = pos |
1030 | 1034 | self.cursor_.Show(1) |
1031 | 1035 | self.interactor.Render() |
... | ... | @@ -1033,10 +1037,8 @@ class Viewer(wx.Panel): |
1033 | 1037 | evt.Skip() |
1034 | 1038 | |
1035 | 1039 | def OnScrollBarRelease(self, evt): |
1036 | - ps.Publisher().sendMessage('Change slice from slice plane',\ | |
1037 | - (self.orientation, self.pos)) | |
1038 | - | |
1039 | - | |
1040 | + self.UpdateSlice3D(self.pos) | |
1041 | + | |
1040 | 1042 | def OnKeyDown(self, evt=None): |
1041 | 1043 | pos = self.scroll.GetThumbPosition() |
1042 | 1044 | |
... | ... | @@ -1051,7 +1053,9 @@ class Viewer(wx.Panel): |
1051 | 1053 | pos = pos + 1 |
1052 | 1054 | self.scroll.SetThumbPosition(pos) |
1053 | 1055 | self.OnScrollBar() |
1056 | + self.UpdateSlice3D(pos) | |
1054 | 1057 | self.interactor.Render() |
1058 | + | |
1055 | 1059 | if evt: |
1056 | 1060 | evt.Skip() |
1057 | 1061 | ... | ... |