rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
print "setting self._config.%s to %s" % (configTuple[1], val)
def viewToConfig(self): for configTuple in self._configList: widget = self._widgets[configTuple[0]] typeD = configTuple[2] if typeD.startswith('base:'): # we're only supporting 'text' widget so far wv = widget.GetValue() castString = typeD.split(':')[1] try: val = eval('%s(wv)' % (castString,)) except ValueError: # re...
pds2 = self._ipws[0].GetPolyDataAlgorithm()
pds2 = ipw.GetPolyDataAlgorithm()
def _syncOverlays(self): """Synchronise overlays to current main IPW. """ # check that we do have overlays for this direction if len(self._ipws) > 1: # we know this is a vtkPlaneSource try: pds1 = self._ipws[0].GetPolyDataAlgorithm() except AttributeError: pds1 = self._ipws[0].GetPolyDataSource() for ipw in self._ipw...
pds2 = self._ipws[0].GetPolyDataSource()
pds2 = ipw.GetPolyDataSource()
def _syncOverlays(self): """Synchronise overlays to current main IPW. """ # check that we do have overlays for this direction if len(self._ipws) > 1: # we know this is a vtkPlaneSource try: pds1 = self._ipws[0].GetPolyDataAlgorithm() except AttributeError: pds1 = self._ipws[0].GetPolyDataSource() for ipw in self._ipw...
self.add_vtk_error_handler()
self.add_vtk_error_handler(self._pdNormals)
def __init__(self, moduleManager): # initialise our base class moduleBase.__init__(self, moduleManager) noConfigModuleMixin.__init__(self)
self._imageDilate.Update()
self._imageMath.Update()
def executeModule(self): self._imageDilate.Update()
def get_module_manager(self): return self.moduleManager def getModuleManager(self): return self.get_module_manager()
def get_module_manager(self): return self.moduleManager
dt = testing.devideTesting(self)
dt = testing.devideTesting(self._devide_app)
def _handlerTestingAllTests(self, event): import testing reload(testing) dt = testing.devideTesting(self) dt.runAllTests()
def vtk_pipeline_configure(self, parent, renwin, objects):
def vtk_pipeline_configure(self, parent, renwin, objects=None):
def vtk_pipeline_configure(self, parent, renwin, objects): """This will instantiate and show only one pipeline config per module instance.
self._testObject1.SetInput(self._testObject0.GetOutput())
self._testObject1.SetInput(self._testObject0b.GetOutput())
def __init__(self, moduleManager): # initialise our base class moduleBase.__init__(self, moduleManager) # initialise any mixins we might have noConfigModuleMixin.__init__(self)
return self._testObject0b.GetOutput()
return self._testObject1.GetOutput()
def getOutput(self, idx): return self._testObject0b.GetOutput()
self._testObject0b.Update()
self._testObject1.Update()
def executeModule(self): self._testObject0b.Update()
self._superquadric.Update()
def executeModule(self): self._superquadric.Update() self._superquadricSource.Update()
self._config.sampleRate = (100, 100, 125)
self._config.sampleRate = (1, 1, 1)
def __init__(self, moduleManager): moduleBase.__init__(self, moduleManager)
self._extractGrid = vtk.vtkExtractGrid()
self._extractGrid = vtkdevide.vtkPVExtractVOI()
def __init__(self, moduleManager): moduleBase.__init__(self, moduleManager)
return ('VTK Structured Grid',)
return ('VTK Dataset',)
def getInputDescriptions(self): return ('VTK Structured Grid',)
return ('Subsampled VTK Structured Grid',)
return ('Subsampled VTK Dataset',)
def getOutputDescriptions(self): return ('Subsampled VTK Structured Grid',)
moduleUtilsITK.setupITKObjectProgress(
itk_kit.utils.setupITKObjectProgress(
def executeModule(self): if len(self._config.filename) and self._input: # g will be e.g. ('float', '3') # note that we use the NON-greedy version so it doesn't break # on vectors g = re.search('.*itk__ImageT(.*?)_([0-9]+)_t', self._input.this).groups()
done = 0 if re.match ("vtk\w*RenderWindow", vtk_obj.GetClassName ()): for method in self.methods[:]: if string.find (method, "FileName") > -1: self.methods.remove (method) done = done +1 elif string.find (method, "StereoCapableWindow") > -1: self.methods.remove (method) done = done +1 elif string.find (method, "Positi...
if vtk_obj.GetClassName().endswith('Writer'): for method in self.methods[:]: if method.find("ReleaseDataFlag") >= 0: self.methods.remove (method)
def initialize_methods (self, vtk_obj): debug ("VtkDirMethodParser:: initialize_methods ()")
chars = string.letters
chars = 'abcdefghijklmnopqrstuvwxyz'
def _makeUniqueInstanceName(self, instanceName=None): """Ensure that instanceName is unique or create a new unique instanceName.
instanceName == "%s%s%d" % (instanceName, tl, len(self._moduleDict))
instanceName = "%s%s%d" % (instanceName, tl, len(self._moduleDict))
def _makeUniqueInstanceName(self, instanceName=None): """Ensure that instanceName is unique or create a new unique instanceName.
if not self.controlFrame.Show(True): self.controlFrame.Raise() if not self.threedFrame.Show(True): self.threedFrame.Raise()
self.controlFrame.Show(True) self.controlFrame.Raise() self.threedFrame.Show(True) self.threedFrame.Raise()
def view(self): if not self.controlFrame.Show(True): self.controlFrame.Raise()
self.threedFrame.Show(True) self.controlFrame.Show(True)
self.view() if os.name == 'posix': self.threedFrame.threedRWI.GetRenderWindow().SetSize( self.threedFrame.threedRWI.GetSize()) self.threedFrame.threedRWI._Iren.ConfigureEvent() wxSafeYield()
def _ps_cb(): # FIXME: update to new factoring sliceDirection = self.getCurrentSliceDirection() if sliceDirection: val = self.threedFrame.pushSliceSpinCtrl.GetValue() if val: sliceDirection.pushSlice(val) self.threedFrame.pushSliceSpinCtrl.SetValue(0) self.threedFrame.threedRWI.Render()
if self._cachedInputs[idx] != None: try: self.setInput(idx, None)
try: self.setInput(idx, None) if self.setInput(idx, self._cachedInputs[idx]):
def enableExecution(self): self._executionEnabled = True if self._dummyRenderer: # put old renderer back and destroy dummyRenderer rw = self.threedFrame.threedRWI.GetRenderWindow() rw.RemoveRenderer(self._dummyRenderer) rw.AddRenderer(self._threedRenderer) self._dummyRenderer.RemoveAllProps() self._dummyRenderer = Non...
except Exception, e:
except Exception, e: if self.setInput(idx, self._cachedInputs[idx]):
def enableExecution(self): self._executionEnabled = True if self._dummyRenderer: # put old renderer back and destroy dummyRenderer rw = self.threedFrame.threedRWI.GetRenderWindow() rw.RemoveRenderer(self._dummyRenderer) rw.AddRenderer(self._threedRenderer) self._dummyRenderer.RemoveAllProps() self._dummyRenderer = Non...
obj.commandCallable = commandCallable
def commandCallable(): mm.genericProgressCallback( nameOfObject, obj.GetProgress(), progressText)
if rsoScalars.GetName(): print "sliceDirection.py: WARNING - ResliceOutput " \ "scalars are named." else: rsoScalars.SetName('ipw_reslice_output')
if rsoScalars: if rsoScalars.GetName(): print "sliceDirection.py: WARNING - ResliceOutput " \ "scalars are named." else: rsoScalars.SetName('ipw_reslice_output')
def addData(self, inputData): """Add inputData as a new layer. """ if inputData is None: raise Exception, "Hallo, the inputData is none. Doing nothing."
self.support_vtk() self.support_matplotlib()
self.support_vtk(self.interp) self.support_matplotlib(self.interp)
def __init__(self, module_manager): moduleBase.__init__(self, module_manager)
PythonShellMixin.close(self._moduleManager.log_error_with_exception)
PythonShellMixin.close(self, self._moduleManager.log_error_with_exception)
def close(self): # parameter is exception_printer method PythonShellMixin.close(self._moduleManager.log_error_with_exception) for i in range(len(self.getInputDescriptions())): self.setInput(i, None)
filename = self._saveas_python_file(cew.GetText())
filename = self._saveas_python_file(cew.GetText(), self._view_frame)
def _handler_file_save(self, evt): try: cew = self._get_current_editwindow() filename = self._saveas_python_file(cew.GetText()) if filename is not None: self._view_frame.statusbar.SetStatusText( 'Saved current edit to %s.' % (filename,)) except IOError, e: self._moduleManager.log_error_with_exception( 'Could not save ...
self._graphFrame.canvas.redaw()
self._graphFrame.canvas.redraw()
def _checkAndConnect(self, draggedObject, draggedPort, droppedObject, droppedInputPort):
if self.methods.index ('GetReferenceCount') > -1:
try: self.methods.index ('GetReferenceCount') except ValueError: pass else:
def initialize_methods (self, vtk_obj): debug ("VtkDirMethodParser:: initialize_methods ()")
def view(self):
def logicToConfig(self): pass def configToLogic(self): pass def viewToConfig(self): pass def configToView(self):
def view(self): pass
for trfm, img, i in zip(self._transformStack[1:], self._imageStack[1:], range(len(self._imageStack) - 1)):
for trfm, img, i in zip(self._transformStack, self._imageStack, range(len(self._imageStack))):
def _createPipelines(self): """Setup all necessary logic to transform, combine and convert all input images.
pda = totalTrfm.GetParameters()
def _createPipelines(self): """Setup all necessary logic to transform, combine and convert all input images.
copyTotalTrfm.SetParameters(pda)
copyTotalTrfm.SetIdentity() copyTotalTrfm.Compose(totalTrfm.GetPointer(),0)
def _createPipelines(self): """Setup all necessary logic to transform, combine and convert all input images.
self._imageAppend.AddInput(vtkImporter.GetOutput())
if True: self._imageAppend.AddInput(vtkImporter.GetOutput())
def _createPipelines(self): """Setup all necessary logic to transform, combine and convert all input images.
self._psFrame.pyShell.run('execfile("%s")' % (path,))
self._psFrame.pyShell.run('execfile(r"%s")' % (path,))
def loadSnippet(self, path): try: # redirect std thingies so that output appears in the shell win self._psFrame.pyShell.redirectStdout() self._psFrame.pyShell.redirectStderr() self._psFrame.pyShell.redirectStdin()
ival = orthoPanels[i].interactionCbox.GetValue() ipw.SetInteraction(not ival) ipw.SetInteraction(ival) orthoPanels[i].interactionCbox.SetValue(bool(ival))
def _eb_cb(i): ipw = self._ipws[i] if ipw.GetInput(): if orthoPanels[i].enabledCbox.GetValue(): ipw.On() orthoPanels[i].interactionCbox.Enable(1) # ipw.On() reactivates interaction! ival = orthoPanels[i].interactionCbox.GetValue() ipw.SetInteraction(not ival) ipw.SetInteraction(ival) orthoPanels[i].interactionCbox.SetV...
if hasattr(self._theFilter, 'Write') and \ callable(self._theFilter.Write): self._theFilter.Write()
def executeModule(self): for i in range(len(self.getOutputDescriptions())): # according to DeVIDE, module output MUST have an Update() self.getOutput(i).Update()
dc = wx.wxBufferedPaintDC(self, self._buffer)
dc = wx.wxBufferedPaintDC(self, self._buffer, style=wx.wxBUFFER_VIRTUAL_AREA)
def OnPaint(self, event): # as soon as dc is unbound and destroyed, buffer is blit dc = wx.wxBufferedPaintDC(self, self._buffer)
" simpleVTKClassModuleBase.__init__(\n" \
" SimpleVTKClassModuleBase.__init__(\n" \
" def __init__(self, moduleManager):\n" \
sizer_3.Add(self.filenameText, 1, 0, 0) sizer_3.Add(self.browseButton, 0, 0, 0)
sizer_3.Add(self.filenameText, 1, wxALIGN_CENTER_VERTICAL, 0) sizer_3.Add(self.browseButton, 0, wxALIGN_CENTER_VERTICAL, 0)
def __do_layout(self): # begin wxGlade: filenameViewModuleMixinFrame.__do_layout sizer_1 = wxBoxSizer(wxVERTICAL) sizer_5 = wxBoxSizer(wxVERTICAL) sizer_2 = wxBoxSizer(wxHORIZONTAL) sizer_4 = wxBoxSizer(wxHORIZONTAL) sizer_3 = wxBoxSizer(wxHORIZONTAL) sizer_3.Add(self.label_8_copy_1, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VE...
self.progressText = wx.StaticText(self.panel_1, -1, "This is quite a long progress message so that even the longest of messages eek.")
self.progressText = wx.StaticText(self.panel_1, -1, "...")
def __init__(self, *args, **kwds): # begin wxGlade: mainFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.sizer_4_staticbox = wx.StaticBox(self.panel_1, -1, "Message log") # Menu Bar self.frame_1_menubar = wx.MenuBar() self.SetMenuBar(se...
cfg.lt = -99999.00 cfg.ut = 0.0
cfg.lowerThreshold = -99999.00 cfg.upperThreshold = 0.0
def setUp(self): # call parent setUp method graphEditorTestBase.setUp(self)
self._view_frame.statusbar.SetLabel(
self._view_frame.statusbar.SetStatusText(
def _handler_file_save(self, evt): fd = wx.FileDialog( self._view_frame, 'Select filename to save current edit to', wildcard='*.py', style=wx.SAVE)
'Exception during CodeRunner close_handlers: %s' %
'Exception during PythonShellMixin close_handlers: %s' %
def close(self, exception_printer): for ch in self.close_handlers: try: ch() except Exception, e: exception_printer( 'Exception during CodeRunner close_handlers: %s' % (str(e),))
def mpl_new_figure(*args): handle = pylab.figure(*args)
def mpl_new_figure(*args, **kwargs): handle = pylab.figure(*args, **kwargs)
def mpl_new_figure(*args): handle = pylab.figure(*args) self.mpl_figure_handles.append(handle) return handle
ss.SetRadius((bounds[1] - bounds[0]) / 50.0)
ss.SetRadius((bounds[1] - bounds[0]) / 100.0)
def _storePoint(self, discrete, world, value):
(outputIdx, consumerInstance, consumerInputIdx)] = time.time()
(outputIdx, consumerInstance, consumerInputIdx)] = 0.0
def connectOutput(self, outputIdx, consumerInstance, consumerInputIdx): """Record connection on the given output of the encapsulated module.
self._interface.log_warning('%s: %s' % (i))
self._graphEditor._interface.log_warning( '%s: %s' % (i))
def OnData(self, x, y, d): if self.GetData(): text = self._tdo.GetText() filenames = self._fdo.GetFilenames() if len(text) > 0: # we're going to do something, so set the focus on # the graph editor canvas #self._graphEditor._canvasFrame.SetFocus() # set the string to zero so we know what to do when self._tdo.SetText(...
elif o in ('--noUpdates'):
elif o in ('--noUpdates',):
def main(): updatesRequested = True buildsRequested = True itkRequested = True try: # 'p:' means -p with something after optlist, args = getopt.getopt( sys.argv[1:], 'h', ['help', 'noUpdates', 'noBuilds', 'noItk', 'no-itk']) except getopt.GetoptError,e: dispUsage() sys.exit(1) for o, a in optlist: if o in ('-h', '--...
elif o in ('--noBuilds'):
elif o in ('--noBuilds',):
def main(): updatesRequested = True buildsRequested = True itkRequested = True try: # 'p:' means -p with something after optlist, args = getopt.getopt( sys.argv[1:], 'h', ['help', 'noUpdates', 'noBuilds', 'noItk', 'no-itk']) except getopt.GetoptError,e: dispUsage() sys.exit(1) for o, a in optlist: if o in ('-h', '--...
emsgs = genUtils.exceptionToMsgs() self._devideApp.logError(emsgs + [str(e)])
self._devideApp.log_error_with_exception(str(e))
def _execute_modules(self, glyphs): """Given a list of glyphs, request the scheduler to execute only those modules.
self._devideApp.logError(
self._devideApp.log_error_with_exception(
def _reload_module(self, module_instance, glyph): """Reload a module by storing all configuration information, deleting the module, and then recreating and reconnecting it.
self._currentModuleListShort = []
def __init__(self, devide_app): # initialise vars self._devide_app = devide_app
mlc = self._graphFrame.modulesListCtrl moduleName = self._currentModuleList[mlc.GetItemData(event.GetIndex())]
mlc = self._graphFrame.modulesListCtrl shortName, moduleName = \ self._selectedModulesList[mlc.GetItemData(event.GetIndex())]
def modulesListCtrlBeginDragHandler(self, event): mlc = self._graphFrame.modulesListCtrl moduleName = self._currentModuleList[mlc.GetItemData(event.GetIndex())]
self._currentModuleList = []
def _handlerModuleCatsListCtrlSelected(self, event): self._graphFrame.modulesListCtrl.DeleteAllItems()
self._currentModuleListShort = []
del self._selectedModulesList[:]
def _handlerModuleCatsListCtrlSelected(self, event): self._graphFrame.modulesListCtrl.DeleteAllItems()
mlc = self._graphFrame.modulesListCtrl
def _handlerModuleCatsListCtrlSelected(self, event): self._graphFrame.modulesListCtrl.DeleteAllItems()
smnItems.sort()
def _handlerModuleCatsListCtrlSelected(self, event): self._graphFrame.modulesListCtrl.DeleteAllItems()
mlc.InsertStringItem(idx, basename) self._currentModuleListShort.append(basename) self._currentModuleList.append('segment:%s' % (mn,)) mlc.SetItemData(idx, len(self._currentModuleList) - 1)
self._selectedModulesList.append( (basename, 'segment:%s' % (mn,)))
def _handlerModuleCatsListCtrlSelected(self, event): self._graphFrame.modulesListCtrl.DeleteAllItems()
mlc.InsertStringItem(idx, mParts[-1]) self._currentModuleListShort.append(mParts[-1]) self._currentModuleList.append('module:%s' % (mn,)) mlc.SetItemData(idx, len(self._currentModuleList) - 1)
self._selectedModulesList.append( (mParts[-1], 'module:%s' % (mn,))) mlc = self._graphFrame.modulesListCtrl self._selectedModulesList.sort() idx = 0 for shortname,longname in self._selectedModulesList: mlc.InsertStringItem(idx, shortname) mlc.SetItemData(idx, idx)
def _handlerModuleCatsListCtrlSelected(self, event): self._graphFrame.modulesListCtrl.DeleteAllItems()
self._currentModuleList[idx]
def _handlerModulesListCtrlSelected(self, event): mlc = self._graphFrame.modulesListCtrl idx = mlc.GetItemData(event.m_itemIndex) self._currentModuleList[idx] self._graphFrame.GetStatusBar().SetStatusText( self._currentModuleList[idx])
self._currentModuleList[idx])
self._selectedModulesList[idx][1])
def _handlerModulesListCtrlSelected(self, event): mlc = self._graphFrame.modulesListCtrl idx = mlc.GetItemData(event.m_itemIndex) self._currentModuleList[idx] self._graphFrame.GetStatusBar().SetStatusText( self._currentModuleList[idx])
for m in self._currentModuleListShort:
for m,longname in self._selectedModulesList:
def prefixSearch(prefix): # let's search for a module in the module list with this prefix mFound = False idx = 0 for m in self._currentModuleListShort: if m.lower().startswith(prefix.lower()): mFound = True break idx += 1
if mlc.GetItemState(idx, wxLIST_STATE_SELECTED):
if mlc.GetItemState( idx, wxLIST_STATE_SELECTED) == wxLIST_STATE_SELECTED:
def prefixSearch(prefix): # let's search for a module in the module list with this prefix mFound = False idx = 0 for m in self._currentModuleListShort: if m.lower().startswith(prefix.lower()): mFound = True break idx += 1
self._currentModuleList[idx])
self._selectedModulesList[idx][1])
def prefixSearch(prefix): # let's search for a module in the module list with this prefix mFound = False idx = 0 for m in self._currentModuleListShort: if m.lower().startswith(prefix.lower()): mFound = True break idx += 1
self.outputSelectedPoints = temp_output_selected_points
self.outputSelectedPoints[:] = temp_output_selected_points[:]
def _syncOutputSelectedPoints(self): """Sync up the output vtkPoints and names to _sel_points. We play it safe, as the number of points in this list is usually VERY low. """
newModule.setConfig(pmsTuple[1].moduleConfig)
configCopy = copy.deepcopy(pmsTuple[1].moduleConfig) print "DESERIALISE: %s" % \ (str(configCopy),) newModule.setConfig(configCopy)
def deserialiseModuleInstances(self, pmsDict, connectionList): """Given a pickled stream, this method will recreate all modules, configure them and connect them up. It returns a list of successfully instantiated modules. """ # let's attempt to instantiate all the modules
idx, wxLIST_STATE_SELECTED) == wxLIST_STATE_SELECTED:
idx, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED:
def modulesListCtrlBeginDragHandler(self, event): mlc = self._graphFrame.modulesListCtrl
if clc.GetItemState(idx, wxLIST_STATE_SELECTED):
if clc.GetItemState(idx, wxLIST_STATE_SELECTED) &\ wxLIST_STATE_SELECTED:
def _handlerModuleCatsListCtrlSelected(self, event): self._graphFrame.modulesListCtrl.DeleteAllItems()
idx, wxLIST_STATE_SELECTED) == wxLIST_STATE_SELECTED:
idx, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED:
def prefixSearch(prefix): # let's search for a module in the module list with this prefix mFound = False idx = 0 for m,longname in self._selectedModulesList: if m.lower().startswith(prefix.lower()): mFound = True break idx += 1
cur_colour = wxColour(self.get_set_var[i][0] * 255.0, self.get_set_var[i][1] * 255.0, self.get_set_var[i][2] * 255.0)
exec('colour_tuple = %s' % str(self.get_set_var[i])) cur_colour = wxColour(colour_tuple[0] * 255.0, colour_tuple[1] * 255.0, colour_tuple[2] * 255.0)
def set_color (self, event, i, parent):
configList.append('%s : %s' % (configKey, cValStr))
configList.append('%s : %s' % (configKey, cValStr.replace('\\', '/')))
def _exportNetworkAsDOT(self, glyphs, filename): (pmsDict, connectionList, glyphPosDict) = \ self._serialiseNetwork(glyphs)
self.main_splitter.SplitVertically(self.window_1_pane_1, self.window_1_pane_2, 100)
self.main_splitter.SplitVertically(self.window_1_pane_1, self.window_1_pane_2, 10)
def __do_layout(self): # begin wxGlade: graphEditorFrame.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_8 = wx.BoxSizer(wx.VERTICAL) sizer_10 = wx.BoxSizer(wx.VERTICAL) sizer_13 = wx.BoxSizer(wx.HORIZONTAL) ...
self.dataTypeChoice = wxChoice(self.viewFramePanel, -1, choices=["choice 1"])
self.dataTypeChoice = wxChoice(self.viewFramePanel, -1, choices=["Dummy 1", "Dummy 2", "Dummy 3", "Dummy 4", "Dummy 5"])
def __init__(self, *args, **kwds): # begin wxGlade: rawVolumeRDRViewFrame.__init__ kwds["style"] = wxCAPTION|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER wxFrame.__init__(self, *args, **kwds) self.viewFramePanel = wxPanel(self, -1) self.label_1_copy_2 = wxStaticText(self.viewFramePanel, -1, "Filename") s...
sizer_5.Add(sizer_2, 1, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 7)
sizer_5.Add(sizer_2, 1, wxALL|wxEXPAND, 7)
def __do_layout(self): # begin wxGlade: rawVolumeRDRViewFrame.__do_layout sizer_1 = wxBoxSizer(wxVERTICAL) sizer_5 = wxBoxSizer(wxVERTICAL) grid_sizer_1 = wxFlexGridSizer(3, 2, 4, 4) sizer_2 = wxBoxSizer(wxVERTICAL) sizer_7 = wxBoxSizer(wxHORIZONTAL) sizer_3 = wxBoxSizer(wxHORIZONTAL) sizer_6 = wxBoxSizer(wxHORIZONTAL)...
def __init__(self): self.vtk_error_info = vtk_error_info_class() self.vtk_error_info.error = False
def _ensure_vtk_error_info(self): if not hasattr(self, 'vtk_error_info'): self.vtk_error_info = vtk_error_info_class() self.vtk_error_info.error = False
def __init__(self): self.vtk_error_info = vtk_error_info_class() self.vtk_error_info.error = False
def add_error_handler(self, vtk_object): utils.add_error_handler(vtk_object, self.error_func)
def add_vtk_error_handler(self, vtk_object): self._ensure_vtk_error_info() utils.add_error_handler(vtk_object, self._vtk_error_func)
def add_error_handler(self, vtk_object): utils.add_error_handler(vtk_object, self.error_func)
def check_error(self):
def check_vtk_error(self): self._ensure_vtk_error_info()
def check_error(self): if self.vtk_error_info.error: raise RuntimeError(self.vtk_error_info.call_data)
'vtkStructuredPointsGeometryFilter'
'vtkStructuredPointsGeometryFilter', 'vtkDemandDrivenPipeline', 'vtkStreamingDemandDrivenPipeline'
" def __init__(self, moduleManager):\n" \
list1 = [i for i in dir(vtk) if i.startswith('vtk')]
list1 = [i for i in dir(vtk) if i.startswith('vtk') and i not in excludeList]
def main(): list1 = [i for i in dir(vtk) if i.startswith('vtk')] list2 = [] # objects that can be instantiated for vtkobj in list1: try: a = getattr(vtk, vtkobj)() except: # if it can't be instantiated, we can't use it pass else: if a.IsA('vtkProcessObject') and vtkobj not in excludeList: if a.IsA('vtkSource'): # all ...
if a.IsA('vtkProcessObject') and vtkobj not in excludeList:
if a.IsA('vtkProcessObject'):
def main(): list1 = [i for i in dir(vtk) if i.startswith('vtk')] list2 = [] # objects that can be instantiated for vtkobj in list1: try: a = getattr(vtk, vtkobj)() except: # if it can't be instantiated, we can't use it pass else: if a.IsA('vtkProcessObject') and vtkobj not in excludeList: if a.IsA('vtkSource'): # all ...
img_idx = icon_map.values().index(i[2]) if i[0]: text = i[0] + " (" + i[1].GetClassName() + ")" else: text = i[1].GetClassName() ai = tree_ctrl.AppendItem(parent_node, text, img_idx) tree_ctrl.SetPyData(ai, i[1]) recursively_add_children(tree_ctrl, ai)
if not i[1].IsA("vtkRenderWindowInteractor"): img_idx = icon_map.values().index(i[2]) if i[0]: text = i[0] + " (" + i[1].GetClassName() + ")" else: text = i[1].GetClassName() ai = tree_ctrl.AppendItem(parent_node, text, img_idx) tree_ctrl.SetPyData(ai, i[1]) recursively_add_children(tree_ctrl, ai)
def recursively_add_children(tree_ctrl, parent_node): """Utility function to fill out wxTreeCtrl. Pass this function a wxTreeCtrl and _a_ node, and it will fill out everything below it by using Prabhu's code. """ children = get_vtk_objs(tree_ctrl.GetPyData(parent_node)) for i in children: # get_vtk_objs() conveniently...
self.threedFrame.threedRWI.GetRenderWindow().WindowRemap()
self.threedFrame.threedRWI.GetRenderWindow().Finalize() self.threedFrame.threedRWI.SetRenderWindow(None) del self.threedFrame.threedRWI
def close(self): # shut down the orientationWidget/Actor stuff self._orientationWidget.Off() self._orientationWidget.SetInteractor(None) self._orientationWidget.SetOrientationMarker(None) del self._orientationWidget del self._annotatedCubeActor # take care of scalarbar self._showScalarBarForProp(None) # this is stand...
self.SetTitle("frame_2")
self.SetTitle("Ortho View") self.SetSize((480, 433))
def __set_properties(self): # begin wxGlade: orthoViewFrame.__set_properties self.SetTitle("frame_2") self.RWI.SetSize((-1, -1)) # end wxGlade
sizer_4.Fit(self) sizer_4.SetSizeHints(self)
def __do_layout(self): # begin wxGlade: orthoViewFrame.__do_layout sizer_4 = wxBoxSizer(wxVERTICAL) sizer_5 = wxBoxSizer(wxVERTICAL) sizer_5.Add(self.RWI, 1, wxEXPAND, 0) sizer_5.Add(self.button_1, 0, wxALIGN_CENTER_HORIZONTAL, 0) self.panel_2.SetAutoLayout(1) self.panel_2.SetSizer(sizer_5) sizer_5.Fit(self.panel_2) si...
if self._pointsList[idx]['lockToSurface']:
pp = self.slice3dVWR._tdObjects.getPickableProps() if self._pointsList[idx]['lockToSurface'] and pp:
def _observerPointWidgetInteraction(self, pw, evt_name): # we have to find pw in our list pwidgets = map(lambda i: i['pointWidget'], self._pointsList) if pw in pwidgets: idx = pwidgets.index(pw) # toggle the selection for this point in our list self._grid.SelectRow(idx)
pp = self.slice3dVWR._tdObjects.getPickableProps()
picker.SetTolerance(0.005)
def _observerPointWidgetInteraction(self, pw, evt_name): # we have to find pw in our list pwidgets = map(lambda i: i['pointWidget'], self._pointsList) if pw in pwidgets: idx = pwidgets.index(pw) # toggle the selection for this point in our list self._grid.SelectRow(idx)
def findPickedProp(obj): (x,y) = obj.GetEventPosition()
def findPickedProp(obj, onlyTdObjects=False):
def findPickedProp(obj): (x,y) = obj.GetEventPosition() # we use a cell picker, because we don't want the point # to fall through the polygons, if you know what I mean picker = vtk.vtkCellPicker() picker.SetTolerance(0.005) print "%d %d" % (x,y) picker.Pick(x,y,0.0,self._threedRenderer) return (picker.GetActor(), picke...
print "%d %d" % (x,y)
if onlyTdObjects: pp = self._tdObjects.getPickableProps() if not pp: return (None, (0,0,0)) else: for p in pp: picker.AddPickList(p) picker.PickFromListOn() (x,y) = obj.GetEventPosition()
def findPickedProp(obj): (x,y) = obj.GetEventPosition() # we use a cell picker, because we don't want the point # to fall through the polygons, if you know what I mean picker = vtk.vtkCellPicker() picker.SetTolerance(0.005) print "%d %d" % (x,y) picker.Pick(x,y,0.0,self._threedRenderer) return (picker.GetActor(), picke...
actor, pickPosition = findPickedProp(obj)
actor, pickPosition = findPickedProp(obj, True)
def findPickedProp(obj): (x,y) = obj.GetEventPosition() # we use a cell picker, because we don't want the point # to fall through the polygons, if you know what I mean picker = vtk.vtkCellPicker() picker.SetTolerance(0.005) print "%d %d" % (x,y) picker.Pick(x,y,0.0,self._threedRenderer) return (picker.GetActor(), picke...
prop, pointId = findPickedProp(obj)
prop, unusedPickPosition = findPickedProp(obj)
def findPickedProp(obj): (x,y) = obj.GetEventPosition() # we use a cell picker, because we don't want the point # to fall through the polygons, if you know what I mean picker = vtk.vtkCellPicker() picker.SetTolerance(0.005) print "%d %d" % (x,y) picker.Pick(x,y,0.0,self._threedRenderer) return (picker.GetActor(), picke...
print "Main thread: %d" % (wxThread_IsMain(),)
def setProgress(self, progress, message): # 1. we shouldn't call setProgress whilst busy with setProgress # 2. only do something if the message or the progress has changed # 3. we only perform an update if a second or more has passed # since the previous update, unless this is the final # (i.e. 100% update)
def __init__(self, position, numInputs, numOutputs, label, moduleInstance):
def __init__(self, position, numInputs, numOutputs, labelList, moduleInstance):
def __init__(self, position, numInputs, numOutputs, label, moduleInstance): # parent constructor coRectangle.__init__(self, position, (0,0)) # we'll fill this out later self._size = (0,0) self._numInputs = numInputs self.inputLines = [None] * self._numInputs self._numOutputs = numOutputs # be careful with list concaten...
self._label = label
self._labelList = labelList
def __init__(self, position, numInputs, numOutputs, label, moduleInstance): # parent constructor coRectangle.__init__(self, position, (0,0)) # we'll fill this out later self._size = (0,0) self._numInputs = numInputs self.inputLines = [None] * self._numInputs self._numOutputs = numOutputs # be careful with list concaten...
for l in self._label:
for l in self._labelList:
def draw(self, dc): # we're going to alpha blend a purplish sheen if this glyph is active if self.selected: # sheen: 255, 0, 246 # alpha-blend with 192, 192, 192 with alpha 0.5 yields # 224, 96, 219 blockFillColour = wx.wxColour(224, 96, 219) else: blockFillColour = wx.wxColour(192, 192, 192) # default pen and font d...
tey * len(self._label) + 2 * coGlyph._vertBorder)
tey * len(self._labelList) + 2 * coGlyph._vertBorder)
def draw(self, dc): # we're going to alpha blend a purplish sheen if this glyph is active if self.selected: # sheen: 255, 0, 246 # alpha-blend with 192, 192, 192 with alpha 0.5 yields # 224, 96, 219 blockFillColour = wx.wxColour(224, 96, 219) else: blockFillColour = wx.wxColour(192, 192, 192) # default pen and font d...
return self._label
return ' '.join(self._labelList)
def getLabel(self): return self._label
if self._ipws[0]: inputData = self._ipws[0][0].GetInput() else: inputData = None
inputData = self._getPrimaryInput()
def _storeSurfacePoint(self, pointId, actor): polyData = actor.GetMapper().GetInput() if polyData: xyz = polyData.GetPoint(pointId) else: # something really weird went wrong return