Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Public Member Functions | Protected Attributes
qSlicerSubjectHierarchyScriptedPlugin Class Reference

Scripted abstract plugin for handling subject hierarchy items or providing actions for items. More...

#include <Modules/Loadable/SubjectHierarchy/Widgets/qSlicerSubjectHierarchyScriptedPlugin.h>

Inheritance diagram for qSlicerSubjectHierarchyScriptedPlugin:
Inheritance graph
[legend]
Collaboration diagram for qSlicerSubjectHierarchyScriptedPlugin:
Collaboration graph
[legend]

Public Types

typedef qSlicerSubjectHierarchyAbstractPlugin Superclass
 
- Public Types inherited from qSlicerSubjectHierarchyAbstractPlugin
typedef QObject Superclass
 

Public Member Functions

double canAddNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const override
 
double canOwnSubjectHierarchyItem (vtkIdType itemID) const override
 
double canReparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID) const override
 
QString displayedItemName (vtkIdType itemID) const override
 
void editProperties (vtkIdType itemID) override
 Open module belonging to item and set inputs in opened module. More...
 
int getDisplayVisibility (vtkIdType itemID) const override
 
const QString helpText () const override
 Get help text for plugin to be added in subject hierarchy module widget help box. More...
 
QIcon icon (vtkIdType itemID) override
 
QList< QAction * > itemContextMenuActions () const override
 Get item context menu item actions to add to tree view. More...
 
Q_INVOKABLE QString pythonSource () const
 
 qSlicerSubjectHierarchyScriptedPlugin (QObject *parent=nullptr)
 
bool reparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID) override
 
const QString roleForPlugin () const override
 
QList< QAction * > sceneContextMenuActions () const override
 
Q_INVOKABLE PyObjectself () const
 Convenience method allowing to retrieve the associated scripted instance. More...
 
void setDisplayVisibility (vtkIdType itemID, int visible) override
 Set display visibility of a owned subject hierarchy item. More...
 
void setName (QString name) override
 
Q_INVOKABLE bool setPythonSource (const QString newPythonSource)
 
void showContextMenuActionsForItem (vtkIdType itemID) override
 
void showViewContextMenuActionsForItem (vtkIdType itemID, QVariantMap eventData) override
 
QString tooltip (vtkIdType itemID) const override
 Generate tooltip for a owned subject hierarchy item. More...
 
QList< QAction * > viewContextMenuActions () const override
 Get view item context menu item actions to add to views. More...
 
QIcon visibilityIcon (int visible) override
 Get visibility icon for a visibility state. More...
 
 ~qSlicerSubjectHierarchyScriptedPlugin () override
 
- Public Member Functions inherited from qSlicerSubjectHierarchyAbstractPlugin
virtual bool addNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID)
 
virtual Q_INVOKABLE QColor getDisplayColor (vtkIdType itemID, QMap< int, QVariant > &terminologyMetaData) const
 
Q_INVOKABLE bool isThisPluginOwnerOfItem (vtkIdType itemID) const
 Determines if the item is owned by this plugin. More...
 
virtual QString name () const
 Get the name of the plugin. More...
 
 qSlicerSubjectHierarchyAbstractPlugin (QObject *parent=nullptr)
 
virtual Q_INVOKABLE void setDisplayColor (vtkIdType itemID, QColor color, QMap< int, QVariant > terminologyMetaData)
 
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem (vtkIdType itemID)
 
virtual Q_INVOKABLE QList< QAction * > visibilityContextMenuActions () const
 
 ~qSlicerSubjectHierarchyAbstractPlugin () override
 

Protected Attributes

QScopedPointer< qSlicerSubjectHierarchyScriptedPluginPrivate > d_ptr
 
- Protected Attributes inherited from qSlicerSubjectHierarchyAbstractPlugin
QString m_Name
 Name of the plugin. More...
 

Additional Inherited Members

- Properties inherited from qSlicerSubjectHierarchyAbstractPlugin
QString name
 
- Signals inherited from qSlicerSubjectHierarchyAbstractPlugin
void requestExpandItem (vtkIdType itemID)
 Signal requesting expanding of the subject hierarchy tree item belonging to an item. More...
 
void requestInvalidateFilter () const
 
- Static Public Member Functions inherited from qSlicerSubjectHierarchyAbstractPlugin
static Q_INVOKABLE qSlicerAbstractModuleWidgetswitchToModule (QString moduleName)
 
- Protected Member Functions inherited from qSlicerSubjectHierarchyAbstractPlugin
void hideAllContextMenuActions () const
 

Detailed Description

Scripted abstract plugin for handling subject hierarchy items or providing actions for items.

In Widgets, not Plugins because the paths and libs need to be exported to extensions This class provides an interface to plugins implemented in python. USAGE: Subclass AbstractScriptedSubjectHierarchyPlugin in SubjectHierarchyPlugins subfolder of python scripted module, and register plugin by creating this class in module (e.g. setup method of module widget) and setting python source to implemented plugin subclass. Example can be found here: https://subversion.assembla.com/svn/slicerrt/trunk/VolumeClip/src

Note about confidence values (

See also
canAddNodeToSubjectHierarchy
canReparentItemInsideSubjectHierarchy
canOwnSubjectHierarchyItem): The confidence value is a floating point number between 0.0 and 1.0. Meaning of some typical values: 0.0 = The plugin cannot handle the item in question at all 0.3 = It is likely that other plugins will be able to handle the item in question better (typical value for plugins for generic types, such as Volumes) 0.5 = The plugin has equal chance to handle this item as others (an example can be color table node) 0.7 = The plugin is likely be the only one that can handle the item in question, but there is a chance that other plugins can do that too 1.0 = The item in question can only be handled by the plugin (by node type or identifier attribute)

Definition at line 61 of file qSlicerSubjectHierarchyScriptedPlugin.h.

Member Typedef Documentation

◆ Superclass

Definition at line 67 of file qSlicerSubjectHierarchyScriptedPlugin.h.

Constructor & Destructor Documentation

◆ qSlicerSubjectHierarchyScriptedPlugin()

qSlicerSubjectHierarchyScriptedPlugin::qSlicerSubjectHierarchyScriptedPlugin ( QObject *  parent = nullptr)

◆ ~qSlicerSubjectHierarchyScriptedPlugin()

qSlicerSubjectHierarchyScriptedPlugin::~qSlicerSubjectHierarchyScriptedPlugin ( )
override

Member Function Documentation

◆ canAddNodeToSubjectHierarchy()

double qSlicerSubjectHierarchyScriptedPlugin::canAddNodeToSubjectHierarchy ( vtkMRMLNode node,
vtkIdType  parentItemID = vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID 
) const
overridevirtual

Determines if a data node can be placed in the hierarchy using the actual plugin, and gets a confidence value for a certain MRML node (usually the type and possibly attributes are checked). Most plugins do not perform steps additional to the default, so the default implementation returns a 0 confidence value, which can be overridden in plugins that do handle special cases.

Parameters
nodeNode to be added to the hierarchy
parentItemIDProspective parent of the node to add. Default value is invalid. In that case the parent will be ignored, the confidence numbers are got based on the to-be child node alone.
Returns
Floating point confidence number between 0 and 1, where 0 means that the plugin cannot handle the node, and 1 means that the plugin is the only one that can handle the node (by node type or identifier attribute)

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ canOwnSubjectHierarchyItem()

double qSlicerSubjectHierarchyScriptedPlugin::canOwnSubjectHierarchyItem ( vtkIdType  itemID) const
overridevirtual

Determines if the actual plugin can handle a subject hierarchy item. The plugin with the highest confidence number will "own" the item in the subject hierarchy (set icon, tooltip, set context menu etc.)

Parameters
itemItem to handle in the subject hierarchy tree
Returns
Floating point confidence number between 0 and 1, where 0 means that the plugin cannot handle the item, and 1 means that the plugin is the only one that can handle the item (by node type or identifier attribute)

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ canReparentItemInsideSubjectHierarchy()

double qSlicerSubjectHierarchyScriptedPlugin::canReparentItemInsideSubjectHierarchy ( vtkIdType  itemID,
vtkIdType  parentItemID 
) const
overridevirtual

Determines if a subject hierarchy item can be reparented in the hierarchy using the current plugin, and gets a confidence value for the reparented item. Most plugins do not perform steps additional to the default, so the default implementation returns a 0 confidence value, which can be overridden in plugins that do handle special cases.

Parameters
itemIDItem to be reparented in the hierarchy
parentItemIDProspective parent of the item to reparent.
Returns
Floating point confidence number between 0 and 1, where 0 means that the plugin cannot handle the item, and 1 means that the plugin is the only one that can handle the item

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ displayedItemName()

QString qSlicerSubjectHierarchyScriptedPlugin::displayedItemName ( vtkIdType  itemID) const
overridevirtual

Generate displayed name for the owned subject hierarchy item corresponding to its role. The default implementation returns the associated data node's name if any, otherwise the item name

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ editProperties()

void qSlicerSubjectHierarchyScriptedPlugin::editProperties ( vtkIdType  itemID)
overridevirtual

Open module belonging to item and set inputs in opened module.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ getDisplayVisibility()

int qSlicerSubjectHierarchyScriptedPlugin::getDisplayVisibility ( vtkIdType  itemID) const
overridevirtual

Get display visibility of a owned subject hierarchy item

Returns
Display visibility (0: hidden, 1: shown, 2: partially shown)

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ helpText()

const QString qSlicerSubjectHierarchyScriptedPlugin::helpText ( ) const
overridevirtual

Get help text for plugin to be added in subject hierarchy module widget help box.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ icon()

QIcon qSlicerSubjectHierarchyScriptedPlugin::icon ( vtkIdType  itemID)
overridevirtual

Get icon of an owned subject hierarchy item

Returns
Icon to set, nullptr if nothing to set

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ itemContextMenuActions()

QList<QAction*> qSlicerSubjectHierarchyScriptedPlugin::itemContextMenuActions ( ) const
overridevirtual

Get item context menu item actions to add to tree view.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ pythonSource()

Q_INVOKABLE QString qSlicerSubjectHierarchyScriptedPlugin::pythonSource ( ) const

◆ reparentItemInsideSubjectHierarchy()

bool qSlicerSubjectHierarchyScriptedPlugin::reparentItemInsideSubjectHierarchy ( vtkIdType  itemID,
vtkIdType  parentItemID 
)
overridevirtual

Reparent an item that was already in the subject hierarchy under a new parent.

Returns
True if reparented successfully, false otherwise

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ roleForPlugin()

const QString qSlicerSubjectHierarchyScriptedPlugin::roleForPlugin ( ) const
overridevirtual

Get role that the plugin assigns to the subject hierarchy item. Each plugin should provide only one role.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ sceneContextMenuActions()

QList<QAction*> qSlicerSubjectHierarchyScriptedPlugin::sceneContextMenuActions ( ) const
overridevirtual

Get scene context menu item actions to add to tree view Separate method is needed for the scene, as its actions are set to the tree by a different method

See also
itemContextMenuActions

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ self()

Q_INVOKABLE PyObject* qSlicerSubjectHierarchyScriptedPlugin::self ( ) const

Convenience method allowing to retrieve the associated scripted instance.

◆ setDisplayVisibility()

void qSlicerSubjectHierarchyScriptedPlugin::setDisplayVisibility ( vtkIdType  itemID,
int  visible 
)
overridevirtual

Set display visibility of a owned subject hierarchy item.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ setName()

void qSlicerSubjectHierarchyScriptedPlugin::setName ( QString  name)
overridevirtual

Set the name property value.

See also
name

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ setPythonSource()

Q_INVOKABLE bool qSlicerSubjectHierarchyScriptedPlugin::setPythonSource ( const QString  newPythonSource)

Set python source for the implemented plugin

Parameters
newPythonSourcePython file path

◆ showContextMenuActionsForItem()

void qSlicerSubjectHierarchyScriptedPlugin::showContextMenuActionsForItem ( vtkIdType  itemID)
overridevirtual

Show context menu actions valid for a given subject hierarchy item.

Parameters
itemIDSubject Hierarchy item to show the context menu items for

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ showViewContextMenuActionsForItem()

void qSlicerSubjectHierarchyScriptedPlugin::showViewContextMenuActionsForItem ( vtkIdType  itemID,
QVariantMap  eventData 
)
overridevirtual

Show view context menu actions valid for a given subject hierarchy item.

Parameters
itemIDSubject Hierarchy item to show the context menu items for
eventDataSupplementary data for the item that may be considered for the menu (sub-item ID, attribute, etc.)

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ tooltip()

QString qSlicerSubjectHierarchyScriptedPlugin::tooltip ( vtkIdType  itemID) const
overridevirtual

Generate tooltip for a owned subject hierarchy item.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ viewContextMenuActions()

QList<QAction*> qSlicerSubjectHierarchyScriptedPlugin::viewContextMenuActions ( ) const
overridevirtual

Get view item context menu item actions to add to views.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ visibilityIcon()

QIcon qSlicerSubjectHierarchyScriptedPlugin::visibilityIcon ( int  visible)
overridevirtual

Get visibility icon for a visibility state.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerSubjectHierarchyScriptedPluginPrivate> qSlicerSubjectHierarchyScriptedPlugin::d_ptr
protected

Definition at line 178 of file qSlicerSubjectHierarchyScriptedPlugin.h.


The documentation for this class was generated from the following file: