Commit 7bcf6df2af5ddefdd8c03128163fbedf60e01f0d
1 parent
ae85be7c
Exists in
master
and in
56 other branches
When user shows a mask, MIP is deactivated
Showing
3 changed files
with
29 additions
and
11 deletions
Show diff stats
invesalius/data/slice_.py
@@ -352,11 +352,15 @@ class Slice(object): | @@ -352,11 +352,15 @@ class Slice(object): | ||
352 | if not value: | 352 | if not value: |
353 | Publisher.sendMessage('Select mask name in combo', -1) | 353 | Publisher.sendMessage('Select mask name in combo', -1) |
354 | 354 | ||
355 | + if self._type_projection != const.PROJECTION_NORMAL: | ||
356 | + self.SetTypeProjection(const.PROJECTION_NORMAL) | ||
357 | + Publisher.sendMessage('Reload actual slice') | ||
358 | + | ||
355 | def __hide_current_mask(self, pubsub_evt): | 359 | def __hide_current_mask(self, pubsub_evt): |
356 | if self.current_mask: | 360 | if self.current_mask: |
357 | index = self.current_mask.index | 361 | index = self.current_mask.index |
358 | value = False | 362 | value = False |
359 | - self.ShowMask(index, value) | 363 | + Publisher.sendMessage('Show mask', (index, value)) |
360 | 364 | ||
361 | def edit_mask_pixel(self, operation, index, position, radius, orientation): | 365 | def edit_mask_pixel(self, operation, index, position, radius, orientation): |
362 | mask = self.buffer_slices[orientation].mask | 366 | mask = self.buffer_slices[orientation].mask |
@@ -823,7 +827,12 @@ class Slice(object): | @@ -823,7 +827,12 @@ class Slice(object): | ||
823 | def SetTypeProjection(self, tprojection): | 827 | def SetTypeProjection(self, tprojection): |
824 | if self._type_projection != tprojection: | 828 | if self._type_projection != tprojection: |
825 | if self._type_projection == const.PROJECTION_NORMAL: | 829 | if self._type_projection == const.PROJECTION_NORMAL: |
826 | - self.__hide_current_mask(None) | 830 | + Publisher.sendMessage('Hide current mask') |
831 | + | ||
832 | + if tprojection == const.PROJECTION_NORMAL: | ||
833 | + Publisher.sendMessage('Show MIP interface', False) | ||
834 | + else: | ||
835 | + Publisher.sendMessage('Show MIP interface', True) | ||
827 | 836 | ||
828 | self._type_projection = tprojection | 837 | self._type_projection = tprojection |
829 | for buffer_ in self.buffer_slices.values(): | 838 | for buffer_ in self.buffer_slices.values(): |
invesalius/data/viewer_slice.py
@@ -715,6 +715,7 @@ class Viewer(wx.Panel): | @@ -715,6 +715,7 @@ class Viewer(wx.Panel): | ||
715 | Publisher.subscribe(self.OnSetMIPSize, 'Set MIP size %s' % self.orientation) | 715 | Publisher.subscribe(self.OnSetMIPSize, 'Set MIP size %s' % self.orientation) |
716 | Publisher.subscribe(self.OnSetMIPBorder, 'Set MIP border %s' % self.orientation) | 716 | Publisher.subscribe(self.OnSetMIPBorder, 'Set MIP border %s' % self.orientation) |
717 | Publisher.subscribe(self.OnSetMIPInvert, 'Set MIP Invert %s' % self.orientation) | 717 | Publisher.subscribe(self.OnSetMIPInvert, 'Set MIP Invert %s' % self.orientation) |
718 | + Publisher.subscribe(self.OnShowMIPInterface, 'Show MIP interface') | ||
718 | 719 | ||
719 | def SetDefaultCursor(self, pusub_evt): | 720 | def SetDefaultCursor(self, pusub_evt): |
720 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) | 721 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) |
@@ -1136,15 +1137,6 @@ class Viewer(wx.Panel): | @@ -1136,15 +1137,6 @@ class Viewer(wx.Panel): | ||
1136 | 1137 | ||
1137 | elif evt.GetKeyCode() in projections: | 1138 | elif evt.GetKeyCode() in projections: |
1138 | print "PROJECTION MANOLO!" | 1139 | print "PROJECTION MANOLO!" |
1139 | - if evt.GetKeyCode() != wx.WXK_NUMPAD0 and self.slice_._type_projection == const.PROJECTION_NORMAL: | ||
1140 | - self.mip_ctrls.Show() | ||
1141 | - self.GetSizer().Add(self.mip_ctrls, 0, wx.EXPAND|wx.GROW|wx.ALL, 2) | ||
1142 | - self.Layout() | ||
1143 | - elif evt.GetKeyCode() == wx.WXK_NUMPAD0 and self.slice_._type_projection != const.PROJECTION_NORMAL: | ||
1144 | - self.mip_ctrls.Hide() | ||
1145 | - self.GetSizer().Remove(self.mip_ctrls) | ||
1146 | - self.Layout() | ||
1147 | - | ||
1148 | self.slice_.SetTypeProjection(projections[evt.GetKeyCode()]) | 1140 | self.slice_.SetTypeProjection(projections[evt.GetKeyCode()]) |
1149 | self.ReloadActualSlice() | 1141 | self.ReloadActualSlice() |
1150 | 1142 | ||
@@ -1203,6 +1195,18 @@ class Viewer(wx.Panel): | @@ -1203,6 +1195,18 @@ class Viewer(wx.Panel): | ||
1203 | buffer_.discard_buffer() | 1195 | buffer_.discard_buffer() |
1204 | self.ReloadActualSlice() | 1196 | self.ReloadActualSlice() |
1205 | 1197 | ||
1198 | + def OnShowMIPInterface(self, pubsub_evt): | ||
1199 | + value = pubsub_evt.data | ||
1200 | + if value: | ||
1201 | + self.mip_ctrls.Show() | ||
1202 | + self.GetSizer().Add(self.mip_ctrls, 0, wx.EXPAND|wx.GROW|wx.ALL, 2) | ||
1203 | + self.Layout() | ||
1204 | + else: | ||
1205 | + self.mip_ctrls.Hide() | ||
1206 | + self.GetSizer().Remove(self.mip_ctrls) | ||
1207 | + self.Layout() | ||
1208 | + | ||
1209 | + | ||
1206 | def set_slice_number(self, index): | 1210 | def set_slice_number(self, index): |
1207 | inverted = self.mip_ctrls.inverted.GetValue() | 1211 | inverted = self.mip_ctrls.inverted.GetValue() |
1208 | image = self.slice_.GetSlices(self.orientation, index, | 1212 | image = self.slice_.GetSlices(self.orientation, index, |
invesalius/gui/data_notebook.py
@@ -365,6 +365,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -365,6 +365,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
365 | 'Change mask colour in notebook') | 365 | 'Change mask colour in notebook') |
366 | 366 | ||
367 | Publisher.subscribe(self.OnChangeCurrentMask, 'Change mask selected') | 367 | Publisher.subscribe(self.OnChangeCurrentMask, 'Change mask selected') |
368 | + Publisher.subscribe(self.__hide_current_mask, 'Hide current mask') | ||
368 | Publisher.subscribe(self.OnCloseProject, 'Close project data') | 369 | Publisher.subscribe(self.OnCloseProject, 'Close project data') |
369 | 370 | ||
370 | def OnKeyEvent(self, event): | 371 | def OnKeyEvent(self, event): |
@@ -432,6 +433,10 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -432,6 +433,10 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
432 | if key != mask_index: | 433 | if key != mask_index: |
433 | self.SetItemImage(key, 0) | 434 | self.SetItemImage(key, 0) |
434 | 435 | ||
436 | + def __hide_current_mask(self, pubsub_evt): | ||
437 | + print self.mask_list_index.keys() | ||
438 | + self.SetItemImage(self.current_index, 0) | ||
439 | + | ||
435 | def __init_columns(self): | 440 | def __init_columns(self): |
436 | 441 | ||
437 | self.InsertColumn(0, "", wx.LIST_FORMAT_CENTER) | 442 | self.InsertColumn(0, "", wx.LIST_FORMAT_CENTER) |