rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.createSliceButtonId = wxNewId() | self.createSliceButtonId = wx.NewId() | def __init__(self, *args, **kwds): # begin wxGlade: controlFrame.__init__ kwds["style"] = wx.CAPTION|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.SYSTEM_MENU wx.Frame.__init__(self, *args, **kwds) self.panel_3 = wx.Panel(self, -1) # Menu Bar self.frame_4_menubar = wxMenuBar() self.SetMenuBar(self.frame_4_menubar) self.slicesMen... |
self.sliceStoreButtonId = wxNewId() | self.sliceStoreButtonId = wx.NewId() | def __init__(self, *args, **kwds): # begin wxGlade: controlFrame.__init__ kwds["style"] = wx.CAPTION|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.SYSTEM_MENU wx.Frame.__init__(self, *args, **kwds) self.panel_3 = wx.Panel(self, -1) # Menu Bar self.frame_4_menubar = wxMenuBar() self.SetMenuBar(self.frame_4_menubar) self.slicesMen... |
self.voiEnabledCheckBoxId = wxNewId() | self.voiEnabledCheckBoxId = wx.NewId() | def __init__(self, *args, **kwds): # begin wxGlade: controlFrame.__init__ kwds["style"] = wx.CAPTION|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.SYSTEM_MENU wx.Frame.__init__(self, *args, **kwds) self.panel_3 = wx.Panel(self, -1) # Menu Bar self.frame_4_menubar = wxMenuBar() self.SetMenuBar(self.frame_4_menubar) self.slicesMen... |
self._lookupAppend.SetInput(1, input1) | if self._lookupAppend.GetNumberOfInputPorts() < 2: self._lookupAppend.AddInput(input1) else: self._lookupAppend.SetInput(1, input1) | def checkTypeAndReturnInput(inputStream): """Check type of input. None gets returned. The input is returned if it has a valid type. An exception is thrown if the input is invalid. """ if inputStream == None: # disconnect return None else: # first check the type validType = False try: if inputStream.IsA('vtkImageDa... |
print self._ipws[0] | def set_input(self, idx, input_stream): if input_stream == None: | |
if key >= 65 and key <= 122: | validKeys = range(ord('A'), ord('Z')) + range(ord('a'), ord('z')) + \ range(ord('0'), ord('9')) if key in validKeys: | 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 |
for idx in range( self._graphFrame.modulesListCtrl.GetItemCount()): self._graphFrame.modulesListCtrl.SetItemState( idx, 0, wxLIST_STATE_SELECTED) self._quickSearchString = qss | if qss == '': for idx in range( self._graphFrame.modulesListCtrl.GetItemCount()): self._graphFrame.modulesListCtrl.SetItemState( idx, 0, wxLIST_STATE_SELECTED) self._quickSearchString = qss | 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 |
g = re.search('.*itk__ImageT(.*?)_([0-9]+)_t', itk_img.this).groups() | try: t = itk_img.this except AttributeError, e: g = None else: g = re.search('.*itk__ImageT(.*?)_([0-9]+)_t', itk_img.this).groups() | def get_img_type_and_dim(itk_img): # g will be e.g. ('float', '3') or ('unsigned_char', '2') # note that we use the NON-greedy version so it doesn't break # on vectors g = re.search('.*itk__ImageT(.*?)_([0-9]+)_t', itk_img.this).groups() if not g: raise TypeError, 'This method requires an ITK Image as input.' # see ... |
if not module_spec.startswith('module:'): | if module_spec is None or not module_spec.startswith('module:'): | def show_module_help(self, module_spec): """module_spec is e.g. module:full.module.name """ |
def doBuilds(): | def doBuilds(itkRequested): | def doBuilds(): standardBuild(defaults.vtkdevideBinary, 'vtkdevide.sln') standardBuild(defaults.vtktudBinary, 'vtktud.sln') if itkRequested: standardBuild(defaults.wrapitkBinary, 'wrapitk.sln') |
self._renameModule(module, glyph, newModuleName) | if newModuleName: self._renameModule(module, glyph, newModuleName) | def _handlerRenameModule(self, module, glyph): newModuleName = wx.GetTextFromUser( 'Enter a new name for this module.', 'Rename Module', self._devide_app.getModuleManager().get_instance_name(module)) |
self._devideApp.logError( | self._devide_app.logError( genUtils.exceptionToMsgs() + | def createModule(self, fullName, instanceName=None): """Try and create module fullName. |
castString, numString = typeD.split(':')[1:].split(',') | castString, numString = typeD.split(':')[1].split(',') | 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... |
sname = "" | sname = None | def setInput(self, idx, input_stream): if input_stream == None: |
if sname.lower().find("curvature") >= 0: | if sname and sname.lower().find("curvature") >= 0: | def setInput(self, idx, input_stream): if input_stream == None: |
('&Delete', 'Delete selected slices', | ('&Delete', 'Delete selected points', | def _appendGridCommandsToMenu(self, menu, eventWidget, disable=True): """Appends the points grid commands to a menu. This can be used to build up the context menu or the drop-down one. """ |
mModule.syncModuleViewWithLogic() | mModule.syncViewWithLogic() | def syncModuleViewWithLogic(self, instance): """Interface method that can be used by clients to transfer config information from the underlying module logic (model) to the view. """ |
def get_app_dir(self): return self.getAppDir() def getAppDir(self): return self._devide_app.getAppDir() | def get_appdir(self): return self._devide_app.get_appdir() getAppDir = get_appdir | def get_app_dir(self): return self.getAppDir() |
t = t.replace('\r\n', '\n') t = t.replace('\r', '') | t = sanitise_text(t) | def _open_python_file(self, parent_window): fd = wx.FileDialog( parent_window, 'Select file to open into current edit', wildcard='*.py', style=wx.OPEN) |
text = text.replace('\r\n', '\n') text = text.replace('\r', '\n') | text = sanitise_text(text) | def _run_source(self, text): """Compile and run the source given in text in the shell interpreter's local namespace. |
"", "", "*.vti", wx.OPEN) | "", "", "*.vti", wx.SAVE) | def _handlerVoiFilenameBrowseButton(self, event): dlg = wx.FileDialog(self.controlFrame, "Select VTI filename to write VOI to", "", "", "*.vti", wx.OPEN) if dlg.ShowModal() == wx.ID_OK: self.controlFrame.voiFilenameText.SetValue(dlg.GetPath()) |
module instance. | specified renwin and objects. | def vtk_pipeline_configure(self, parent, renwin, objects=None): """This will instantiate and show only one pipeline config per module instance. |
if not hasattr(self, '_pipeline') or self._pipeline == None: self._pipeline = vtkPipelineBrowser(parent, renwin, objects) self._pipeline.show() | if not hasattr(self, '_vtk_pipeline_cfs'): self._vtk_pipeline_cfs = {} this_key = (renwin,) if objects: this_key = this_key + objects if not self._vtk_pipeline_cfs.has_key(this_key): self._vtk_pipeline_cfs[this_key] = vtkPipelineBrowser( parent, renwin, objects) self._vtk_pipeline_cfs[this_key].show() | def vtk_pipeline_configure(self, parent, renwin, objects=None): """This will instantiate and show only one pipeline config per module instance. |
if hasattr(self, '_pipeline'): self._pipeline.close() self._pipeline = None | if hasattr(self, '_vtk_pipeline_cfs'): for key in self._vtk_pipeline_cfs: self._vtk_pipeline_cfs[key].close() self._vtk_pipeline_cfs.clear() | def close_pipeline_configure(self): """Explicitly close() the pipeline browser of this module. |
self._vtk_error = False | def __init__(self, moduleManager, vtkObjectBinding, progressText, inputDescriptions, outputDescriptions, replaceDoc=True, inputFunctions=None, outputFunctions=None): | |
def _vtk_error_handler(self, vtk_object, event_name, call_data): self._vtk_error = True self._vtk_error_call_data = call_data | def _vtk_error_handler(self, vtk_object, event_name, call_data): self._vtk_error = True self._vtk_error_call_data = call_data | |
exec('self._theFilter.SetInput%d(inputStream)' % (idx+1,)) | self._theFilter.SetInput(idx, inputStream) | def setInput(self, idx, inputStream): # this will only be called for a certain idx if you've specified that # many elements in your getInputDescriptions |
self._run_source(self._src_setup, self._view_frame.shell_window) | self._run_source(self._src_setup) | def executeModule(self): # we only attempt running setup_src if its md5 is different from # that of the previous setup_src that we attempted to run hd = md5.md5(self._src_setup).hexdigest if hd != self._md5_setup_src: self._md5_setup_src = hd self._run_source(self._src_setup, self._view_frame.shell_window) self._run_s... |
self._inputPoints = None self._inputPointsOID = None | def __init__(self, moduleManager): # initialise our base class moduleBase.__init__(self, moduleManager) # initialise any mixins we might have noConfigModuleMixin.__init__(self) | |
return ('vtkPolyData',) | return ('vtkPolyData', 'Watershed minima') | def getInputDescriptions(self): |
self._tf.SetInput(inputStream) | if idx == 0: self._tf.SetInput(inputStream) else: if inputStream is not self._inputPoints: if self._inputPoints: self._inputPoints.removeObserver(self._inputPointsOID) if inputStream: self._inputPointsOID = inputStream.addObserver( self._inputPointsObserver) self._inputPoints = inputStream self._inputPointsObserver... | def setInput(self, idx, inputStream): self._tf.SetInput(inputStream) |
pd = self._curvatures.GetOutput() | def executeModule(self): if self._tf.GetInput(): self._curvatures.Update() | |
fbb.SetValue(str(self.get_set_var[i])) | def make_get_set_gui (self, parent): | |
print "imported: " + str(id(sys.modules[fullName])) | def createModule(self, fullName, instanceName=None): """Try and create module fullName. fullName is the complete module spec below application directory, e.g. modules.Readers.hdfRDR. """ | |
self._rws.append(wxVTKRenderWindow(o0_panel, -1)) | self._rws.append(wxVTKRenderWindowSlice(o0_panel, -1)) | def _create_window(self): # create main frame, make sure that when it's closed, it merely hides parent_window = self._module_manager.get_module_view_parent_window() self._view_frame = wxFrame(parent=parent_window, id=-1, title='slice viewer') EVT_CLOSE(self._view_frame, lambda e, s=self: s._view_frame.Show(false)) |
self._rws.append(wxVTKRenderWindow(o1_panel, -1)) | self._rws.append(wxVTKRenderWindowSlice(o1_panel, -1)) | def _create_window(self): # create main frame, make sure that when it's closed, it merely hides parent_window = self._module_manager.get_module_view_parent_window() self._view_frame = wxFrame(parent=parent_window, id=-1, title='slice viewer') EVT_CLOSE(self._view_frame, lambda e, s=self: s._view_frame.Show(false)) |
self._rws.append(wxVTKRenderWindow(o2_panel, -1)) | self._rws.append(wxVTKRenderWindowSlice(o2_panel, -1)) | def _create_window(self): # create main frame, make sure that when it's closed, it merely hides parent_window = self._module_manager.get_module_view_parent_window() self._view_frame = wxFrame(parent=parent_window, id=-1, title='slice viewer') EVT_CLOSE(self._view_frame, lambda e, s=self: s._view_frame.Show(false)) |
icam.SetPosition(cur_pipe['vtkPlaneSourceO'].GetCenter()[0], cur_pipe['vtkPlaneSourceO'].GetCenter()[1], 10); icam.SetFocalPoint(cur_pipe['vtkPlaneSourceO'].GetCenter()); | def setup_camera(self, cur_pipe, renderer): | |
icam.SetViewUp(0,1,0); | def setup_camera(self, cur_pipe, renderer): | |
rsz = renderer.GetRenderWindow().GetSize() icam.SetParallelScale(rsz[0] / 2.0) | we = cur_pipe['vtkImageReslice'].GetOutput().GetWholeExtent() icam.SetParallelScale((we[1] - we[0]) / 2.0) | def setup_camera(self, cur_pipe, renderer): |
isi = vtk.vtkInteractorStyleImage() rwi = self._renderers[i+1].GetRenderWindowInteractor() rwi.SetInteractorStyle(isi) | def set_input(self, idx, input_stream): if input_stream == None: | |
for objectName in objectDict.keys(): | self._viewFrame.objectChoice.Clear() for objectName in objectDict.keys(): | def _createViewFrame(self, frameTitle, browseMsg="Select a filename", fileWildcard= "VTK data (*.vtk)|*.vtk|All files (*)|*", objectDict={}): |
Remember to call the __init__ of this class (and setting _vtkObjectNames) as well as close(). If you override logicToConfig and configToLogic, | Remember to call the __init__ of this class (and to set _vtkObjectNames) as well as close(). Also call logicToConfig() as the last call of your __init__ to initialise the _config to the initial state of the logic. If you override logicToConfig and configToLogic, | def viewToConfig(self): pass |
get_m = 'G'+meths[0][1:end] | get_m = 'G'+stateGroup[0][1:end] | def logicToConfig(self): parser = VtkMethodParser() |
"in self._config OR in self. Skipping." | "in self._config OR in self. Skipping." % (vtkObjName,) | def configToLogic(self): # go through at least the attributes in self._vtkObjectNames |
getMethod = 'G'+meths[0][1:end] | getMethod = 'G'+stateGroup[0][1:end] | def configToLogic(self): # go through at least the attributes in self._vtkObjectNames |
self.logicToConfig() | def __init__(self, moduleManager, vtkObjectBinding, progressText, inputDescriptions, outputDescriptions, replaceDoc=True, inputFunctions=None): moduleBase.__init__(self, moduleManager) noConfigModuleMixin.__init__(self) pickleVTKObjectsModuleMixin.__init__(self) | |
(newModule.__class__.__name__, e) | (new_instance.__class__.__name__, e) | def _reload_module(self, module_instance, glyph): """Reload a module by storing all configuration information, deleting the module, and then recreating and reconnecting it. |
sizer_19.Add(sizer_13, 0, wxALL|wxEXPAND, 4) sizer_19.Add(self.objectsListGrid, 1, wxEXPAND, 4) | sizer_19.Add(sizer_13, 0, wxALL, 4) sizer_19.Add(self.objectsListGrid, 0, 0, 4) | def __do_layout(self): # begin wxGlade: controlFrame.__do_layout sizer_16 = wxBoxSizer(wxVERTICAL) sizer_3 = wxBoxSizer(wxVERTICAL) sizer_20 = wxStaticBoxSizer(wxStaticBox(self.panel_3, -1, "Miscellaneous"), wxVERTICAL) sizer_21 = wxBoxSizer(wxHORIZONTAL) sizer_19 = wxStaticBoxSizer(wxStaticBox(self.panel_3, -1, "Objec... |
sizer_11.Add(self.button_1, 0, wxALL|wxEXPAND, 7) | sizer_11.Add(self.button_1, 0, wxALL, 7) | def __do_layout(self): # begin wxGlade: controlFrame.__do_layout sizer_6 = wxBoxSizer(wxVERTICAL) sizer_9 = wxBoxSizer(wxVERTICAL) sizer_14 = wxBoxSizer(wxVERTICAL) sizer_11 = wxStaticBoxSizer(wxStaticBox(self.panel_4, -1, "Animation"), wxVERTICAL) sizer_12_copy = wxBoxSizer(wxHORIZONTAL) sizer_11.Add(self.button_1, 0,... |
sizer_14.Add(sizer_11, 1, 0, 0) | sizer_14.Add(sizer_11, 1, wxEXPAND, 0) | def __do_layout(self): # begin wxGlade: controlFrame.__do_layout sizer_6 = wxBoxSizer(wxVERTICAL) sizer_9 = wxBoxSizer(wxVERTICAL) sizer_14 = wxBoxSizer(wxVERTICAL) sizer_11 = wxStaticBoxSizer(wxStaticBox(self.panel_4, -1, "Animation"), wxVERTICAL) sizer_12_copy = wxBoxSizer(wxHORIZONTAL) sizer_11.Add(self.button_1, 0,... |
'2D Transform Stack file (*.2ts)|*.dts|All files (*)|*', | '2D Transform Stack file (*.2ts)|*.2ts|All files (*)|*', | def __init__(self, moduleManager): |
prevFlipY = -1 | prevFlipy = -1 | def pf1Execute(self): inputData = self._pf1.GetStructuredPointsInput() outputData = self._pf1.GetOutput() |
prevFlipY = y | prevFlipy = y | def pf1Execute(self): inputData = self._pf1.GetStructuredPointsInput() outputData = self._pf1.GetOutput() |
print "Fixing noFlip" if prevFlipY >= 0: for y in xrange(prevFlipY, ydim + 1): val = inputData.GetScalarComponentAsDouble(x,y,z,0) outputData.SetScalarComponentFromDouble( x,y,z,0,-val) | self._noFlipXes[z][x] = prevFlipy elif x - 1 in self._noFlipXes[z]: self._noFlipXes[z][x-1] = prevFlipy | def pf1Execute(self): inputData = self._pf1.GetStructuredPointsInput() outputData = self._pf1.GetOutput() |
if val > 0: | if val > 0 and x not in self._noFlipXes[z]: | def pf1Execute(self): inputData = self._pf1.GetStructuredPointsInput() outputData = self._pf1.GetOutput() |
for xf,yf in self._noFlipXes[z].items(): for y in xrange(yf, ydim + 1): val = inputData.GetScalarComponentAsDouble(xf,y,z,0) outputData.SetScalarComponentFromDouble(xf,y,z,0,-val) | def pf2Execute(self): """Mask unwanted surface out with negative numbers. I'm evil. """ inputData = self._pf2.GetStructuredPointsInput() outputData = self._pf2.GetOutput() | |
print 'checking for transfer' | def executeModules(self, schedulerModules): """Execute the modules in schedulerModules in topological order. | |
if w not in self.search_dict: self.search_dict[w.lower()] = {(index_name, field_name) : 1} | wl = w.lower() if wl not in self.search_dict: self.search_dict[wl] = {(index_name, field_name) : 1} | def index_field(index_name, mi_class, field_name, split=False): try: field = getattr(mi_class, field_name) except AttributeError: pass else: if split: iter_list = field.split() else: iter_list = field for w in iter_list: if w not in self.search_dict: self.search_dict[w.lower()] = {(index_name, field_name) : 1} else: ... |
self.search_dict[w.lower()][(index_name, field_name)] = 1 | self.search_dict[wl][(index_name, field_name)] = 1 | def index_field(index_name, mi_class, field_name, split=False): try: field = getattr(mi_class, field_name) except AttributeError: pass else: if split: iter_list = field.split() else: iter_list = field for w in iter_list: if w not in self.search_dict: self.search_dict[w.lower()] = {(index_name, field_name) : 1} else: ... |
endFreeMemory = wxGetFreeMemory() print "%d %d" % (beginFreeMemory, endFreeMemory) print "Deleted %s, %.2fM freed." % \ (instance.__class__.__name__, (endFreeMemory - beginFreeMemory) / 1024.0 / 1024.0) | def deleteModule(self, instance): # first disconnect all outgoing connections inputs = self._moduleDict[instance].inputs outputs = self._moduleDict[instance].outputs | |
self._cachedInputs = [None] * len(self._inputs) | self._cachedInputs = [-1] * len(self._inputs) | def __init__(self, moduleManager): # call base constructor moduleBase.__init__(self, moduleManager) colourDialogMixin.__init__( self, moduleManager.get_module_view_parent_window()) self._numDataInputs = 7 # use list comprehension to create list keeping track of inputs self._inputs = [{'Connected' : None, 'inputData' : ... |
self._cachedInputs[idx] = None | self._cachedInputs[idx] = -1 | 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... |
try: self.setInput(idx, None) if self.setInput(idx, self._cachedInputs[idx]): | if self._cachedInputs[idx] == None: try: self.setInput(idx, None) except Exception, e: genUtils.logError( 'Error disconnecting input %d of slice3dVWR ' \ '%s:%s. ' % \ (idx, self._moduleManager.getInstanceName(self), str(e))) elif self._cachedInputs[idx] != -1: try: self.setInput(idx, None) except Exception, e: g... | 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: if self.setInput(idx, self._cachedInputs[idx]): | except Exception, e: | 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... |
else: genUtils.logError( 'Error disconnecting input %d of slice3dVWR ' \ '%s:%s. ' % \ (idx, self._moduleManager.getInstanceName(self), str(e))) | 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... | |
self._cachedInputs[idx] = None | self._cachedInputs[idx] = -1 | 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... |
if 'axisPoints' not in self._tdObjectsDict[tdObject]: | objectDict = self._tdObjectsDict[tdObject] if 'axisPoints' not in objectDict: | def _axisToSlice(self, tdObject, sliceDirection): """If tdObject has an axis, make the axis lie in the plane defined by sliceDirection. """ |
motionSwitched = False if self.getObjectMotion(tdObject): self._setObjectMotion(tdObject, False) motionSwitched = True | def _axisToSlice(self, tdObject, sliceDirection): """If tdObject has an axis, make the axis lie in the plane defined by sliceDirection. """ | |
axisLineActor = self._tdObjectsDict[tdObject]['axisLineActor'] axisPoints = self._tdObjectsDict[tdObject]['axisPoints'] | axisLineActor = objectDict['axisLineActor'] axisPoints = objectDict['axisPoints'] | def _axisToSlice(self, tdObject, sliceDirection): """If tdObject has an axis, make the axis lie in the plane defined by sliceDirection. """ |
twoPoints.append(axisMatrix.MultiplyPoint(axisPoints[0] + (1,))) twoPoints.append(axisMatrix.MultiplyPoint(axisPoints[1] + (1,))) | twoPoints.append(axisMatrix.MultiplyPoint(axisPoints[0] + (1,))[0:3]) twoPoints.append(axisMatrix.MultiplyPoint(axisPoints[1] + (1,))[0:3]) | def _axisToSlice(self, tdObject, sliceDirection): """If tdObject has an axis, make the axis lie in the plane defined by sliceDirection. """ |
theProp = self.findPropByObject(tdObject) | def _axisToSlice(self, tdObject, sliceDirection): """If tdObject has an axis, make the axis lie in the plane defined by sliceDirection. """ | |
objectDict['vtkActor'].GetMatrix()) for prop in (objectDict['vtkActor'], objectDict['axisActor']): | theProp.GetMatrix()) for prop in (theProp, objectDict['axisLineActor']): | def _axisToSlice(self, tdObject, sliceDirection): """If tdObject has an axis, make the axis lie in the plane defined by sliceDirection. """ |
self._detachAxis(sObject) self._attachAxis(sObject, worldPoints[0:2]) | canChange = True if 'axisPoints' in self._tdObjectsDict[sObject]: oName = self._tdObjectsDict[sObject]['objectName'] md = wx.MessageDialog( self.slice3dVWR.controlFrame, "Are you sure you want to CHANGE the axis on object " "%s?" % (oName,), "Confirm axis change", wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION) if md.S... | def _handlerObjectAttachAxis(self, event): """The user should have selected at least two points and an object. This will record the axis formed by the two selected points as the object axis. If no points are selected, and an axis already exists, we detach the axis. """ |
ir.SetOutputOrigin((0,0,0)) | def _pw_cb(self, pw, ortho_idx): origin = 3 * [0] point1 = 3 * [0] point2 = 3 * [0] normal = 3 * [0] pw.GetOrigin(origin) pw.GetPoint1(point1) pw.GetPoint2(point2) pw.GetNormal(normal) | |
self._update_3d_plane2(self._ortho_pipes[ortho_idx][0], pw) | ps = self._ortho_pipes[ortho_idx][0]['vtkPlaneSource3'] self._sync_3d_plane_with_reslice(ps, ir) | def _pw_cb(self, pw, ortho_idx): origin = 3 * [0] point1 = 3 * [0] point2 = 3 * [0] normal = 3 * [0] pw.GetOrigin(origin) pw.GetPoint1(point1) pw.GetPoint2(point2) pw.GetNormal(normal) |
def _update_3d_plane2(self, cur_pipe, pw): reslice = cur_pipe['vtkImageReslice'] | def _sync_3d_plane_with_reslice(self, plane_source, reslice): """Modify 3d slice plane source to agree with reslice output. If you've made changes to the reslicer, call this method to make sure the 3d slice plane source follows suit. """ | def _update_3d_plane2(self, cur_pipe, pw): reslice = cur_pipe['vtkImageReslice'] reslice.Update() |
cur_pipe['vtkPlaneSource3'].SetOrigin(origin) cur_pipe['vtkPlaneSource3'].SetPoint1(p1v) cur_pipe['vtkPlaneSource3'].SetPoint2(p2v) | plane_source.SetOrigin(origin) plane_source.SetPoint1(p1v) plane_source.SetPoint2(p2v) print origin print reslice.GetResliceAxes().MultiplyPoint(origin + (1.0,)) | def _update_3d_plane2(self, cur_pipe, pw): reslice = cur_pipe['vtkImageReslice'] reslice.Update() |
def _update_3d_plane(self, cur_pipe, output_z=0): """Move texture-mapper 3d plane source so that it corresponds to the passed output z coord. Given the ortho pipeline corresponding to a certain layer on a certain input, this will perform the necessary changes so that the plane is placed, scaled and oriented correctly ... | def _update_3d_plane(self, cur_pipe, output_z=0): """Move texture-mapper 3d plane source so that it corresponds to the passed output z coord. | |
self._update_3d_plane(overlay_pipe, 0) | self._sync_3d_plane_with_reslice(overlay_pipe['vtkPlaneSource3'], overlay_pipe['vtkImageReslice']) | def _reset_ortho_overlay(self, ortho_idx, overlay_pipe): """Arrange everything for a single overlay in a single ortho view. |
reslice.Update() output_bounds = reslice.GetOutput().GetBounds() origin = reslice.GetResliceAxesOrigin() p1mag = output_bounds[1] - output_bounds[0] p2mag = output_bounds[3] - output_bounds[2] radc = reslice.GetResliceAxesDirectionCosines() p1vn = radc[0:3] p1v = map(lambda x, o, m=p1mag: x*m + o, p1vn, origin) p2vn = ... | self._sync_pw_with_reslice(self._pws[ortho_idx], reslice) | def _reset_ortho_overlay(self, ortho_idx, overlay_pipe): """Arrange everything for a single overlay in a single ortho view. |
if o_ra_origin[2] < zmin: o_ra_origin[2] = zmin elif o_ra_origin[2] > zmax: o_ra_origin[2] = zmax | def _rw_slice_cb(self, wxvtkrwi): delta = wxvtkrwi.GetEventPosition()[1] - \ wxvtkrwi.GetLastEventPosition()[1] | |
self._update_3d_plane(layer_pl, o_ra_origin[2]) | def _rw_slice_cb(self, wxvtkrwi): delta = wxvtkrwi.GetEventPosition()[1] - \ wxvtkrwi.GetLastEventPosition()[1] | |
self._devideApp._mainFrame, id=-1, | self._interface.get_main_window(), id=-1, | def _helpModule(self, moduleInstance): |
try: if w.IsShown(): w.Restore() except AttributeError: pass except wx.PyAssertionError: if w.IsShown(): p = w.GetPosition() w.Hide() w.Show() w.SetPosition(p) | try: if w.IsShown() and w.IsIconized(): try: w.Restore() except wx.PyAssertionError: p = w.GetPosition() w.Hide() w.Show() w.SetPosition(p) except AttributeError: pass | def _windowRestoreAllChildren(self): children = self._mainFrame.GetChildren() |
class noConfigModuleMixin(vtkPipelineConfigModuleMixin): | class noConfigModuleMixin(introspectModuleMixin): | def setColourDialogColour(self, normalisedRGBTuple): """This is the default colour we'll begin with. """ |
vtkPipelineConfigModuleMixin.close(self) | introspectModuleMixin.close(self) | def close(self): vtkPipelineConfigModuleMixin.close(self) self._viewFrame.Destroy() del self._viewFrame |
'text', 'Weight factor for the curvature term')] | 'text', 'Weight factor for the curvature term'), ('Number of iterations:', 'numberOfIterations', 'base:int', 'text', 'Number of iterations that the algorithm should be run for')] | def __init__(self, moduleManager): |
return self._thresholder.GetOutput() | return self._nbcLS.GetOutput() | def getOutput(self, idx): return self._thresholder.GetOutput() |
thresholder = itk.itkBinaryThresholdImageFilterF3US3_New() thresholder.SetLowerThreshold( -65535.0 ); thresholder.SetUpperThreshold( 0.0 ); thresholder.SetOutsideValue( 0 ); thresholder.SetInsideValue( 65535 ); thresholder.SetInput(self._nbcLS.GetOutput() ); self._thresholder = thresholder moduleUtilsITK.setupITKObjec... | def _createITKPipeline(self): # input: smoothing.SetInput() # output: thresholder.GetOutput() | |
del self._thresholder | def _destroyITKPipeline(self): """Delete all bindings to components of the ITK pipeline. """ | |
wx.SAVE) | wx.SAVE, parent=self.threedFrame) | def _handlerSaveImageButton(self, event): # first get the filename filename = wx.FileSelector( "Choose filename for PNG image", "", "", "png", "PNG files (*.png)|*.png|All files (*.*)|*.*", wx.SAVE) if filename: self._save3DToImage(filename) |
if not i[1].IsA("vtkRenderWindowInteractor"): | if not i[1].IsA("vtkRenderWindowInteractor") and \ not i[1].IsA("vtkExecutive"): | 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: if not i[1].IsA("vtkRenderWi... |
module. | module. Whatever is returned by this object MUST have an Update() method. However you choose to implement it, the Update() should make sure that the whole chain of logic resulting in the data object has executed so that the data object is up to date. | def get_output(self, idx): |
input_stream.Update() | def setInput(self, idx, input_stream): if input_stream == None: | |
if self._rubberBandCoords: self._drawRubberBand(event, endRubberBand=True) allGlyphs = self._graphFrame.canvas.getObjectsOfClass( wxpc.coGlyph) glyphsInRubberBand = [] for glyph in allGlyphs: if glyph.isInsideRect(self._rubberBandCoords[0], self._rubberBandCoords[1], self._rubberBandCoords[2], self._rubberBandCoord... | self._stopRubberBanding(event) | def _canvasButtonUp(self, canvas, eventName, event, userData): if event.LeftUp(): # whatever the case may be, rubberBanding stops if self._rubberBandCoords: # delete the rubberBand (rubberBandCoords should remain intact) self._drawRubberBand(event, endRubberBand=True) |
def _stopRubberBanding(self, event): if self._rubberBandCoords: self._drawRubberBand(event, endRubberBand=True) allGlyphs = self._graphFrame.canvas.getObjectsOfClass( wxpc.coGlyph) glyphsInRubberBand = [] for glyph in allGlyphs: if glyph.isInsideRect(self._rubberBandCoords[0], self._rubberBandCoords[1], self._rubb... | def _deleteModule(self, glyph, refreshCanvas=True): try: # FIRST remove it from any selections; we have to do this # while everything is still more or less active self._glyphSelection.removeGlyph(glyph) # first we disconnect all consumers consumerList = [] for lines in glyph.outputLines: for line in lines: consumerLis... | |
dropSource = wxDropSource(self._modulePaletteFrame) | dropSource = wxDropSource(self._modulePaletteFrame.modulesListBox) | def _handlerModulesListBoxMouseEvents(self, event): if not event.Dragging(): # if no dragging is taking place, let somebody else # handle this event... event.Skip() return mlb = self._modulePaletteFrame.modulesListBox |
dropSource.DoDragDrop(TRUE) | dropSource.DoDragDrop(False) | def _handlerModulesListBoxMouseEvents(self, event): if not event.Dragging(): # if no dragging is taking place, let somebody else # handle this event... event.Skip() return mlb = self._modulePaletteFrame.modulesListBox |
event.Skip() | def _handlerModulesListBoxMouseEvents(self, event): if not event.Dragging(): # if no dragging is taking place, let somebody else # handle this event... event.Skip() return mlb = self._modulePaletteFrame.modulesListBox |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.