本文整理汇总了Python中dataArtist.widgets.Tool.Tool类的典型用法代码示例。如果您正苦于以下问题:Python Tool类的具体用法?Python Tool怎么用?Python Tool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, display):
Tool.__init__(self, display)
pa = self.setParameterMenu()
self.pMask = pa.addChild({
'name':'Pixel mask from color layer',
'type':'list',
'value':'',
'limits':[]})
self.pMaxPlots = pa.addChild({
'name':'Max n plots',
'type':'int',
'value':100,
'limits':[1,1e5]})
self.pDivideBG = pa.addChild({
'name':'Divide background',
'type':'bool',
'value':True})
self.pBgSize = pa.addChild({
'name':'Background median kernel size',
'type':'int',
'value':3,
'limits':[1,1e5]})
self._menu.aboutToShow.connect(self._setPixelMaskOptions)
示例2: __init__
def __init__(self, display):
Tool.__init__(self, display)
self.outDisplay = None
self._method = {
'tenengrad': parameters.tenengrad,
'modifiedLaplacian': parameters.modifiedLaplacian,
'varianceOfLaplacian': parameters.varianceOfLaplacian,
'normalizedGraylevelVariance': parameters.normalizedGraylevelVariance
}
pa = self.setParameterMenu()
self.pLayer = pa.addChild({
'name': 'apply on',
'type': 'list',
'value': 'all layers',
'limits': ['all layers', 'last layer']})
self.pNewDisplay = pa.addChild({
'name': 'create new display',
'type': 'bool',
'value': False})
self.pMethod = pa.addChild({
'name': 'method',
'type': 'list',
'value': 'tenengrad',
'limits': list(self._method.keys())})
示例3: __init__
def __init__(self, display):
Tool.__init__(self, display)
self.scene = self.display.widget.view.scene()
self.rulers = []
self.rulersLen = []
self.scale = 1
self.scaleEditor = _ScaleEditor(self)
p = self.setParameterMenu()
pShow = p.addChild({"name": "Show", "type": "bool", "value": True})
pShow.sigValueChanged.connect(self.toggleShow)
self.pAngle = p.addChild({"name": "Show angle", "type": "bool", "value": False})
self.pColor = p.addChild({"name": "Color", "type": "color", "value": (255, 0, 0, 130)})
self.pSetScale = p.addChild({"name": "Set Scale", "type": "bool", "value": False})
self.pRatio = self.pSetScale.addChild(
{"name": "Aspect Ratio = 1", "type": "bool", "value": True, "visible": False}
)
self.pSetScale.sigValueChanged.connect(lambda param, val: [ch.show(val) for ch in param.children()])
pReset = p.addChild({"name": "reset", "type": "action", "value": True})
pReset.sigActivated.connect(self.reset)
示例4: __init__
def __init__(self, imageDisplay):
Tool.__init__(self, imageDisplay)
pa = self.setParameterMenu()
self.pSizeX = pa.addChild({
'name': 'X-size',
'type': 'int',
'value':300,
'limits':[1,1e6]})
self.pSizeY = pa.addChild({
'name': 'Y-size',
'type': 'int',
'value':300,
'limits':[1,1e6]})
self.pObject = pa.addChild({
'name': 'Object',
'type': 'list',
'limits':['current image', 'current color layer']})
self.pCriterion = pa.addChild({
'name': 'Criterion',
'type': 'list',
'limits':['==', '>', '<']})
self.pValue = pa.addChild({
'name': 'Value',
'type': 'float',
'value': 100})
示例5: __init__
def __init__(self, imageDisplay):
Tool.__init__(self, imageDisplay)
pa = self.setParameterMenu()
self.createResultInDisplayParam(pa)
self.pSize = pa.addChild({
'name':'Size',
'type':'int',
'value':3,
'limits':[1, 1000]})
self.pThreshold = pa.addChild({
'name':'Threshold',
'type':'float',
'value':0.2,
'tip': 'ratio to exceed to be filtered'})
self.pCondition = pa.addChild({
'name':'Condition',
'type':'list',
'value':'>',
'limits': ['>', '<']})
self.pAddChangesLayer = pa.addChild({
'name':'Add changes layer',
'type':'bool',
'value':True})
示例6: __init__
def __init__(self, display):
Tool.__init__(self, display)
self._lastVal = [0,0]
pa = self.setParameterMenu()
joy = JoystickButton()
joy.sigStateChanged.connect(self._joystickChanged)
self._menu.content.layout().insertWidget(1,joy)
self.pX = pa.addChild({
'name': 'X',
'type': 'int',
'value':0,})
self._pxChanged = lambda param, val, axis=0: self.pXYChanged(val, axis)
self.pX.sigValueChanged.connect(self._pxChanged)
self.pY = pa.addChild({
'name': 'Y',
'type': 'int',
'value':0,})
self._pyChanged = lambda param, val, axis=1: self.pXYChanged(val, axis)
self.pY.sigValueChanged.connect(self._pyChanged)
pAccept = pa.addChild({
'name': 'Accept',
'type': 'action'})
pAccept.sigActivated.connect(self.acceptChanges)
pReset = pa.addChild({
'name': 'Reset',
'type': 'action'})
pReset.sigActivated.connect(self.resetChanges)
示例7: __init__
def __init__(self, imageDisplay):
Tool.__init__(self, imageDisplay)
self._refImg = None
pa = self.setParameterMenu()
self._methods = {
# NAME: (FUNCTION, HISTOGRAM LEVELS)
"Reference image": (lambda x: scaleSignal(x, reference=self._refImg), None),
"Equalize histogram": (equalizeImage, None),
"Scale Background-Signal: 0-1": (lambda x: scaleSignal(x, backgroundToZero=True), [0, 1]),
"Scale signal +/-3std": (scaleSignal, [0, 1]),
"Maximum=1": (lambda img: img / np.nanmax(img), None),
"Average=1": (lambda img: img / np.nanmean(img), None),
"Minimum=0, Maximum=1": (self._scaleMinMax, [0, 1]),
}
self.pMethod = pa.addChild(
{"name": "Method", "type": "list", "value": "Scale signal +/-3std", "limits": list(self._methods.keys())}
)
self.pRefImgChoose = self.pMethod.addChild(
{"name": "Reference image", "value": "From display", "type": "menu", "visible": False}
)
self.pRefImg = self.pRefImgChoose.addChild({"name": "Chosen", "value": "-", "type": "str", "readonly": True})
self.pRefImgChoose.aboutToShow.connect(lambda menu: self.buildOtherDisplayLayersMenu(menu, self._setRefImg))
self.pMethod.sigValueChanged.connect(lambda p, v: self.pRefImgChoose.show(v == "Reference image"))
示例8: __init__
def __init__(self, display):
Tool.__init__(self, display)
self._refImg = None
pa = self.setParameterMenu()
self.createResultInDisplayParam(pa)
self.pOperation = pa.addChild({
'name':'Operation',
'type':'list',
'value':'fit',
'limits':['add', 'fit']})
self.pExecOn = pa.addChild({
'name':'Execute on',
'type':'list',
'value':'all images',
'limits':['all images', 'last image']})
pRefImgChoose = pa.addChild({
'name':'reference image',
'value':'from display',
'type':'menu'})
self.pRefImg = pRefImgChoose.addChild({
'name':'chosen',
'value':'-',
'type':'str',
'readonly':True})
pRefImgChoose.aboutToShow.connect(lambda menu:
self.buildOtherDisplayLayersMenu(menu, self._setRefImg) )
示例9: __init__
def __init__(self, imageDisplay):
Tool.__init__(self, imageDisplay)
self.calFileTool = self.showGlobalTool(CalibrationFile)
pa = self.setParameterMenu()
self.createResultInDisplayParam(pa, value='[NEW, ADD]')
pB = pa.addChild({
'name':'Balance value range',
'type':'group'})
self.pBFrom = pB.addChild({
'name':'from',
'type':'float',
'value':0.001,
'limits':[0,1]})
self.pBTo = pB.addChild({
'name':'to',
'type':'float',
'value':0.02,
'limits':[0,1]})
self.pn = pa.addChild({
'name':'N steps',
'type':'int',
'value':10,
'limits':[3,1000]})
self.pUpdate = pa.addChild({
'name':'Update Calibration',
'type':'action',
'visible':False})
self.pUpdate.sigActivated.connect(self.updateCalibration)
示例10: __init__
def __init__(self, display):
Tool.__init__(self, display)
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self._grabImage)
self.firstTime = True
pa = self.setParameterMenu()
self.pGrayscale = pa.addChild({
'name': 'Grayscale',
'type': 'bool',
'value': True})
self.pFloat = pa.addChild({
'name': 'To float',
'type': 'bool',
'value': True})
pFrequency = pa.addChild({
'name': 'Read frequency [Hz]',
'type': 'float',
'value': 20.0,
'limits': [0, 1000]})
pFrequency.sigValueChanged.connect(self._setInterval)
self._setInterval(pFrequency, pFrequency.value())
self.pBuffer = pa.addChild({
'name': 'Buffer last n images',
'type': 'int',
'value': 0})
示例11: __init__
def __init__(self, imageDisplay):
Tool.__init__(self, imageDisplay)
self.calFileTool = self.showGlobalTool(CalibrationFile)
self.camera = None
self.outDisplay = None
self.outDisplay2 = None
self._refDisplay = None
pa = self.setParameterMenu()
self.pRef = pa.addChild({
'name': 'Reference images',
'type': 'list',
'value': 'None',
'limits': ['None', 'From display', 'Every 2nd'],
'tip': 'Images of the same setup taken at the same exposure time'})
self.pRefFromDisplay = self.pRef.addChild({
'name': 'From display',
'type': 'menu',
'value': '[Choose]',
'visible': False})
self.pRefFromDisplay.aboutToShow.connect(self._buildRefFromDisplayMenu)
self.pRef.sigValueChanged.connect(lambda param, val:
self.pRefFromDisplay.show(val == 'From display'))
self.pPlotResult = pa.addChild({
'name': 'Plot NLF',
'type': 'bool',
'value': True})
self.pRange = pa.addChild({
'name': 'Set intensity range',
'type': 'bool',
'value': False})
self.pMin = self.pRange.addChild({
'name': 'Minimum',
'type': 'int',
'visible': False,
'value': 0})
self.pMax = self.pRange.addChild({
'name': 'Maximum',
'type': 'int',
'visible': False,
'value': 65000})
self.pRange.sigValueChanged.connect(lambda param, val:
[ch.show(val) for ch in self.pRange.childs])
self.pUpdate = pa.addChild({
'name': 'Update calibration',
'type': 'action',
'visible': False})
self.pUpdate.sigActivated.connect(self.updateCalibration)
示例12: __init__
def __init__(self, display):
Tool.__init__(self, display)
self._linked_display = None
self._menu = QtWidgets.QMenu()
self.setMenu(self._menu)
self._menu.aboutToShow.connect(self._buildMenu)
示例13: __init__
def __init__(self, imageDisplay):
Tool.__init__(self, imageDisplay)
#speed-up start
from scipy.ndimage.filters import median_filter, gaussian_filter, \
maximum_filter, minimum_filter
from skimage.restoration import nl_means_denoising
self.FILTER = {'median':median_filter,
'Gaussian':gaussian_filter,
'maximum':maximum_filter,
'minimum':minimum_filter,
'Non-local means':nl_means_denoising}
pa = self.setParameterMenu()
self.createResultInDisplayParam(pa)
self.pType = pa.addChild({
'name':'Type',
'type':'list',
'limits':self.FILTER.keys(),
'value':'median'})
self.pSeparate = pa.addChild({
'name':'Filter layers separate',
'type':'bool',
'value':True})
self.pSize = pa.addChild({
'name':'size',
'type':'int',
'value':3,
'limits':[1, 1000]})
self.pMode = pa.addChild({
'name':'mode',
'type':'list',
'limits':['reflect', 'constant', 'nearest', 'mirror', 'wrap'],
'value':'reflect'})
self.pCVal = pa.addChild({
'name':'cval',
'type':'float',
'value':0.0,
'limits':[0, 1000]})
self.pOrigin = pa.addChild({
'name':'origin',
'type':'int',
'value':0,
'limits':[0, 1000]})
self.pAddChangesLayer = pa.addChild({
'name':'Add changes layer',
'type':'bool',
'value':False})
示例14: __init__
def __init__(self, display):
Tool.__init__(self, display)
self._d = None
pa = self.setParameterMenu()
self.pX = pa.addChild({"name": "x", "type": "list"})
self.pY = pa.addChild({"name": "y", "type": "list"})
self._menu.aboutToShow.connect(self._buildMenu)
示例15: __init__
def __init__(self, display):
Tool.__init__(self, display)
self._linked_displays = []
self._actions = []
self._menu = QtGui.QMenu()
self.setMenu(self._menu)
self._menu.aboutToShow.connect(self._buildMenu)