rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.kNNOptimization.setStatusBarText("Evaluated %d projections..." % (self.triedPossibilities))
self.kNNOptimization.setStatusBarText("Evaluated %s projections..." % (createStringFromNumber(self.triedPossibilities)))
def getOptimalSeparation(self, attributes, minLength, maxLength, addResultFunct): dataSize = len(self.rawdata) self.triedPossibilities = 0
self.kNNOptimization.setStatusBarText("Finished evaluation (evaluated %d projections in %d min, %d sec)" % (self.triedPossibilities, secs/60, secs%60))
self.kNNOptimization.setStatusBarText("Finished evaluation (evaluated %s projections in %d min, %d sec)" % (createStringFromNumber(self.triedPossibilities), secs/60, secs%60))
def getOptimalSeparation(self, attributes, minLength, maxLength, addResultFunct): dataSize = len(self.rawdata) self.triedPossibilities = 0
for (val, attr) in attributes:
for (attrIndex, (val, attr)) in enumerate(attributes):
def optimizeGivenProjection(self, projection, accuracy, attributes, addResultFunct): dataSize = len(self.rawdata) classIndex = self.attributeNameIndex[self.rawdata.domain.classVar.name] self.triedPossibilities = 0
sum_i = self._getSum_i(Numeric.compress(validData, Numeric.take(self.noJitteringScaledData, projections[0])))
def optimizeGivenProjection(self, projection, accuracy, attributes, addResultFunct): dataSize = len(self.rawdata) classIndex = self.attributeNameIndex[self.rawdata.domain.classVar.name] self.triedPossibilities = 0
tempList = []
def optimizeGivenProjection(self, projection, accuracy, attributes, addResultFunct): dataSize = len(self.rawdata) classIndex = self.attributeNameIndex[self.rawdata.domain.classVar.name] self.triedPossibilities = 0
table = self.createProjectionAsExampleTable(testProj, validData, classList, sum_i, XAnchors, YAnchors, domain)
table = self.createProjectionAsExampleTable(testProj, validData, classList, None, XAnchors, YAnchors, domain)
def optimizeGivenProjection(self, projection, accuracy, attributes, addResultFunct): dataSize = len(self.rawdata) classIndex = self.attributeNameIndex[self.rawdata.domain.classVar.name] self.triedPossibilities = 0
elif min(acc, accuracy)/max(acc, accuracy) > 0.98: addResultFunct(acc, other_results, lenTable, [self.attributeNames[i] for i in attrList], 1)
def optimizeGivenProjection(self, projection, accuracy, attributes, addResultFunct): dataSize = len(self.rawdata) classIndex = self.attributeNameIndex[self.rawdata.domain.classVar.name] self.triedPossibilities = 0
self.kNNOptimization.setStatusBarText("Evaluated %d projections. All are worse. Best accuracy was: %2.2f%%" % (len(projections), acc)) del validData, classList, sum_i, projections
self.kNNOptimization.setStatusBarText("Evaluated %s projections (attribute %s/%s). Last accuracy was: %2.2f%%" % (createStringFromNumber(self.triedPossibilities), createStringFromNumber(attrIndex), strTotalAtts, acc)) if min(acc, accuracy)/max(acc, accuracy) > 0.98: addResultFunct(acc, other_results, lenTable, [self.at...
def optimizeGivenProjection(self, projection, accuracy, attributes, addResultFunct): dataSize = len(self.rawdata) classIndex = self.attributeNameIndex[self.rawdata.domain.classVar.name] self.triedPossibilities = 0
self.clusterOptimization.setStatusBarText("Evaluation stopped (evaluated %d projections in %d min, %d sec)" % (self.triedPossibilities, secs/60, secs%60))
self.clusterOptimization.setStatusBarText("Evaluation stopped (evaluated %s projections in %d min, %d sec)" % (createStringFromNumber(self.triedPossibilities), secs/60, secs%60))
def getOptimalClusters(self, attributes, minLength, maxLength, addResultFunct): dataSize = len(self.rawdata) self.triedPossibilities = 0
self.clusterOptimization.setStatusBarText("Evaluated %d projections..." % (self.triedPossibilities))
self.clusterOptimization.setStatusBarText("Evaluated %s projections..." % (createStringFromNumber(self.triedPossibilities)))
def getOptimalClusters(self, attributes, minLength, maxLength, addResultFunct): dataSize = len(self.rawdata) self.triedPossibilities = 0
self.clusterOptimization.setStatusBarText("Finished evaluation (evaluated %d projections in %d min, %d sec)" % (self.triedPossibilities, secs/60, secs%60))
self.clusterOptimization.setStatusBarText("Finished evaluation (evaluated %s projections in %d min, %d sec)" % (createStringFromNumber(self.triedPossibilities), secs/60, secs%60))
def getOptimalClusters(self, attributes, minLength, maxLength, addResultFunct): dataSize = len(self.rawdata) self.triedPossibilities = 0
b = widgetBox(widget, box, orientation=None) wa = QCheckBox(text, b) wa.setChecked(getattr(master, value)) if disabled: wa.setDisabled(1) master.connect(wa, SIGNAL("toggled(bool)"), ValueCallback(master, value)) master.controledAttributes.append((value, CallFront_checkBox(wa))) if tooltip: QToolTip.add(wa, tooltip) if ...
b = widgetBox(widget, box, orientation=None) wa = QCheckBox(text, b) wa.setChecked(getattr(master, value)) if disabled: wa.setDisabled(1) master.connect(wa, SIGNAL("toggled(bool)"), ValueCallback(master, value)) master.controledAttributes.append((value, CallFront_checkBox(wa))) if tooltip: QToolTip.add(wa, tooltip) if ...
def checkBox(widget, master, value, text, box=None, tooltip=None, callback=None, getwidget=None, id=None, disabled=0): b = widgetBox(widget, box, orientation=None) wa = QCheckBox(text, b) wa.setChecked(getattr(master, value)) if disabled: wa.setDisabled(1) master.connect(wa, SIGNAL("toggled(bool)"), ValueCallback(maste...
hb = QHBox(widget) wa = QCheckBox(text, hb) wa.setChecked(getattr(master, checked)) wb = QSpinBox(min, max, step, hb) wb.setValue(getattr(master, value)) if posttext <> None: QLabel(posttext, hb) master.connect(wa, SIGNAL("toggled(bool)"), ValueCallback(master, checked)) master.connect(wb, SIGNAL("valueChanged(int)")...
hb = QHBox(widget) wa = QCheckBox(text, hb) wa.setChecked(getattr(master, checked)) wb = QSpinBox(min, max, step, hb) wb.setValue(getattr(master, value)) if posttext <> None: QLabel(posttext, hb) master.connect(wa, SIGNAL("toggled(bool)"), ValueCallback(master, checked)) master.connect(wb, SIGNAL("valueChanged(int)")...
def checkWithSpin(widget, master, text, min, max, checked, value, posttext = None, step = 1, tooltip=None, checkCallback=None, spinCallback=None, getwidget=None): hb = QHBox(widget) wa = QCheckBox(text, hb) wa.setChecked(getattr(master, checked)) wb = QSpinBox(min, max, step, hb) wb.setValue(getattr(master, value)) if ...
if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = QHBox(widget) slider = QSlider(minValue, maxValue, step, getattr(master, value), QSlider.Horizontal, sliderBox) if ticks: slider.setTickmarks(QSlider.Below) slider.setTickInterval(ticks) label = QLabel(sliderBox) label.setText(labelFormat % minValue) widt...
if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = QHBox(widget) slider = QSlider(minValue, maxValue, step, getattr(master, value), QSlider.Horizontal, sliderBox) if ticks: slider.setTickmarks(QSlider.Below) slider.setTickInterval(ticks) label = QLabel(sliderBox) label.setText(labelFormat % minValue) widt...
def hSlider(widget, master, value, box=None, minValue=0.0, maxValue=1.0, step=0.1, callback=None, labelFormat="%d", ticks=0): if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = QHBox(widget) slider = QSlider(minValue, maxValue, step, getattr(master, value), QSlider.Horizontal, sliderBox) if ticks: slider....
init = getattr(master, value) if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = widget hb = QHBox(sliderBox) if label: lbl = QLabel(label, hb) if labelWidth: lbl.setFixedSize(labelWidth, lbl.sizeHint().height()) if ticks: slider = qwt.QwtSlider(hb, "", Qt.Horizontal, qwt.QwtSlider.Bottom, qwt.QwtSlider....
init = getattr(master, value) if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = widget hb = QHBox(sliderBox) if label: lbl = QLabel(label, hb) if labelWidth: lbl.setFixedSize(labelWidth, lbl.sizeHint().height()) if ticks: slider = qwt.QwtSlider(hb, "", Qt.Horizontal, qwt.QwtSlider.Bottom, qwt.QwtSlider....
def qwtHSlider(widget, master, value, box=None, label=None, labelWidth=None, minValue=1, maxValue=10, step=0.1, precision=1, callback=None, logarithmic=0, ticks=0, maxWidth=80): init = getattr(master, value) if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = widget hb = QHBox(sliderBox) if label: lbl = Q...
def __init__(self, widget, attribute, f = None): self.widget = widget self.attribute = attribute self.f = f widget.callbackDeposit.append(self) def __call__(self, value): print value if isinstance(value, QString): value = str(value) setattr(self.widget, self.attribute, self.f and self.f(value) or value)
def __init__(self, widget, attribute, f = None): self.widget = widget self.attribute = attribute self.f = f widget.callbackDeposit.append(self) def __call__(self, value): if isinstance(value, QString): value = str(value) try: if self.f: setattr(self.widget, self.attribute, self.f(value)) else: setattr(self.widget,...
def __init__(self, widget, attribute, f = None): self.widget = widget self.attribute = attribute self.f = f widget.callbackDeposit.append(self)
def __init__(self, control): self.control = control def __call__(self, value): self.control.setValue(value)
def __init__(self, control): self.control = control def __call__(self, value): self.control.setValue(value) class CallFront_lineEdit: def __init__(self, control): self.control = control def __call__(self, value): self.control.setText(str(value))
def __init__(self, control): self.control = control
print "Storing %d to storage area %d" % (result_value, result_addr)
print ">> $%d = %d" % (result_addr, result_value)
def _write_result(self, result_value): """Write the given result value to the stack or to a local/global variable, depending on the result_addr.""" result_addr = self._opdecoder.get_store_address()
cond, offset = self._opdecoder.get_branch_offset() self._opdecoder.program_counter += (offset - 2)
def op_jump(self, *args): """"""
text_key = self._stringfactory.get(self._memory[addr])
text_key = self._stringfactory.get(addr)
def get_dictionary(self, address): """Load a z-machine-format dictionary at ADDRESS -- which maps zstrings to bytestrings -- into a python dictionary which maps ascii strings to the address of the word in the original dictionary. Return the new dictionary."""
return ZString(self._mem.version, self,
return ZString(self._mem, self,
def to_ascii(self, addr): return ZString(self._mem.version, self, ZStringStream(self._mem, addr))
def __init__(self, version, factory, stream):
def __init__(self, mem, factory, stream): self._mem = mem self._factory = factory self._stream = stream
def __init__(self, version, factory, stream): # Start on alphabet 0 self._cur_alph = 0 self._prev_alph = 0
if version == 1:
if self._mem.version == 1:
def __init__(self, version, factory, stream): # Start on alphabet 0 self._cur_alph = 0 self._prev_alph = 0
elif version == 2:
elif self._mem.version == 2:
def __init__(self, version, factory, stream): # Start on alphabet 0 self._cur_alph = 0 self._prev_alph = 0
print ''.join(self._ascii)
self._end = stream._addr def val(self): return ''.join(self._ascii)
def __init__(self, version, factory, stream): # Start on alphabet 0 self._cur_alph = 0 self._prev_alph = 0
self._static_start = self.get_word_value(self._memory[0x0e])
self._static_start = self.get_word_value(0x0e)
def __init__(self, initial_string): """Construct class based on a string that represents an initial 'snapshot' of main memory.""" if initial_string is None: raise ZMemoryBadInitialization
self._high_start = self.get_word_value(self._memory[0x04])
self._high_start = self.get_word_value(0x04)
def __init__(self, initial_string): """Construct class based on a string that represents an initial 'snapshot' of main memory.""" if initial_string is None: raise ZMemoryBadInitialization
def op_jz(self, *args): """"""
def op_jz(self, val): """Branch if the val is zero.""" self._branch(val == 0)
def op_jz(self, *args): """"""
print chunk
def _get_block(self): from bitfield import BitField chunk = self._mem[self._addr:self._addr+2] print chunk self._data = BitField(''.join([chr(x) for x in chunk])) self._addr += 2 self._char_in_block = 0
offset = self._char_in_block * 5 print offset
offset = (2 - self._char_in_block) * 5
def get(self, num=1): if self._has_ended: raise ZStringEndOfString
self._write_result(sum(args) % (2**16-1))
self._write_result(sum(args) % 65536)
def op_add(self, *args): """Signed 16-bit addition.""" self._write_result(sum(args) % (2**16-1))
declare_opcode_set(op_jz, 0x80, 2, 0x10)
declare_opcode_set(op_jz, 0x80, 3, 0x10)
def op_jz(self, val): """Branch if the val is zero.""" self._branch(val == 0)
declare_opcode_set(op_get_sibling, 0x81, 2, 0x10)
declare_opcode_set(op_get_sibling, 0x81, 3, 0x10)
def op_get_sibling(self, *args): """"""
declare_opcode_set(op_get_child, 0x82, 2, 0x10)
declare_opcode_set(op_get_child, 0x82, 3, 0x10)
def op_get_child(self, *args): """"""
declare_opcode_set(op_get_parent, 0x83, 2, 0x10)
declare_opcode_set(op_get_parent, 0x83, 3, 0x10)
def op_get_parent(self, *args): """"""
declare_opcode_set(op_get_prop_len, 0x84, 2, 0x10)
declare_opcode_set(op_get_prop_len, 0x84, 3, 0x10)
def op_get_prop_len(self, *args): """"""
declare_opcode_set(op_inc, 0x85, 2, 0x10)
declare_opcode_set(op_inc, 0x85, 3, 0x10)
def op_inc(self, *args): """"""
declare_opcode_set(op_dec, 0x86, 2, 0x10)
declare_opcode_set(op_dec, 0x86, 3, 0x10)
def op_dec(self, *args): """"""
declare_opcode_set(op_print_addr, 0x87, 2, 0x10)
declare_opcode_set(op_print_addr, 0x87, 3, 0x10)
def op_print_addr(self, *args): """"""
declare_opcode_set(op_call_1s, 0x88, 2, 0x10, version=(4,5))
declare_opcode_set(op_call_1s, 0x88, 3, 0x10, version=(4,5))
def op_call_1s(self, *args): """"""
declare_opcode_set(op_remove_obj, 0x89, 2, 0x10)
declare_opcode_set(op_remove_obj, 0x89, 3, 0x10)
def op_remove_obj(self, *args): """"""
declare_opcode_set(op_print_obj, 0x8A, 2, 0x10)
declare_opcode_set(op_print_obj, 0x8A, 3, 0x10)
def op_print_obj(self, *args): """"""
declare_opcode_set(op_ret, 0x8B, 2, 0x10)
declare_opcode_set(op_ret, 0x8B, 3, 0x10)
def op_ret(self, *args): """"""
declare_opcode_set(op_jump, 0x8C, 2, 0x10)
declare_opcode_set(op_jump, 0x8C, 3, 0x10)
def op_jump(self, *args): """Jump unconditionally to the given branch offset. This opcode does not follow the usual branch decision algorithm, and so we do not call the _branch method to dispatch the call.""" cond, offset = self._opdecoder.get_branch_offset() self._opdecoder.program_counter += (offset - 2)
declare_opcode_set(op_print_paddr, 0x8D, 2, 0x10)
declare_opcode_set(op_print_paddr, 0x8D, 3, 0x10)
def op_print_paddr(self, *args): """"""
declare_opcode_set(op_load, 0x8E, 2, 0x10)
declare_opcode_set(op_load, 0x8E, 3, 0x10)
def op_load(self, *args): """"""
declare_opcode_set(op_not, 0x8F, 2, 0x10, version=(1,2,3,4))
declare_opcode_set(op_not, 0x8F, 3, 0x10, version=(1,2,3,4))
def op_not(self, *args): """"""
declare_opcode_set(op_call_1n, 0x8F, 2, 0x10, version=(5,))
declare_opcode_set(op_call_1n, 0x8F, 3, 0x10, version=(5,))
def op_call_1n(self, *args): """"""
actionDict = {'vti' : ('modules.Readers.vtiRDR', 'filename'), 'vtp' : ('modules.Readers.vtpRDR', 'filename'), 'mha' : ('modules.Readers.metaImageRDR', 'filename'), 'mhd' : ('modules.Readers.metaImageRDR', 'filename'), 'stl' : ('modules.Readers.stlRDR', 'filename')}
actionDict = {'vti' : ('modules.readers.vtiRDR', 'filename'), 'vtp' : ('modules.readers.vtpRDR', 'filename'), 'mha' : ('modules.readers.metaImageRDR', 'filename'), 'mhd' : ('modules.readers.metaImageRDR', 'filename'), 'stl' : ('modules.readers.stlRDR', 'filename')}
def createModuleOneVar(moduleName, configVarName, configVarValue, newModuleName=None): """This method creates a moduleName (e.g. modules.Readers.vtiRDR) at position x,y. It then sets the 'configVarName' attribute to value configVarValue. """ (mod, glyph) = self.createModuleAndGlyph(x, y, moduleName) if mod: cfg = mod....
'modules.Readers.vtkStructPtsRDR',
'modules.readers.vtkStructPtsRDR',
def createModuleOneVar(moduleName, configVarName, configVarValue, newModuleName=None): """This method creates a moduleName (e.g. modules.Readers.vtiRDR) at position x,y. It then sets the 'configVarName' attribute to value configVarValue. """ (mod, glyph) = self.createModuleAndGlyph(x, y, moduleName) if mod: cfg = mod....
'modules.Readers.vtkPolyDataRDR',
'modules.readers.vtkPolyDataRDR',
def createModuleOneVar(moduleName, configVarName, configVarValue, newModuleName=None): """This method creates a moduleName (e.g. modules.Readers.vtiRDR) at position x,y. It then sets the 'configVarName' attribute to value configVarValue. """ (mod, glyph) = self.createModuleAndGlyph(x, y, moduleName) if mod: cfg = mod....
'modules.Readers.dicomRDR')
'modules.readers.dicomRDR')
def createModuleOneVar(moduleName, configVarName, configVarValue, newModuleName=None): """This method creates a moduleName (e.g. modules.Readers.vtiRDR) at position x,y. It then sets the 'configVarName' attribute to value configVarValue. """ (mod, glyph) = self.createModuleAndGlyph(x, y, moduleName) if mod: cfg = mod....
widget = MaskedTextCtrl(panel, -1, '',
widget = wx.lib.masked.TextCtrl(panel, -1, '',
def _createViewFrame(self, objectDict=None): parentWindow = self._moduleManager.getModuleViewParentWindow()
w.Iconize()
if w.IsShown() and not w.IsIconized(): try: w.Iconize() except wx.PyAssertionError: pass
def _windowIconizeAllChildren(self): children = self._mainFrame.GetChildren()
except wx.PyAssertionError: pass
def _windowIconizeAllChildren(self): children = self._mainFrame.GetChildren()
self._interface.log_warning(
self._graphEditor._interface.log_warning(
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(...
self._testObject0 = vtk.vtkTriangleFilter() self._testObject0b = vtk.vtkWindowedSincPolyDataFilter() self._testObject0b.SetNumberOfIterations(20) self._testObject0b.SetInput(self._testObject0.GetOutput()) self._testObject1 = vtk.vtkCurvatures() self._testObject1.SetCurvatureTypeToMean() self._testObject1.SetInput(self....
self._triangleFilter = vtk.vtkTriangleFilter() self._curvatures = vtk.vtkCurvatures() self._curvatures.SetCurvatureTypeToMean() self._curvatures.SetInput(self._triangleFilter.GetOutput())
def __init__(self, moduleManager): # initialise our base class moduleBase.__init__(self, moduleManager) # initialise any mixins we might have noConfigModuleMixin.__init__(self)
self._testObject1.SetProgressText('doing stuff...') mm = self._moduleManager self._testObject1.SetProgressMethod(lambda s=self, mm=mm: mm.vtk_progress_cb( s._testObject1)) self._viewFrame = self._createViewFrame('Test Module View', {'testObject1' : self._testObject1})
moduleUtils.setupVTKObjectProgress(self, self._triangleFilter, 'Triangle filtering...') moduleUtils.setupVTKObjectProgress(self, self._curvatures, 'Calculating curvatures...') self._viewFrame = self._createViewFrame({'triangleFilter' : self._triangleFilter, 'curvatures' : self._curvatures})
def __init__(self, moduleManager): # initialise our base class moduleBase.__init__(self, moduleManager) # initialise any mixins we might have noConfigModuleMixin.__init__(self)
del self._testObject1
del self._triangleFilter del self._curvatures
def close(self): # we play it safe... (the graph_editor/module_manager should have # disconnected us by now) for inputIdx in range(len(self.getInputDescriptions())): self.setInput(inputIdx, None) # don't forget to call the close() method of the vtkPipeline mixin noConfigModuleMixin.close(self) # get rid of our referenc...
self._testObject0.SetInput(inputStream)
self._triangleFilter.SetInput(inputStream)
def setInput(self, idx, inputStream): self._testObject0.SetInput(inputStream)
return (self._testObject1.GetOutput().GetClassName(),)
return (self._curvatures.GetOutput().GetClassName(),)
def getOutputDescriptions(self): return (self._testObject1.GetOutput().GetClassName(),)
return self._testObject1.GetOutput()
return self._curvatures.GetOutput()
def getOutput(self, idx): return self._testObject1.GetOutput()
print "hello alex" self._testObject1.Update()
self._curvatures.Update()
def executeModule(self): print "hello alex" self._testObject1.Update()
cfg = mod.getConfig() cfg.dicomFilenames.extend(dcmFilenames) mod.setConfig(cfg)
try: cfg = mod.getConfig() cfg.dicomFilenames.extend(dcmFilenames) mod.setConfig(cfg) except Exception, e: dropFilenameErrors.append( ('DCM files', 'Error loading DICOM files: %s.' % (str(e),)))
def createModuleOneVar(moduleName, configVarName, configVarValue, newModuleName=None): """This method creates a moduleName (e.g. modules.Readers.vtiRDR) at position x,y. It then sets the 'configVarName' attribute to value configVarValue. """ (mod, glyph) = self.createModuleAndGlyph(x, y, moduleName) if mod: cfg = mod....
self._config.filename = '' self.configToLogic()
def __init__(self, moduleManager): # call the base class __init__ (atm it just stores module_manager) moduleBase.__init__(self, moduleManager) # ctor for this specific mixin filenameViewModuleMixin.__init__(self)
self._graphFrame.canvas.SetVirtualSize((1024, 1024))
self._graphFrame.canvas.SetVirtualSize((2048, 2048))
def __init__(self, dscas3_app): # initialise vars self._dscas3_app = dscas3_app
self._loadAndRealiseNetwork(itemText[len(segp):], (x,y),
rx, ry = self._graphFrame.canvas.eventToRealCoords(x, y) self._loadAndRealiseNetwork(itemText[len(segp):], (rx,ry),
def canvasDropText(self, x, y, itemText): """itemText is a complete module or segment spec, e.g. module:modules.Readers.dicomRDR or segment:/home/cpbotha/work/code/dscas3/networkSegments/blaat.d3n """
for ip,i in zip(self._inputPoints, range(len(self._inputPoints))):
for ip,nodePos in zip(self._inputPoints, range(len(self._inputPoints))):
def _transferPoints(self): """This will transfer all points from self._inputPoints to the _fastMarching object. """
seeds.InsertElement(i, node)
seeds.InsertElement(nodePos, node) print "Added %d,%d,%d at %d" % (x,y,z,nodePos)
def _transferPoints(self): """This will transfer all points from self._inputPoints to the _fastMarching object. """
print "Added %d,%d,%d" % (x,y,z)
def _transferPoints(self): """This will transfer all points from self._inputPoints to the _fastMarching object. """
self._shape_canvas.CaptureMouse()
if WX_USE_X_CAPTURE: self._shape_canvas.CaptureMouse()
def inout_begindragleft_cb(self, parent_glyph, io_shape, x, y, keys, attachment): if io_shape.get_inout() == 0: # user is beginning a connection self.draw_preview_line(io_shape, x, y) else: # if there is a line connected to this input, the user # might be removing or repositioning if len(io_shape.GetLines()) > 0: # by ...
self._shape_canvas.ReleaseMouse()
if WX_USE_X_CAPTURE: self._shape_canvas.ReleaseMouse()
def inout_enddragleft_cb(self, parent_glyph, io_shape, x, y, keys, attachment): # give the mouse back ASAP, else people get angry, he he self._shape_canvas.ReleaseMouse()
self.implicitTypeChoice = wxChoice(self.notebook_1_pane_2, -1, choices=["choice 1"])
self.implicitTypeChoice = wxChoice(self.notebook_1_pane_2, -1, choices=["choice 1", "choice 2", "choice 3", "choice 4"])
def __init__(self, *args, **kwds): # begin wxGlade: controlFrame.__init__ kwds["style"] = wxCAPTION|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU wxFrame.__init__(self, *args, **kwds) self.panel_3 = wxPanel(self, -1) self.notebook_1 = wxNotebook(self.panel_3, -1, style=0) self.notebook_1_pane_2 = wxPanel(self.notebook_1,...
self.implicitBoundsChoice = wxChoice(self.notebook_1_pane_2, -1, choices=["choice 1"])
self.implicitBoundsChoice = wxChoice(self.notebook_1_pane_2, -1, choices=["choice 1", "choice 2", "choice 3", "choice 4"])
def __init__(self, *args, **kwds): # begin wxGlade: controlFrame.__init__ kwds["style"] = wxCAPTION|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU wxFrame.__init__(self, *args, **kwds) self.panel_3 = wxPanel(self, -1) self.notebook_1 = wxNotebook(self.panel_3, -1, style=0) self.notebook_1_pane_2 = wxPanel(self.notebook_1,...
self.objectChoice = wxChoice(self.panel_1, self.objectChoiceId , choices=["vtkImageThreshold"])
self.objectChoice = wxChoice(self.panel_1, self.objectChoiceId , choices=["vtkImageReader"])
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.panel_1 = wxPanel(self, -1) self.label_1 = wxStaticText(self.panel_1, -1, "Filename") self.filenameText = wx...
cew.SetText(f.read())
t = f.read() t = t.replace('\r\n', '\n') t = t.replace('\r', '') cew.SetText(t)
def _handler_file_open(self, evt): fd = wx.FileDialog( self._view_frame, 'Select file to open into current edit', wildcard='*.py', style=wx.OPEN)
_devideApp._graphEditor._canvasFrame.canvas.redraw()
_devideApp._graphEditor._graphEditorFrame.canvas.redraw()
def setUp(self): # call parent setUp method graphEditorTestBase.setUp(self)
_devideApp._graphEditor._canvasFrame.IsShown() and _devideApp._graphEditor._modulePaletteFrame.IsShown())
_devideApp._graphEditor._graphEditorFrame.IsShown())
def testStartup(self): """graphEditor startup. """ self.failUnless( _devideApp._graphEditor._canvasFrame.IsShown() and _devideApp._graphEditor._modulePaletteFrame.IsShown())
_devideApp._graphEditor._canvasFrame.canvas.redraw()
_devideApp._graphEditor._graphEditorFrame.canvas.redraw()
def testSimpleNetwork(self): """Creation and connection of superQuadric source and slice3dVWR. """
class testCoreModules(graphEditorTestBase):
class testModulesMisc(graphEditorTestBase):
def testVTI(self): """Testing basic readers/writers. """ self.failUnless(1 == 1)
coreModulesList = [] for mn in modules.moduleList: if _devideApp.mainConfig.useInsight or \ not mn.startswith('Insight'): coreModulesList.append('modules.%s' % (mn,)) for coreModuleName in coreModulesList:
modulesList = [] mm = _devideApp.get_module_manager() for module_name in mm.getAvailableModules().keys(): print 'About to create %s.' % (module_name,)
def testCreateDestroy(self): """See if we can create and destroy all core modules. """
10, 10, coreModuleName) _devideApp.setProgress(100, 'Created %s.' % (coreModuleName,))
10, 10, module_name) print 'Created %s.' % (module_name,)
def testCreateDestroy(self): """See if we can create and destroy all core modules. """
_devideApp.setProgress(100, 'Destroyed %s.' % (coreModuleName,))
print 'Destroyed %s.' % (module_name,)
def testCreateDestroy(self): """See if we can create and destroy all core modules. """
_devideApp._graphEditor._canvasFrame.canvas.redraw()
_devideApp._graphEditor._graphEditorFrame.canvas.redraw()
def testConfidenceSeedConnect(self): """Test confidenceSeedConnect and VTK<->ITK interconnect. """
self.moduleSuite.addTest(testCoreModules('testCreateDestroy'))
self.moduleSuite.addTest(testModulesMisc('testCreateDestroy'))
def __init__(self, devideApp): global _devideApp _devideApp = devideApp
if _devideApp.mainConfig.useInsight: suiteList.append(self.itkSuite)
def __init__(self, devideApp): global _devideApp _devideApp = devideApp
print "blaat" print moduleBase print "blaat 2"
def view(self, parent_window=None): # if the frame is already visible, bring it to the top; this makes # it easier for the user to associate a frame with a glyph if not self._viewFrame.Show(True): self._viewFrame.Raise()
"Choose a VTK polydata filename", "VTK Polydata (*.vtk)|*.vtk|All files (*)|*")
"Choose an STL filename", "STL data (*.stl)|*.stl|All files (*)|*")
def fn_browse_cb(self, event): path = self.fn_browse(self._view_frame, "Choose a VTK polydata filename", "VTK Polydata (*.vtk)|*.vtk|All files (*)|*")
if choice.GetStringSelection() == 'vtkPolyDataReader':
if choice.GetStringSelection() == 'vtkSTLReader':
def vtk_object_choice_cb(self, event): choice = XMLCTRL(self._view_frame,'MV_ID_VTK_OBJECT_CHOICE') if choice != None: if choice.GetStringSelection() == 'vtkPolyDataReader': self.vtk_object_configure(self._view_frame, None, self._reader)
eval ("self._vtk_obj.%s (\"%s\")"%(m, val))
eval ("self._vtk_obj.%s (r\"%s\")"%(m, val))
def apply_changes (self, event=None):
returnFloat = float(eval(text))
returnFloat = float(text)
def textToFloat(text, defaultFloat): """Converts text to a float by using an eval and returns the float. If something goes wrong, returns defaultFloat. """ try: returnFloat = float(eval(text)) except Exception: returnFloat = defaultFloat return returnFloat
returnInt = int(eval(text))
returnInt = int(text)
def textToInt(text, defaultInt): """Converts text to an integer by using an eval and returns the integer. If something goes wrong, returns default Int. """ try: returnInt = int(eval(text)) except Exception: returnInt = defaultInt return returnInt
str(self._config.numberOfIterations))
"%d" % (self._config.numberOfIterations,))
def configToView(self): self._viewFrame.smoothingIterationsText.SetValue( str(self._config.numberOfIterations)) self._viewFrame.passBandText.SetValue( str(self._config.passBand)) self._viewFrame.featureEdgeSmoothingCheckBox.SetValue( bool(self._config.featureEdgeSmoothing)) self._viewFrame.boundarySmoothingCheckBox.Set...
str(self._config.passBand))
"%.2f" % (self._config.passBand,))
def configToView(self): self._viewFrame.smoothingIterationsText.SetValue( str(self._config.numberOfIterations)) self._viewFrame.passBandText.SetValue( str(self._config.passBand)) self._viewFrame.featureEdgeSmoothingCheckBox.SetValue( bool(self._config.featureEdgeSmoothing)) self._viewFrame.boundarySmoothingCheckBox.Set...
self.showControlsButtonId = wxNewId()
self.showControlsButtonId = wx.NewId()
def __init__(self, *args, **kwds): # begin wxGlade: threedFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.showControlsButtonId = wxNewId() self.button_2 = wx.Button(self.panel_1, self.showControlsButtonId , "Show Controls") self.reset...
self.resetCameraButtonId = wxNewId()
self.resetCameraButtonId = wx.NewId()
def __init__(self, *args, **kwds): # begin wxGlade: threedFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.showControlsButtonId = wxNewId() self.button_2 = wx.Button(self.panel_1, self.showControlsButtonId , "Show Controls") self.reset...
self.resetAllButtonId = wxNewId()
self.resetAllButtonId = wx.NewId()
def __init__(self, *args, **kwds): # begin wxGlade: threedFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.showControlsButtonId = wxNewId() self.button_2 = wx.Button(self.panel_1, self.showControlsButtonId , "Show Controls") self.reset...
self.introspectPipelineButtonId = wxNewId()
self.introspectPipelineButtonId = wx.NewId()
def __init__(self, *args, **kwds): # begin wxGlade: threedFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.showControlsButtonId = wxNewId() self.button_2 = wx.Button(self.panel_1, self.showControlsButtonId , "Show Controls") self.reset...
self.projectionChoiceId = wxNewId()
self.projectionChoiceId = wx.NewId()
def __init__(self, *args, **kwds): # begin wxGlade: threedFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.showControlsButtonId = wxNewId() self.button_2 = wx.Button(self.panel_1, self.showControlsButtonId , "Show Controls") self.reset...
self.closeButtonId = wxNewId()
self.closeButtonId = wx.NewId()
def __init__(self, *args, **kwds): # begin wxGlade: orthoViewFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_2 = wx.Panel(self, -1) self.RWI = wxVTKRenderWindowInteractor(self.panel_2, -1) self.closeButtonId = wxNewId() self.button_1 = wx.Button(self.panel_2, se...