Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
qSlicerSubjectHierarchyAbstractPlugin Class Reference

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

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

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

Public Types

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

Properties

QString name
 

Signals

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

Public Member Functions

virtual bool addNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID)
 
virtual 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. More...
 
virtual Q_INVOKABLE double canOwnSubjectHierarchyItem (vtkIdType itemID) const
 
virtual double canReparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID) const
 
virtual QString displayedItemName (vtkIdType itemID) const
 
virtual Q_INVOKABLE void editProperties (vtkIdType itemID)
 Open module belonging to item and set inputs in opened module. More...
 
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. More...
 
virtual QIcon icon (vtkIdType itemID)
 
Q_INVOKABLE bool isThisPluginOwnerOfItem (vtkIdType itemID) const
 Determines if the item is owned by this plugin. More...
 
virtual Q_INVOKABLE QList< QAction * > itemContextMenuActions () const
 
virtual QString name () const
 Get the name of the plugin. More...
 
 qSlicerSubjectHierarchyAbstractPlugin (QObject *parent=nullptr)
 
virtual bool reparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID)
 
virtual Q_INVOKABLE const QString roleForPlugin () const
 
virtual Q_INVOKABLE QList< QAction * > sceneContextMenuActions () const
 
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. More...
 
virtual void setName (QString name)
 
virtual Q_INVOKABLE void showContextMenuActionsForItem (vtkIdType itemID)
 
virtual bool showItemInView (vtkIdType itemID, vtkMRMLAbstractViewNode *viewNode, vtkIdList *allItemsToShow)
 
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. More...
 
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. More...
 
 ~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. More...
 

Friends

class qMRMLSubjectHierarchyTreeView
 
class qSlicerSubjectHierarchyPluginLogic
 

Detailed Description

Abstract plugin for handling Subject Hierarchy items.

In Widgets, not Plugins because the paths and libs 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:

Definition at line 65 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Member Typedef Documentation

◆ Superclass

Definition at line 76 of file qSlicerSubjectHierarchyAbstractPlugin.h.

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 234 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Property Documentation

◆ name

QString qSlicerSubjectHierarchyAbstractPlugin::name
readwrite

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

See also
name()

Definition at line 73 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Constructor & Destructor Documentation

◆ qSlicerSubjectHierarchyAbstractPlugin()

qSlicerSubjectHierarchyAbstractPlugin::qSlicerSubjectHierarchyAbstractPlugin ( QObject *  parent = nullptr)

◆ ~qSlicerSubjectHierarchyAbstractPlugin()

qSlicerSubjectHierarchyAbstractPlugin::~qSlicerSubjectHierarchyAbstractPlugin ( )
override

Member Function Documentation

◆ addNodeToSubjectHierarchy()

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

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

◆ canReparentItemInsideSubjectHierarchy()

virtual 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.

◆ displayedItemName()

virtual 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 qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchySegmentationsPlugin, qSlicerSubjectHierarchySegmentsPlugin, and qSlicerSubjectHierarchyDefaultPlugin.

◆ 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()

virtual QIcon qSlicerSubjectHierarchyAbstractPlugin::icon ( vtkIdType  itemID)
virtual

◆ 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 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()

virtual Q_INVOKABLE const QString qSlicerSubjectHierarchyAbstractPlugin::roleForPlugin ( ) const
virtual

◆ 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 qSlicerSubjectHierarchyScriptedPlugin, qSlicerSubjectHierarchyFolderPlugin, qSlicerSubjectHierarchyExportPlugin, and qSlicerSubjectHierarchyParseLocalDataPlugin.

◆ 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).

◆ setDisplayColor()

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

◆ setDisplayVisibility()

virtual Q_INVOKABLE void qSlicerSubjectHierarchyAbstractPlugin::setDisplayVisibility ( vtkIdType  itemID,
int  visible 
)
virtual

◆ 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 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 qSlicerSubjectHierarchySegmentsPlugin, qSlicerSubjectHierarchySegmentationsPlugin, qSlicerSubjectHierarchyVolumesPlugin, qSlicerSubjectHierarchyLabelMapsPlugin, qSlicerSubjectHierarchyDiffusionTensorVolumesPlugin, qSlicerSubjectHierarchyVolumeRenderingPlugin, and qSlicerSubjectHierarchyColorLegendPlugin.

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

Definition at line 174 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()

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

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

◆ visibilityContextMenuActions()

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

◆ visibilityIcon()

virtual Q_INVOKABLE QIcon qSlicerSubjectHierarchyAbstractPlugin::visibilityIcon ( int  visible)
virtual

Friends And Related Function Documentation

◆ qMRMLSubjectHierarchyTreeView

friend class qMRMLSubjectHierarchyTreeView
friend

Definition at line 278 of file qSlicerSubjectHierarchyAbstractPlugin.h.

◆ qSlicerSubjectHierarchyPluginLogic

Definition at line 279 of file qSlicerSubjectHierarchyAbstractPlugin.h.

Member Data Documentation

◆ m_Name

QString qSlicerSubjectHierarchyAbstractPlugin::m_Name
protected

Name of the plugin.

Definition at line 273 of file qSlicerSubjectHierarchyAbstractPlugin.h.


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