Adding stack plugins¶
Overview¶
A Stack plugin is a module that will be automatically added to the PyMca stack windows
in order to perform user defined operations on the data stack. It has to
inherit the StackPluginBase
class and implement the following methods:
StackPluginBase.getMethods()
StackPluginBase.getMethodToolTip()
(optional but convenient)StackPluginBase.getMethodPixmap()
(optional)StackPluginBase.applyMethod()
and modify the static module variable MENU_TEXT
and the static module function
getStackPluginInstance()
according to the defined plugin.
The plugin class has access to following inherited methods:
StackPluginBase.addImage()
StackPluginBase.getActiveCurve()
StackPluginBase.getGraphXLabel()
StackPluginBase.getGraphXLimits()
StackPluginBase.getGraphYLabel()
StackPluginBase.getGraphYLimits()
StackPluginBase.getStackData()
StackPluginBase.getStackDataObject()
StackPluginBase.getStackDataObjectList()
StackPluginBase.getStackInfo()
StackPluginBase.getStackOriginalCurve()
StackPluginBase.getStackOriginalImage()
StackPluginBase.getStackROIImagesAndNames()
StackPluginBase.getStackSelectionMask()
StackPluginBase.isStackFinite()
StackPluginBase.removeImage()
StackPluginBase.replaceImage()
StackPluginBase.setStack()
StackPluginBase.setStackSelectionMask()
StackPluginBase.stackClosed()
These plugins will be compatible with any stack window that provides the following methods:
#data related
getStackDataObject()
getStackData()
getStackInfo()
setStack()
getStackROIImagesAndNames()
isStackFinite()
getStackOriginalCurve()
getStackOriginalImage()
#mask related
setStackSelectionMask()
getStackSelectionMask()
#displayed curves
getActiveCurve()
getGraphXLimits()
getGraphYLimits()
getGraphXLabel()
getGraphYLabel()
#images
addImage()
removeImage()
replaceImage()
#information method
stackUpdated()
selectionMaskUpdated()
stackClosed()
Stack plugin API¶
-
class
PyMca5.PyMcaCore.StackPluginBase.
StackPluginBase
(stackWindow, **kw)[source]¶ -
-
getActiveCurve
()[source]¶ Function to access the currently active curve. It returns None in case of not having an active curve.
Output has the form:
xvalues, yvalues, legend, dict
where dict is a dictionnary containing curve info.
For the time being, only the plot labels associated to the curve are warranted to be present under the keys xlabel, ylabel.
-
-
PyMca5.PyMcaCore.StackPluginBase.
getStackPluginInstance
(stackWindow, **kw)[source]¶ This function will be called by the stack window instantiating and calling the plugins. It passes itself as first argument, but the default implementation of the base class only keeps a weak reference to prevent circular references.