From 27d086a46c3b84acefc4bb21872b1059f540a8d5 Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Fri, 28 Aug 2009 17:13:19 +0000 Subject: [PATCH] ADD: Pop-up menu with image tiling (some label's and event) --- invesalius/constants.py | 13 ++++++++++++- invesalius/gui/widgets/slice_menu.py | 26 +++++++++++++++++++++----- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/invesalius/constants.py b/invesalius/constants.py index 9c28f5d..299fbc4 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -160,7 +160,7 @@ WINDOW_LEVEL = {"Abdomen":(350,50), "Vasculature - Hard":(240,80), "Vasculature - Soft":(650,160)} -REDUCE_IMAGEDATA_QUALITY = 0 +REDUCE_IMAGEDATA_QUALITY = 1 # if 1, use vtkVolumeRaycastMapper, if 0, use vtkFixedPointVolumeRayCastMapper TYPE_RAYCASTING_MAPPER = 0 @@ -216,3 +216,14 @@ FILETYPE_PS = wx.NewId() FILETYPE_POV = wx.NewId() FILETYPE_OBJ = wx.NewId() +IMAGE_TILING = {"1 x 1":(1,1), "1 x 2":(1,2), + "1 x 3":(1,3), "1 x 4":(1,4), + "2 x 1":(2,1), "2 x 2":(2,2), + "2 x 3":(2,3), "2 x 4":(2,4), + "3 x 1":(3,1), "3 x 2":(3,2), + "3 x 3":(3,3), "3 x 4":(3,4), + "4 x 1":(4,1), "4 x 2":(4,2), + "4 x 3":(4,3), "4 x 4":(4,4), + "4 x 5":(4,5), "5 x 4":(5,4)} + + diff --git a/invesalius/gui/widgets/slice_menu.py b/invesalius/gui/widgets/slice_menu.py index 751d6ef..411ad13 100644 --- a/invesalius/gui/widgets/slice_menu.py +++ b/invesalius/gui/widgets/slice_menu.py @@ -29,9 +29,9 @@ class SliceMenu(wx.Menu): def __init__(self): wx.Menu.__init__(self) self.ID_TO_TOOL_ITEM = {} - - submenu_wl = wx.Menu() + #------------ Sub menu of the window and level ---------- + submenu_wl = wx.Menu() new_id = wx.NewId() wl_item = wx.MenuItem(submenu_wl, new_id,\ 'Default', kind=wx.ITEM_RADIO) @@ -45,7 +45,7 @@ class SliceMenu(wx.Menu): submenu_wl.AppendItem(wl_item) self.ID_TO_TOOL_ITEM[new_id] = name - + #------------ Sub menu of the pseudo colors ------------- submenu_pseudo_colors = wx.Menu() new_id = wx.NewId() color_item = wx.MenuItem(submenu_pseudo_colors, new_id,\ @@ -60,16 +60,28 @@ class SliceMenu(wx.Menu): submenu_pseudo_colors.AppendItem(color_item) self.ID_TO_TOOL_ITEM[new_id] = name + #------------ Sub menu of the image tiling --------------- + submenu_image_tiling = wx.Menu() + for name in sorted(const.IMAGE_TILING): + new_id = wx.NewId() + image_tiling_item = wx.MenuItem(submenu_image_tiling, new_id,\ + name, kind=wx.ITEM_RADIO) + submenu_image_tiling.AppendItem(image_tiling_item) + self.ID_TO_TOOL_ITEM[new_id] = name + + # Add sub itens in the menu self.AppendMenu(-1, "Window Width & Level", submenu_wl) self.AppendMenu(-1, "Pseudo Colors", submenu_pseudo_colors) - + self.AppendMenu(-1, "Image Tiling", submenu_image_tiling) + # It doesn't work in Linux self.Bind(wx.EVT_MENU, self.OnPopup) # In Linux the bind must be putted in the submenu if sys.platform == 'linux2': submenu_wl.Bind(wx.EVT_MENU, self.OnPopup) submenu_pseudo_colors.Bind(wx.EVT_MENU, self.OnPopup) - + submenu_image_tiling.Bind(wx.EVT_MENU, self.OnPopup) + def OnPopup(self, evt): id = evt.GetId() @@ -90,5 +102,9 @@ class SliceMenu(wx.Menu): ps.Publisher().sendMessage('Change color table from background image', values) ps.Publisher().sendMessage('Update slice viewer') + elif(key in const.IMAGE_TILING.keys()): + values = const.IMAGE_TILING[key] + print "Changed Window to ", values + evt.Skip() -- libgit2 0.21.2