Commit c5bb280ebcdab55f04094eed3a9a509c668295bf

Authored by Paulo Henrique Junqueira Amorim
1 parent bf066ca0

ADD: SliceMenu Class

.gitattributes
... ... @@ -120,6 +120,7 @@ invesalius/gui/widgets/clut_raycasting.py -text
120 120 invesalius/gui/widgets/foldpanelbar.py -text
121 121 invesalius/gui/widgets/gradient.py -text
122 122 invesalius/gui/widgets/listctrl.py -text
  123 +invesalius/gui/widgets/slice_menu.py -text
123 124 invesalius/invesalius.py -text
124 125 invesalius/presets.py -text
125 126 invesalius/project.py -text
... ...
invesalius/gui/widgets/slice_menu.py 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +#!/usr/bin/env python
  2 +# -*- coding: UTF-8 -*-
  3 +
  4 +#--------------------------------------------------------------------------
  5 +# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
  6 +# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
  7 +# Homepage: http://www.softwarepublico.gov.br
  8 +# Contact: invesalius@cti.gov.br
  9 +# License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt)
  10 +#--------------------------------------------------------------------------
  11 +# Este programa e software livre; voce pode redistribui-lo e/ou
  12 +# modifica-lo sob os termos da Licenca Publica Geral GNU, conforme
  13 +# publicada pela Free Software Foundation; de acordo com a versao 2
  14 +# da Licenca.
  15 +#
  16 +# Este programa eh distribuido na expectativa de ser util, mas SEM
  17 +# QUALQUER GARANTIA; sem mesmo a garantia implicita de
  18 +# COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM
  19 +# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais
  20 +# detalhes.
  21 +#--------------------------------------------------------------------------
  22 +
  23 +import wx
  24 +import wx.lib.pubsub as ps
  25 +import constants as const
  26 +
  27 +class SliceMenu(wx.Menu):
  28 + def __init__(self):
  29 + wx.Menu.__init__(self)
  30 + self.ID_TO_TOOL_ITEM = {}
  31 + submenu_wl = wx.Menu()
  32 + for name in sorted(const.WINDOW_LEVEL):
  33 + new_id = wx.NewId()
  34 + wl_item = wx.MenuItem(submenu_wl, new_id,\
  35 + name, kind=wx.ITEM_RADIO)
  36 + submenu_wl.AppendItem(wl_item)
  37 + self.ID_TO_TOOL_ITEM[new_id] = name
  38 + self.AppendMenu(-1, "Window Width & Level", submenu_wl)
  39 + self.Bind(wx.EVT_MENU, self.OnPopupWindowLevel)
  40 +
  41 +
  42 + def OnPopupWindowLevel(self, evt):
  43 + key = self.ID_TO_TOOL_ITEM[evt.GetId()]
  44 + window, level = const.WINDOW_LEVEL[key]
  45 + ps.Publisher().sendMessage('Bright and contrast adjustment image',
  46 + (window, level))
  47 + ps.Publisher().sendMessage('Update slice viewer')
  48 + evt.Skip()
  49 +
... ...