本文整理汇总了Python中pyqtgraph.flowchart.library.registerNodeType函数的典型用法代码示例。如果您正苦于以下问题:Python registerNodeType函数的具体用法?Python registerNodeType怎么用?Python registerNodeType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerNodeType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: addColorTransform
def addColorTransform(f,name):
node = numpyInNumpyOutNode(
nodeName=name,
uiTemplate=[],
f=f,
)
fclib.registerNodeType(node,[('Image-ColorSpace',)])
开发者ID:DerThorsten,项目名称:ivigraph,代码行数:7,代码来源:vigra_pixel_wise.py
示例2: __init__
def __init__(self, parent=None):
super(Demo, self).__init__()
self.setWindowTitle("Plotting the Wiimote")
self.showFullScreen()
self.layout = QtGui.QGridLayout()
self.setLayout(self.layout)
self.flowchart = Flowchart(terminals={
'xDataIn': {'io': 'in'},
'yDataIn': {'io': 'in'},
'zDataIn': {'io': 'in'},
'xDataOut': {'io': 'out'},
'yDataOut': {'io': 'out'},
'zDataOut': {'io': 'out'}
})
self.layout.addWidget(self.flowchart.widget(), 0, 0, 3, 1)
fclib.registerNodeType(WiimoteNode, [('Display',)])
self.wii_node = self.flowchart.createNode('Wiimote', pos=(0, 0))
self.axes = ['x', 'y', 'z']
# positions for all nodes; order:
# raw_node xpos, raw_node ypos, filtered_node xpos, filtered_node ypos,
# filter_node xpos, filter_node ypos
self.positions = {
'x': [-450, -350, -300, -350, -375, -150],
'y': [-150, -350, 0, -350, -75, -150],
'z': [150, -350, 300, -350, 225, -150],
}
# create, style, config and connect the elements for every axis
for axis in self.axes:
index = self.axes.index(axis)
plot_raw = pyqtgraph.PlotWidget()
plot_filtered = pyqtgraph.PlotWidget()
# add widget for this axis in next row
self.layout.addWidget(plot_filtered, index, 2, 1, 2)
self.configPlotItems(axis, plot_raw, plot_filtered)
self.createNodes(axis, plot_raw, plot_filtered)
self.connectNodes(axis)
pyqtgraph.setConfigOptions(antialias=True)
self.flowchart.setInput(xDataIn=0)
self.flowchart.setInput(yDataIn=0)
self.flowchart.setInput(zDataIn=0)
开发者ID:CrazyCrud,项目名称:interactiondesign-python,代码行数:55,代码来源:analyze.py
示例3: execute
def execute(self, *args,**kwargs):
inputList = []
# iterate over all terminals in ordere they where added
for termName in self.terminals.keys():
term = self.terminals[termName]
if termName in self._inputs:
inputData = kwargs[termName]
if inputData is not None:
inputList.append(inputData)
return {'dataOut':inputList}
fclib.registerNodeType(MakeList, [('Container',)])
class MakeTuple(MyNode):
""" make a tuple from input(s) """
nodeName = "MakeTuple"
uiTemplate=[
]
def __init__(self, name):
terminals = OrderedDict()
terminals['Input']=dict(io='in')
terminals['dataOut']=dict(io='out')
MyNode.__init__(self, name, terminals=terminals,nodeSize=(100,150),allowAddInput=True)
开发者ID:DerThorsten,项目名称:ivigraph,代码行数:29,代码来源:make_container.py
示例4: dict
'z_rotation_out': dict(io='out')
}
CtrlNode.__init__(self, node_name, terminals=terminals)
def process(self, **kwds):
out = [kwds['x_axis_in'] - 512, kwds['z_axis_in'] - 512]
return {
'x_rotation_out': np.array([0, out[0]]),
'z_rotation_out': np.array([0, out[1]])
}
fclib.registerNodeType(CustomNormalVectorNode, [('NVN',)])
def input_from_cmd():
"""
checks if cmd args are exactly 2 in number
:return: void
"""
if len(sys.argv) != 2:
raise Exception("Insufficient number of CMD Args! Mac Address Required")
def add_plot_widget_to_layout(layout, offset, columns):
"""
开发者ID:KiKiWuWu,项目名称:ITT,代码行数:31,代码来源:analyze.py
示例5: Flowchart
fc = Flowchart(terminals={
#'sigOut': {'io': 'in'},
#'sigOut2': {'io': 'in'}#,
#'sigIn': {'io': 'out'} #We don't currently need any outputs from FC
}, name='Connections')
# Remove the unnecessary input and output nodes
fc.removeNode(fc.inputNode)
fc.removeNode(fc.outputNode)
flowchart = fc.widget()
d3.addWidget(flowchart)
flowchart_dock.addWidget(fc.widget().chartWidget)
#Register own node types
fclib.registerNodeType(OscilloscopeNode, [('SciEdu',)])
fclib.registerNodeType(FilterNode, [('SciEdu',)])
fclib.registerNodeType(CharToBinaryNode, [('SciEdu',)])
# fclib.registerNodeType(BinaryToCharNode, [('SciEdu',)]) # TODO
fclib.registerNodeType(ParityNode, [('SciEdu',)])
fclib.registerNodeType(CheckParityNode, [('SciEdu',)])
fclib.registerNodeType(FFTNode, [('SciEdu',)])
fclib.registerNodeType(SigGenNode, [('SciEdu',)])
fclib.registerNodeType(AmplifierNode, [('SciEdu',)])
fclib.registerNodeType(LineEncoderNode, [('SciEdu',)])
fclib.registerNodeType(RectifierNode, [('SciEdu',)])
fclib.registerNodeType(DCBlockNode, [('SciEdu',)])
fclib.registerNodeType(DigiAdderNode, [('SciEdu',)])
fclib.registerNodeType(NoiseNode, [('SciEdu',)])
# Test thread generation (Not in use now)
开发者ID:adikele,项目名称:SciEdu-Nodes-Simulator,代码行数:31,代码来源:sciedu.py
示例6: process
self.view = view
def process(self, data, display=True):
## if process is called with display=False, then the flowchart is being operated
## in batch processing mode, so we should skip displaying to improve performance.
if display and self.view is not None:
## the 'data' argument is the value given to the 'data' terminal
if data is None:
self.view.setImage(np.zeros((1,1))) # give a blank array to clear the view
else:
self.view.setImage(data)
## register the class so it will appear in the menu of node types.
## It will appear in the 'display' sub-menu.
fclib.registerNodeType(ImageViewNode, [('Display',)])
## We will define an unsharp masking filter node as a subclass of CtrlNode.
## CtrlNode is just a convenience class that automatically creates its
## control widget based on a simple data structure.
class UnsharpMaskNode(CtrlNode):
"""Return the input data passed through scipy.ndimage.gaussian_filter."""
nodeName = "UnsharpMask"
uiTemplate = [
('sigma', 'spin', {'value': 1.0, 'step': 1.0, 'range': [0.0, None]}),
('strength', 'spin', {'value': 1.0, 'dec': True, 'step': 0.5, 'minStep': 0.01, 'range': [0.0, None]}),
]
def __init__(self, name):
## Define the input / output terminals available on this node
terminals = {
'dataIn': dict(io='in'), # each terminal needs at least a name and
开发者ID:3rdcycle,项目名称:pyqtgraph,代码行数:31,代码来源:FlowchartCustomNode.py
示例7: ctrlWidget
def ctrlWidget(self):
if self.ui is None:
self.ui = ComboBox()
self.ui.currentIndexChanged.connect(self.plotSelected)
self.updateUi()
return self.ui
def plotSelected(self, index):
self.setPlot(self.ui.value())
def setPlotList(self, plots):
"""
Specify the set of plots (ImageView) that the user may
select from.
*plots* must be a dictionary of {name: plot} pairs.
"""
self.plots = plots
self.updateUi()
def updateUi(self):
# sets list and automatically preserves previous selection
self.ui.setItems(self.plots)
try:
self.ui.setValue(self.plots)
except ValueError:
pass
fclib.registerNodeType(ImagePlotNode, [('Display',)])
开发者ID:elleryrussell,项目名称:caffeViz,代码行数:29,代码来源:DisplayNodes.py
示例8: set_update_rate
self.connect_button.setText("disconnect")
self.set_update_rate(self.update_rate_input.value())
def set_update_rate(self, rate):
if rate == 0: # use callbacks for max. update rate
self.wiimote.accelerometer.register_callback(self.update_accel)
self.update_timer.stop()
else:
self.wiimote.accelerometer.unregister_callback(self.update_accel)
self.update_timer.start(1000.0/rate)
def process(self, **kwdargs):
x,y,z = self._acc_vals
return {'accelX': np.array([x]), 'accelY': np.array([y]), 'accelZ': np.array([z])}
fclib.registerNodeType(WiimoteNode, [('Sensor',)])
###############################################################################################################
class BufferNode(CtrlNode):
"""
Buffers the last n samples provided on input and provides them as a list of
length n on output.
A spinbox widget allows for setting the size of the buffer.
Default size is 32 samples.
"""
nodeName = "Buffer"
uiTemplate = [
('size', 'spin', {'value': 100.0, 'step': 1.0, 'range': [0.0, 128.0]}),
]
def __init__(self, name):
开发者ID:freakimkaefig,项目名称:itt_lamm_lechler,代码行数:31,代码来源:wiimote_node_noise.py
示例9: numpyInNumpyOutNode
ew = vigra.filters.tensorEigenvalues(tensor)
if sortEigenValues :
ew = np.sort(ew,axis=2)
if eigenvalue<=1:
return ew[:,:,eigenvalue]
else :
return ew
node = numpyInNumpyOutNode(
nodeName="BoundaryTensor",
uiTemplate=[('scale', 'spin', {'value': 1.50, 'step': 0.25, 'range': [0.01, None]})],
f=vigra.filters.boundaryTensor2D,
doChannelWise=True,
tensor=True
)
fclib.registerNodeType(node,[('Image-Tensors',)])
node = numpyInNumpyOutNode(
nodeName="StructureTensor",
uiTemplate=[
('innerScale', 'spin', {'value': 1.50, 'step': 0.25, 'range': [0.01, None]}),
('outerScale', 'spin', {'value': 2.50, 'step': 0.25, 'range': [0.01, None]}),
],
f=vigra.filters.structureTensor,
doChannelWise=True,
tensor=True
)
fclib.registerNodeType(node,[('Image-Tensors',)])
node = numpyInNumpyOutNode(
开发者ID:DerThorsten,项目名称:ivigraph,代码行数:31,代码来源:vigra_tensors.py
示例10: _brightness
########################################################
def _brightness(image,factor):
return vigra.colors.brightness(image,factor=float(factor),range='auto')
def _contrast(image,factor):
return vigra.colors.contrast(image,factor=float(factor),range='auto')
def _gammaCorrection(image,gamma):
return vigra.colors.gammaCorrection(image,gamma=float(gamma),range='auto')
node = vigraNode(
nodeName="Brightness",
uiTemplate=[ ('factor', 'spin', {'value': 1.00, 'step': 0.20, 'range': [0.10, None]}) ],
f=_brightness,
)
fclib.registerNodeType(node,[('Image-Color/Intensity',)])
node = vigraNode(
nodeName="Contrast",
uiTemplate=[ ('factor', 'spin', {'value': 1.00, 'step': 0.20, 'range': [0.10, None]}) ],
f=_contrast,
)
fclib.registerNodeType(node,[('Image-Color/Intensity',)])
node = vigraNode(
nodeName="GammaCorrection",
uiTemplate=[ ('gamma', 'spin', {'value': 1.00, 'step': 0.20, 'range': [0.10, None]}) ],
f=_gammaCorrection,
)
fclib.registerNodeType(node,[('Image-Color/Intensity',)])
开发者ID:hanslovsky,项目名称:ivigraph,代码行数:30,代码来源:operators.py
示例11: raw_input
raw_input("Press the 'sync' button on the back of your Wiimote Plus " +
"or buttons (1) and (2) on your classic Wiimote.\n" +
"Press <return> once the Wiimote's LEDs start blinking.")
if len(sys.argv) == 1:
addr, name = find()[0]
elif len(sys.argv) == 2:
addr = sys.argv[1]
name = None
elif len(sys.argv) == 3:
addr, name = sys.argv[1:3]
print("Connecting to %s (%s)" % (name, addr))
wm = connect(addr, name)
#
fclib.registerNodeType(WiiMoteNode, [('Display',)])
wiiMoteNode = fc.createNode('WiiMote', pos=(0, 0))
fc.connectTerminals(fc['dataIn'], wiiMoteNode['dataIn'])
data = wm.accelerometer
# three widgets for x-, y- & z-Axis
xPlot = pg.PlotWidget()
yPlot = pg.PlotWidget()
zPlot = pg.PlotWidget()
# add widgets to grid layout
layout.addWidget(xPlot, 0, 1)
layout.addWidget(yPlot, 0, 2)
layout.addWidget(zPlot, 0, 3)
xGaussianNode = fc.createNode('GaussianFilter', pos=(150, -150))
yGaussianNode = fc.createNode('GaussianFilter', pos=(300, -150))
开发者ID:freakimkaefig,项目名称:itt_lamm_lechler,代码行数:31,代码来源:analyze.py
示例12: Selector
class Selector(MyCtrlNode):
""" Since the windows to show are limited one might need a selector"""
nodeName = "Selector2"
uiTemplate=[('selection', 'combo', {'values': ['A', 'B'], 'index': 0})]
def __init__(self, name):
terminals = {
'A': dict(io='in'),
'B': dict(io='in'),
'dataOut': dict(io='out'), # to specify whether it is input or output
} # other more advanced options are available
# as well..
MyCtrlNode.__init__(self, name, terminals=terminals)
def execute(self, A,B, display=True):
selection=self.ctrls['selection'].currentIndex()
if selection==0:
return {'dataOut': A}
else:
return {'dataOut': B}
"""
node = numpyInNumpyOutNode(
nodeName="selctor2",
uiTemplate=[
('radius','intSpin', {'value': 1, 'min': 1, 'max': 1e9 })
],
f=_normalize
)
"""
fclib.registerNodeType(Selector,[('Data-Selector',)])
开发者ID:DerThorsten,项目名称:ivigraph,代码行数:30,代码来源:input_selector.py
示例13: dict
outputDataDict = dict(trainLoss=trainLoss, testLoss=testLoss, testAcc=testAcc)
self.sigOutputDataChanged.emit(outputDataDict)
def plotTestData(self, it, testLossesDict, testAccuraciesDict):
trainLoss = {outputName: lossArr[:it] for outputName, lossArr in self.trainLoss.items()}
testLoss = {outputName: lossArr[:it // self.testInterval] for outputName, lossArr in self.testLoss.items()}
testAcc = {outputName: lossArr[:it // self.testInterval] for outputName, lossArr in self.testAcc.items()}
# emit a signal to the plotting gods
outputDataDict = dict(trainLoss=trainLoss, testLoss=testLoss, testAcc=testAcc)
self.sigOutputDataChanged.emit(outputDataDict)
fclib.registerNodeType(SolverNode, [('Layers',)])
class RemoteSolver(QtCore.QObject):
sigTrainDataUpdated = QtCore.Signal(object, object) # iteration, trainLoss Dictionary
sigTestDataUpdated = QtCore.Signal(object, object, object) # iteration, testLoss Dictionary, testAcc dictionary
def __init__(self, filename, niter, testInterval, testIter, weights=None, mode=0):
import pyqtgraph.multiprocess as mp
# create a remote process
proc = mp.QtProcess()
# import this module in remote process
rcaffe = proc._import('caffe')
# this solver lives in the remote process
开发者ID:elleryrussell,项目名称:caffeViz,代码行数:30,代码来源:SolverNode.py
示例14: numpyInNumpyOutNode
import vigra
import math
from node_base import numpyInNumpyOutNode
import pyqtgraph.flowchart.library as fclib
#######################################################
#
# FILTERS
#
########################################################
# ERROR!!!
"""
node = numpyInNumpyOutNode(
nodeName="HourGlassFilter",
uiTemplate=[
('scale','spin', {'value': 1.50, 'step': 0.25, 'range': [0.01, None]})
,
('rho', 'spin', {'value': 1.50, 'step': 0.25, 'range': [0.01, None]})
],
f=vigra.filters.hourGlassFilter2D
)
fclib.registerNodeType(node,[('Image-Tensors',)])
"""
def _powerdGaussianSmoothing(img,sigma,power):
img=img**power
result = vigra.filters.gaussianSmoothing(img,sigma=sigma)
开发者ID:DerThorsten,项目名称:ivigraph,代码行数:31,代码来源:vigra_filters.py
示例15: decrease_buffer_size
def decrease_buffer_size(self):
size = self.ctrls['size'].value()
self.ctrls['size'].setValue(size - 1.0)
def process(self, **kwds):
size = int(self.ctrls['size'].value())
self._buffer = np.append(self._buffer, kwds['dataIn'])
self._buffer = self._buffer[-size:]
if self.buttons is None:
self.register_buttons(kwds['buttons'])
output = self._buffer
return {'dataOut': output}
fclib.registerNodeType(BufferNode, [('Data',)])
class WiimoteNode(Node):
"""
Outputs sensor data from a Wiimote.
Supported sensors: accelerometer (3 axis)
Text input box allows for setting a Bluetooth MAC address.
Pressing the "connect" button tries connecting to the Wiimote.
Update rate can be changed via a spinbox widget. Setting it to "0"
activates callbacks everytime a new sensor value arrives (which is
quite often -> performance hit)
"""
nodeName = "Wiimote"
开发者ID:freakimkaefig,项目名称:itt_lamm_lechler,代码行数:30,代码来源:gestures.py
示例16: dict
'dataOutX': dict(io='out')
}
self._dataInX = np.array([])
Node.__init__(self, name, terminals=terminals)
# calculates standard deviation
def calcStd(self, a):
standardDeviation = np.std(a)
return standardDeviation
def process(self, **kwds):
self._dataInX = kwds['dataInX']
output = float(self.calcStd(self._dataInX))
return {'dataOutX': output}
fclib.registerNodeType(StdDevNode, [('Data',)])
class NumberDisplayNode(Node):
nodeName = "NumberDisplayNode"
def __init__(self, name):
terminals = {
'numberIn': dict(io='in'),
'numberOut': dict(io='out')
}
Node.__init__(self, name, terminals=terminals)
def process(self, **kwds):
output = kwds['numberIn']
# shows STD in DisplayWidget
开发者ID:Gr4ni,项目名称:ITT-SS15,代码行数:31,代码来源:noisalyzer.py
示例17: hideRow
return self.ui
def hideRow(self, name):
w = self.ctrls[name]
l = self.ui.layout().labelForField(w)
w.hide()
l.hide()
def showRow(self, name):
w = self.ctrls[name]
l = self.ui.layout().labelForField(w)
w.show()
l.show()
def execute(self, FeatureImage, LabelImage, display=True):
if FeatureImage is None or LabelImage is None:
return None
FeatureImage = np.require(FeatureImage, dtype=np.float32)
LabelImage = np.require(LabelImage, dtype=np.uint32)
self.used_features = _get_checked_features(self.ctrls)
region_features = vigra.analysis.extractRegionFeatures(FeatureImage,
LabelImage,
self.used_features)
return {
'RegionFeatures': region_features,
'UsedFeatures': self.used_features
}
fclib.registerNodeType(RegionFeaturesNode, [('Image-Analysis',)])
开发者ID:DerThorsten,项目名称:ivigraph,代码行数:30,代码来源:vigra_region_features.py
示例18: __init__
def __init__(self, name):
terminals = {
'Znormal': dict(io='in'),
'Xnormal': dict(io='in'),
'VectorX': dict(io='out'),
'VectorY': dict(io='out'),
}
self._stuff = np.array([])
Node.__init__(self, name, terminals=terminals)
def process(self, **kwds):
#reduce sensor default values to 0 and calculate angle
angle = np.arctan2(kwds['Znormal'] - 512, kwds['Xnormal'] - 512)
return {'VectorX': np.array([0, np.cos(angle)]), 'VectorY': np.array([0, np.sin(angle)])}
fclib.registerNodeType(NormalVectorNode, [('NormalVector',)])
def setupFlowChart(layout, fc, wiimoteNode):
pw1 = pg.PlotWidget()
layout.addWidget(pw1, 0, 1)
pw1.setYRange(0, 1024)
pw1Node = fc.createNode('PlotWidget', pos=(-150, 300))
pw1Node.setPlot(pw1)
pw2 = pg.PlotWidget()
layout.addWidget(pw2, 1, 1)
pw2.setYRange(0, 1024)
pw2Node = fc.createNode('PlotWidget', pos=(0, 300))
pw2Node.setPlot(pw2)
开发者ID:MaxSchu,项目名称:NotTheDroidsYouWereLookingFor,代码行数:29,代码来源:analyze.py
示例19: process
svc.fit(train, cats)
cat = svc.predict(classdata)
print cat
return categories[cat]
def process(self, **kwds):
cdata = [[kwds['classifyData'][:len(kwds['trainigData'][0])]]]
print cdata
output = self.classify(kwds['categories'],
kwds['trainigData'],
cdata)
return {
'classification': output
}
fclib.registerNodeType(SvmClassifierNode, [('Data',)])
class FFTNode(Node):
nodeName = "FFTNode"
def __init__(self, name):
terminals = {
'dataIn': dict(io='in'),
'dataOut': dict(io='out'),
}
Node.__init__(self, name, terminals=terminals)
def calculation(self, data):
if(isinstance(data[0], types.ListType)):
开发者ID:ManuKrapf,项目名称:IntTec,代码行数:31,代码来源:classifier.py
示例20: process
Node.__init__(self, name, terminals=terminals)
def process(self, dataIn):
data_length = len(dataIn)
frequency_spectrum = np.fft.fft(dataIn) / data_length # fft computing and normalization
frequency_spectrum = frequency_spectrum[range(data_length / 2)]
output = np.abs(frequency_spectrum)
print output
return {'dataOut': output}
fclib.registerNodeType(AnalyzeNode, [('Data',)])
class NoiseNode(CtrlNode):
nodeName = "NoiseNode"
uiTemplate = [
('noise', 'spin', {'value': 5, 'step': 1.0, 'range': [0.0, 128.0]}),
]
def __init__(self, name):
terminals = {
'dataIn': dict(io='in'),
'dataOut': dict(io='out'),
}
CtrlNode.__init__(self, name, terminals=terminals)
开发者ID:CrazyCrud,项目名称:interactiondesign-python,代码行数:30,代码来源:fft.py
注:本文中的pyqtgraph.flowchart.library.registerNodeType函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论