Package pyforms :: Package gui :: Package Controls :: Module ControlVisVisVolume
[hide private]
[frames] | no frames]

Source Code for Module pyforms.gui.Controls.ControlVisVisVolume

 1  #!/usr/bin/python 
 2  # -*- coding: utf-8 -*- 
 3   
 4  __author__      = "Ricardo Ribeiro" 
 5  __credits__     = ["Ricardo Ribeiro"] 
 6  __license__     = "MIT" 
 7  __version__     = "0.0" 
 8  __maintainer__  = "Ricardo Ribeiro" 
 9  __email__       = "ricardojvr@gmail.com" 
10  __status__      = "Development" 
11   
12   
13  import pyforms.Utils.tools as tools 
14  from PyQt4 import uic, QtGui, QtCore 
15  from pyforms.gui.Controls.ControlBase import ControlBase 
16   
17  from visvis import Point, Pointset     
18  import visvis as vv 
19  import numpy as np 
20 21 -class ControlVisVisVolume(ControlBase):
22
23 - def initForm(self):
24 self._form = QtGui.QWidget();layout = QtGui.QVBoxLayout();layout.setMargin(0);self._form.setLayout( layout ) 25 self._app = vv.use('pyqt4') 26 self._first=True 27 28 Figure = self._app.GetFigureClass() 29 self._fig = Figure(self._form) 30 vv.figure(self._fig.nr) 31 32 policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) 33 widget = self._fig._widget 34 widget.setSizePolicy(policy) 35 widget.setMinimumSize(100, 100) 36 37 layout.addWidget(widget) 38 39 self._colorMap = vv.CM_AUTUMN
40 41 ############################################################################ 42 ############ Properties #################################################### 43 ############################################################################ 44 45 @property
46 - def colorMap(self):
47 return self._colorMap
48 49 @colorMap.setter
50 - def colorMap(self, value):
51 self._colorMap=value 52 self.refresh()
53
54 - def refresh(self):
55 if len(self._value)>1: 56 a = vv.gca() 57 view = a.GetView() 58 a.Clear() 59 vv.volshow3(self._value, renderStyle='mip', cm=self._colorMap ) 60 if not self._first: 61 a = vv.gca() 62 a.SetView(view) 63 64 self._first=False
65 66 @property
67 - def value(self): return None
68 69 @value.setter
70 - def value(self, value):
71 72 self._value = value 73 74 self.refresh()
75