Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qSlicerSubjectHierarchyAbstractPlugin Class Reference

Abstract plugin for handling Subject Hierarchy items. More...

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

Inheritance diagram for qSlicerSubjectHierarchyAbstractPlugin:
Collaboration diagram for qSlicerSubjectHierarchyAbstractPlugin:

Public Types

enum  ActionSectionType {
  SectionTop = -400 , SectionInteraction = -300 , SectionComponent = -200 , SectionNode = -100 ,
  SectionDefault = 0 , SectionFolder = 100 , SectionBottom = 200
}
 
typedef QObject Superclass
 

Properties

QString helpText
 
QString name
 

Signals

void requestExpandItem (vtkIdType itemID)
 Signal requesting expanding of the subject hierarchy tree item belonging to an item.
 
void requestInvalidateFilter () const
 

Public Member Functions

virtual Q_INVOKABLE bool addNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID)
 
virtual Q_INVOKABLE double canAddNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const
 
virtual Q_INVOKABLE bool canEditProperties (vtkIdType itemID)
 Returns true if the module can edit properties of this item using editProperties.
 
virtual Q_INVOKABLE double canOwnSubjectHierarchyItem (vtkIdType itemID) const
 
virtual Q_INVOKABLE double canReparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID) const
 
Q_INVOKABLE QColor colorAndTerminologyFromDisplayableNode (vtkIdType itemID, QMap< int, QVariant > &terminologyMetaData, bool useSelectedColor) const
 
virtual Q_INVOKABLE QString displayedItemName (vtkIdType itemID) const
 
virtual Q_INVOKABLE void editProperties (vtkIdType itemID)
 Open module belonging to item and set inputs in opened module.
 
virtual Q_INVOKABLE QColor getDisplayColor (vtkIdType itemID, QMap< int, QVariant > &terminologyMetaData) const
 
virtual Q_INVOKABLE int getDisplayVisibility (vtkIdType itemID) const
 
virtual const QString helpText () const
 Get help text for plugin to be added in subject hierarchy module widget help box.
 
virtual Q_INVOKABLE QIcon icon (vtkIdType itemID)
 
Q_INVOKABLE bool isThisPluginOwnerOfItem (vtkIdType itemID) const
 Determines if the item is owned by this plugin.
 
virtual Q_INVOKABLE QList< QAction * > itemContextMenuActions () const
 
virtual QString name () const
 Get the name of the plugin.
 
 qSlicerSubjectHierarchyAbstractPlugin (QObject *parent=nullptr)
 
virtual Q_INVOKABLE bool reparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID)
 
virtual Q_INVOKABLE const QString roleForPlugin () const
 
virtual Q_INVOKABLE QList< QAction * > sceneContextMenuActions () const
 
Q_INVOKABLE void setColorAndTerminologyToDisplayableNode (vtkIdType itemID, QColor color, QMap< int, QVariant > terminologyMetaData, bool useSelectedColor, bool disableScalarVisibility)
 
virtual Q_INVOKABLE void setDisplayColor (vtkIdType itemID, QColor color, QMap< int, QVariant > terminologyMetaData)
 
virtual Q_INVOKABLE void setDisplayVisibility (vtkIdType itemID, int visible)
 Set display visibility of an owned subject hierarchy item.
 
virtual void setName (QString name)
 
virtual Q_INVOKABLE void showContextMenuActionsForItem (vtkIdType itemID)
 
virtual Q_INVOKABLE bool showItemInView (vtkIdType itemID, vtkMRMLAbstractViewNode *viewNode, vtkIdList *allItemsToShow)
 
virtual Q_INVOKABLE void showTransformContextMenuActionsForItem (vtkIdType itemID)
 
virtual Q_INVOKABLE void showViewContextMenuActionsForItem (vtkIdType itemID, QVariantMap eventData)
 
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem (vtkIdType itemID)
 
virtual Q_INVOKABLE QString tooltip (vtkIdType itemID) const
 Generate tooltip for a owned subject hierarchy item.
 
virtual Q_INVOKABLE QList< QAction * > transformContextMenuActions () const
 
virtual Q_INVOKABLE QList< QAction * > viewContextMenuActions () const
 
virtual Q_INVOKABLE QList< QAction * > visibilityContextMenuActions () const
 
virtual Q_INVOKABLE QIcon visibilityIcon (int visible)
 Get visibility icon for a visibility state.
 
 ~qSlicerSubjectHierarchyAbstractPlugin () override
 

Static Public Member Functions

static Q_INVOKABLE void setActionPosition (QAction *action, int section, int weight=0, double weightAdjustment=0.0)
 
static Q_INVOKABLE qSlicerAbstractModuleWidgetswitchToModule (QString moduleName)
 

Protected Member Functions

void hideAllContextMenuActions () const
 

Protected Attributes

QString m_Name
 Name of the plugin.
 

Friends

class qMRMLSubjectHierarchyTreeView
 
class qSlicerSubjectHierarchyPluginLogic
 

Detailed Description

Abstract plugin for handling Subject Hierarchy items.

In Widgets, not Plugins because the paths and library paths need to be exported to extensions

This class provides an interface and some default implementations for the common operations on subject hierarchy items. To exercise the default implementations, a Default plugin

See also
qSlicerSubjectHierarchyDefaultPlugin has to be created.

Note about confidence values (

See also
canAddNodeToSubjectHierarchy,
canReparentItemInsideSubjectHierarchy,
canOwnSubjectHierarchyItem - in case of the latter two the node mentioned below is the data node associated to the item): 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 node in question at all 0.3 = It is likely that other plugins will be able to handle the node in question better (typical value for plugins for generic types, such as Volumes) 0.5 = The plugin has equal chance to handle this node as others (an example can be color table node) 0.7 = The plugin is likely be the only one that can handle the node in question, but there is a chance that other plugins can do that too 1.0 = The node in question can only be handled by the plugin (by node type or identifier attribute)

Plugin subclass naming convention:

  • Plugins providing roles: qSubjectHierarchy[Role name, noun]Plugin
  • Plugins providing functions: qSubjectHierarchy[Function name, verb]Plugin

Definition at line 64 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Member Typedef Documentation

◆ Superclass

Member Enumeration Documentation

◆ ActionSectionType

Enumerator
SectionTop 

Use this section to make items appear at the top of the menu.

SectionInteraction 

Actions for changing the current interaction mode (in view context menu).

SectionComponent 

Actions for the selected node component (e.g., control point within a node).

SectionNode 

Actions for the selected node.

SectionDefault 

By default (if no position is defined) actions will appear in this section.

SectionFolder 

Actions for the selected folder.

SectionBottom 

Use this section to make items appear at the bottom of the menu.

Definition at line 245 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Property Documentation

◆ helpText

QString qSlicerSubjectHierarchyAbstractPlugin::helpText
read

Definition at line 73 of file qSlicerSubjectHierarchyAbstractPlugin.h.

◆ name

QString qSlicerSubjectHierarchyAbstractPlugin::name
readwrite

This property stores the name of the plugin Cannot be empty.

See also
name()

Definition at line 72 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Constructor & Destructor Documentation

◆ qSlicerSubjectHierarchyAbstractPlugin()

qSlicerSubjectHierarchyAbstractPlugin::qSlicerSubjectHierarchyAbstractPlugin ( QObject * parent = nullptr)

◆ ~qSlicerSubjectHierarchyAbstractPlugin()

qSlicerSubjectHierarchyAbstractPlugin::~qSlicerSubjectHierarchyAbstractPlugin ( )
override

Member Function Documentation

◆ addNodeToSubjectHierarchy()

virtual Q_INVOKABLE bool qSlicerSubjectHierarchyAbstractPlugin::addNodeToSubjectHierarchy ( vtkMRMLNode * node,
vtkIdType parentItemID )
virtual

Add a node to subject hierarchy under a specified parent. This is basically a convenience function to call

See also
vtkMRMLSubjectHierarchyNode::CreateItem
Parameters
nodeNode to add to subject hierarchy
parentItemIDParent item of the added node
Returns
True if added successfully, false otherwise

Reimplemented in qSlicerSubjectHierarchyFolderPlugin, and qSlicerSubjectHierarchySegmentationsPlugin.

◆ canAddNodeToSubjectHierarchy()

virtual Q_INVOKABLE double qSlicerSubjectHierarchyAbstractPlugin::canAddNodeToSubjectHierarchy ( vtkMRMLNode * node,
vtkIdType parentItemID = vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID ) const
virtual

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 in qSlicerSubjectHierarchyDiffusionTensorVolumesPlugin, qSlicerSubjectHierarchyFolderPlugin, qSlicerSubjectHierarchyLabelMapsPlugin, qSlicerSubjectHierarchyMarkupsPlugin, qSlicerSubjectHierarchyModelsPlugin, qSlicerSubjectHierarchyPlotsPlugin, qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchySegmentationsPlugin, qSlicerSubjectHierarchyTablesPlugin, qSlicerSubjectHierarchyTextsPlugin, qSlicerSubjectHierarchyTransformsPlugin, and qSlicerSubjectHierarchyVolumesPlugin.

◆ canEditProperties()

virtual Q_INVOKABLE bool qSlicerSubjectHierarchyAbstractPlugin::canEditProperties ( vtkIdType itemID)
virtual

Returns true if the module can edit properties of this item using editProperties.

◆ canOwnSubjectHierarchyItem()

virtual Q_INVOKABLE double qSlicerSubjectHierarchyAbstractPlugin::canOwnSubjectHierarchyItem ( vtkIdType itemID) const
virtual

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 in qSlicerSubjectHierarchyDefaultPlugin, qSlicerSubjectHierarchyDiffusionTensorVolumesPlugin, qSlicerSubjectHierarchyFolderPlugin, qSlicerSubjectHierarchyLabelMapsPlugin, qSlicerSubjectHierarchyMarkupsPlugin, qSlicerSubjectHierarchyModelsPlugin, qSlicerSubjectHierarchyPlotsPlugin, qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchySegmentationsPlugin, qSlicerSubjectHierarchySegmentsPlugin, qSlicerSubjectHierarchyTablesPlugin, qSlicerSubjectHierarchyTextsPlugin, qSlicerSubjectHierarchyTransformsPlugin, and qSlicerSubjectHierarchyVolumesPlugin.

◆ canReparentItemInsideSubjectHierarchy()

virtual Q_INVOKABLE double qSlicerSubjectHierarchyAbstractPlugin::canReparentItemInsideSubjectHierarchy ( vtkIdType itemID,
vtkIdType parentItemID ) const
virtual

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 in qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchySegmentationsPlugin, qSlicerSubjectHierarchySegmentsPlugin, and qSlicerSubjectHierarchyTransformsPlugin.

◆ colorAndTerminologyFromDisplayableNode()

Q_INVOKABLE QColor qSlicerSubjectHierarchyAbstractPlugin::colorAndTerminologyFromDisplayableNode ( vtkIdType itemID,
QMap< int, QVariant > & terminologyMetaData,
bool useSelectedColor ) const

◆ displayedItemName()

virtual Q_INVOKABLE QString qSlicerSubjectHierarchyAbstractPlugin::displayedItemName ( vtkIdType itemID) const
virtual

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 in qSlicerSubjectHierarchyScriptedPlugin.

◆ editProperties()

virtual Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::editProperties ( vtkIdType itemID)
virtual

◆ getDisplayColor()

virtual Q_INVOKABLE QColor qSlicerSubjectHierarchyAbstractPlugin::getDisplayColor ( vtkIdType itemID,
QMap< int, QVariant > & terminologyMetaData ) const
virtual

◆ getDisplayVisibility()

virtual Q_INVOKABLE int qSlicerSubjectHierarchyAbstractPlugin::getDisplayVisibility ( vtkIdType itemID) const
virtual

◆ helpText()

virtual const QString qSlicerSubjectHierarchyAbstractPlugin::helpText ( ) const
virtual

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

Reimplemented in qSlicerSubjectHierarchyDefaultPlugin, qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchySegmentationsPlugin, and qSlicerSubjectHierarchySegmentsPlugin.

◆ hideAllContextMenuActions()

void qSlicerSubjectHierarchyAbstractPlugin::hideAllContextMenuActions ( ) const
protected

Hide all context menu actions offered by the plugin. This method must be called as a first step in

See also
showContextMenuActionsForItem before showing the actions that apply to the current situation. Calling this method prevents programming errors made in case plugin actions change.

◆ icon()

◆ isThisPluginOwnerOfItem()

Q_INVOKABLE bool qSlicerSubjectHierarchyAbstractPlugin::isThisPluginOwnerOfItem ( vtkIdType itemID) const

Determines if the item is owned by this plugin.

◆ itemContextMenuActions()

virtual Q_INVOKABLE QList< QAction * > qSlicerSubjectHierarchyAbstractPlugin::itemContextMenuActions ( ) const
virtual

◆ name()

virtual QString qSlicerSubjectHierarchyAbstractPlugin::name ( ) const
virtual

Get the name of the plugin.

◆ reparentItemInsideSubjectHierarchy()

virtual Q_INVOKABLE bool qSlicerSubjectHierarchyAbstractPlugin::reparentItemInsideSubjectHierarchy ( vtkIdType itemID,
vtkIdType parentItemID )
virtual

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

Returns
True if reparented successfully, false otherwise

Reimplemented in qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchySegmentationsPlugin, qSlicerSubjectHierarchySegmentsPlugin, and qSlicerSubjectHierarchyTransformsPlugin.

◆ requestExpandItem

void qSlicerSubjectHierarchyAbstractPlugin::requestExpandItem ( vtkIdType itemID)
signal

Signal requesting expanding of the subject hierarchy tree item belonging to an item.

◆ requestInvalidateFilter

void qSlicerSubjectHierarchyAbstractPlugin::requestInvalidateFilter ( ) const
signal

Signal requesting invalidating the filter model for the tree view (e.g. when an item is added or removed by the plugin)

◆ roleForPlugin()

◆ sceneContextMenuActions()

virtual Q_INVOKABLE QList< QAction * > qSlicerSubjectHierarchyAbstractPlugin::sceneContextMenuActions ( ) const
virtual

Get scene context menu item actions to add to tree view. Also provides actions for right-click on empty area These context menu actions are shown for the scene in the implementations of

See also
showContextMenuActionsForItem Separate method is needed for the scene, as its actions are set to the tree by a different method
itemContextMenuActions

Reimplemented in qSlicerSubjectHierarchyExpandToDepthPlugin, qSlicerSubjectHierarchyExportPlugin, qSlicerSubjectHierarchyFolderPlugin, qSlicerSubjectHierarchyParseLocalDataPlugin, and qSlicerSubjectHierarchyScriptedPlugin.

◆ setActionPosition()

static Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::setActionPosition ( QAction * action,
int section,
int weight = 0,
double weightAdjustment = 0.0 )
static

Set the action position within a subject hierarchy menu by setting section and weight.

Parameters
sectionspecifies section where the menu item will appear. SectionDefault, SectionNode, SectionFolder, ... constants can be used. A separator is displayed between each menu section.
weightspecifies the position of the action within the section. Lighter actions float up (actions that have lower weight appear higher in the menu). Valid range is -49 to 49.
weightAdjustmentspecifies additional weight that allows inserting an action right above or below another action. Valid range is -49.0 to 49.0 (non-integer values are allowed).

◆ setColorAndTerminologyToDisplayableNode()

Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::setColorAndTerminologyToDisplayableNode ( vtkIdType itemID,
QColor color,
QMap< int, QVariant > terminologyMetaData,
bool useSelectedColor,
bool disableScalarVisibility )

Helper functions for getting/setting color in displayable data node. It is useful for implementing getDisplayColor and setDisplayColor methods.

◆ setDisplayColor()

virtual Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::setDisplayColor ( vtkIdType itemID,
QColor color,
QMap< int, QVariant > terminologyMetaData )
virtual

◆ setDisplayVisibility()

◆ setName()

virtual void qSlicerSubjectHierarchyAbstractPlugin::setName ( QString name)
virtual

Set the name of the plugin NOTE: name must be defined in constructor in C++ plugins, this can only be used in python scripted ones

Reimplemented in qSlicerSubjectHierarchyScriptedPlugin.

◆ showContextMenuActionsForItem()

virtual Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::showContextMenuActionsForItem ( vtkIdType itemID)
inlinevirtual

◆ showItemInView()

virtual Q_INVOKABLE bool qSlicerSubjectHierarchyAbstractPlugin::showItemInView ( vtkIdType itemID,
vtkMRMLAbstractViewNode * viewNode,
vtkIdList * allItemsToShow )
virtual

Show an item in a selected view. List of all other item IDs that will be shown in this request is also provided, as it may help in determining the optimal view setup. For example, if multiple volume nodes will be shown then the first node may be displayed as background and the second as foreground.

Reimplemented in qSlicerSubjectHierarchyColorLegendPlugin, qSlicerSubjectHierarchyDiffusionTensorVolumesPlugin, qSlicerSubjectHierarchyLabelMapsPlugin, qSlicerSubjectHierarchySegmentationsPlugin, qSlicerSubjectHierarchySegmentsPlugin, qSlicerSubjectHierarchyVolumeRenderingPlugin, and qSlicerSubjectHierarchyVolumesPlugin.

◆ showTransformContextMenuActionsForItem()

virtual Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::showTransformContextMenuActionsForItem ( vtkIdType itemID)
inlinevirtual

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

Parameters
itemIDSubject Hierarchy item to show the transform context menu items for

Reimplemented in qSlicerSubjectHierarchyTransformsPlugin.

Definition at line 175 of file qSlicerSubjectHierarchyAbstractPlugin.h.

◆ showViewContextMenuActionsForItem()

virtual Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::showViewContextMenuActionsForItem ( vtkIdType itemID,
QVariantMap eventData )
inlinevirtual

Show context menu actions valid for a given subject hierarchy item to be shown in the view.

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 in qSlicerSubjectHierarchyMarkupsPlugin, qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchyTransformsPlugin, qSlicerSubjectHierarchyViewContextMenuPlugin, and qSlicerSubjectHierarchyVolumesPlugin.

Definition at line 185 of file qSlicerSubjectHierarchyAbstractPlugin.h.

◆ showVisibilityContextMenuActionsForItem()

virtual Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::showVisibilityContextMenuActionsForItem ( vtkIdType itemID)
inlinevirtual

◆ switchToModule()

static Q_INVOKABLE qSlicerAbstractModuleWidget * qSlicerSubjectHierarchyAbstractPlugin::switchToModule ( QString moduleName)
static

Switch to module with given name

Returns
Widget representation of the module if found, nullptr otherwise

◆ tooltip()

◆ transformContextMenuActions()

virtual Q_INVOKABLE QList< QAction * > qSlicerSubjectHierarchyAbstractPlugin::transformContextMenuActions ( ) const
virtual

Get transform context menu item actions to add to tree view. These item transform context menu actions can be shown in the implementations of

See also
showTransformContextMenuActionsForItem

Reimplemented in qSlicerSubjectHierarchyTransformsPlugin.

◆ viewContextMenuActions()

virtual Q_INVOKABLE QList< QAction * > qSlicerSubjectHierarchyAbstractPlugin::viewContextMenuActions ( ) const
virtual

Get view context menu item actions that are available when right-clicking an object in the views. These item context menu actions can be shown in the implementations of

See also
showViewContextMenuActionsForItem Note: The actions need object names set so that they can be included in the white list

Reimplemented in qSlicerSubjectHierarchyMarkupsPlugin, qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchyTransformsPlugin, qSlicerSubjectHierarchyViewContextMenuPlugin, and qSlicerSubjectHierarchyVolumesPlugin.

◆ visibilityContextMenuActions()

◆ visibilityIcon()

Friends And Related Symbol Documentation

◆ qMRMLSubjectHierarchyTreeView

friend class qMRMLSubjectHierarchyTreeView
friend

Definition at line 298 of file qSlicerSubjectHierarchyAbstractPlugin.h.

◆ qSlicerSubjectHierarchyPluginLogic

Definition at line 299 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Member Data Documentation

◆ m_Name

QString qSlicerSubjectHierarchyAbstractPlugin::m_Name
protected

Name of the plugin.

Definition at line 293 of file qSlicerSubjectHierarchyAbstractPlugin.h.


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