Commit 27d086a46c3b84acefc4bb21872b1059f540a8d5

Authored by Paulo Henrique Junqueira Amorim
1 parent e4353cf4

ADD: Pop-up menu with image tiling (some label's and event)

invesalius/constants.py
... ... @@ -160,7 +160,7 @@ WINDOW_LEVEL = {"Abdomen":(350,50),
160 160 "Vasculature - Hard":(240,80),
161 161 "Vasculature - Soft":(650,160)}
162 162  
163   -REDUCE_IMAGEDATA_QUALITY = 0
  163 +REDUCE_IMAGEDATA_QUALITY = 1
164 164  
165 165 # if 1, use vtkVolumeRaycastMapper, if 0, use vtkFixedPointVolumeRayCastMapper
166 166 TYPE_RAYCASTING_MAPPER = 0
... ... @@ -216,3 +216,14 @@ FILETYPE_PS = wx.NewId()
216 216 FILETYPE_POV = wx.NewId()
217 217 FILETYPE_OBJ = wx.NewId()
218 218  
  219 +IMAGE_TILING = {"1 x 1":(1,1), "1 x 2":(1,2),
  220 + "1 x 3":(1,3), "1 x 4":(1,4),
  221 + "2 x 1":(2,1), "2 x 2":(2,2),
  222 + "2 x 3":(2,3), "2 x 4":(2,4),
  223 + "3 x 1":(3,1), "3 x 2":(3,2),
  224 + "3 x 3":(3,3), "3 x 4":(3,4),
  225 + "4 x 1":(4,1), "4 x 2":(4,2),
  226 + "4 x 3":(4,3), "4 x 4":(4,4),
  227 + "4 x 5":(4,5), "5 x 4":(5,4)}
  228 +
  229 +
... ...
invesalius/gui/widgets/slice_menu.py
... ... @@ -29,9 +29,9 @@ class SliceMenu(wx.Menu):
29 29 def __init__(self):
30 30 wx.Menu.__init__(self)
31 31 self.ID_TO_TOOL_ITEM = {}
32   -
33   - submenu_wl = wx.Menu()
34 32  
  33 + #------------ Sub menu of the window and level ----------
  34 + submenu_wl = wx.Menu()
35 35 new_id = wx.NewId()
36 36 wl_item = wx.MenuItem(submenu_wl, new_id,\
37 37 'Default', kind=wx.ITEM_RADIO)
... ... @@ -45,7 +45,7 @@ class SliceMenu(wx.Menu):
45 45 submenu_wl.AppendItem(wl_item)
46 46 self.ID_TO_TOOL_ITEM[new_id] = name
47 47  
48   -
  48 + #------------ Sub menu of the pseudo colors -------------
49 49 submenu_pseudo_colors = wx.Menu()
50 50 new_id = wx.NewId()
51 51 color_item = wx.MenuItem(submenu_pseudo_colors, new_id,\
... ... @@ -60,16 +60,28 @@ class SliceMenu(wx.Menu):
60 60 submenu_pseudo_colors.AppendItem(color_item)
61 61 self.ID_TO_TOOL_ITEM[new_id] = name
62 62  
  63 + #------------ Sub menu of the image tiling ---------------
  64 + submenu_image_tiling = wx.Menu()
  65 + for name in sorted(const.IMAGE_TILING):
  66 + new_id = wx.NewId()
  67 + image_tiling_item = wx.MenuItem(submenu_image_tiling, new_id,\
  68 + name, kind=wx.ITEM_RADIO)
  69 + submenu_image_tiling.AppendItem(image_tiling_item)
  70 + self.ID_TO_TOOL_ITEM[new_id] = name
  71 +
  72 + # Add sub itens in the menu
63 73 self.AppendMenu(-1, "Window Width & Level", submenu_wl)
64 74 self.AppendMenu(-1, "Pseudo Colors", submenu_pseudo_colors)
65   -
  75 + self.AppendMenu(-1, "Image Tiling", submenu_image_tiling)
  76 +
66 77 # It doesn't work in Linux
67 78 self.Bind(wx.EVT_MENU, self.OnPopup)
68 79 # In Linux the bind must be putted in the submenu
69 80 if sys.platform == 'linux2':
70 81 submenu_wl.Bind(wx.EVT_MENU, self.OnPopup)
71 82 submenu_pseudo_colors.Bind(wx.EVT_MENU, self.OnPopup)
72   -
  83 + submenu_image_tiling.Bind(wx.EVT_MENU, self.OnPopup)
  84 +
73 85 def OnPopup(self, evt):
74 86  
75 87 id = evt.GetId()
... ... @@ -90,5 +102,9 @@ class SliceMenu(wx.Menu):
90 102 ps.Publisher().sendMessage('Change color table from background image', values)
91 103 ps.Publisher().sendMessage('Update slice viewer')
92 104  
  105 + elif(key in const.IMAGE_TILING.keys()):
  106 + values = const.IMAGE_TILING[key]
  107 + print "Changed Window to ", values
  108 +
93 109 evt.Skip()
94 110  
... ...