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

Subject hierarchy folder plugin. More...

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

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

Public Types

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

Public Slots

void onDataNodeAssociatedToHierarchyNode (vtkObject *dataNodeObject)
 

Public Member Functions

virtual bool addNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID)
 
virtual double canAddNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const
 
virtual double canOwnSubjectHierarchyItem (vtkIdType itemID) const
 
virtual double canReparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID) const
 
Q_INVOKABLE QString colorItemAttributeName () const
 Name of color attribute in folder subject hierarchy items. More...
 
Q_INVOKABLE vtkIdType createFolderUnderItem (vtkIdType parentItemID)
 
virtual void editProperties (vtkIdType itemID)
 Open module belonging to item and set inputs in opened module. More...
 
virtual QColor getDisplayColor (vtkIdType itemID, QMap< int, QVariant > &terminologyMetaData) const
 
Q_INVOKABLE vtkMRMLHierarchyNodehierarchyNodeForItem (vtkIdType itemID)
 
virtual QIcon icon (vtkIdType itemID)
 
virtual QList< QAction * > itemContextMenuActions () const
 Get item context menu item actions to add to tree view. More...
 
Q_INVOKABLE vtkIdType itemForHierarchyNode (vtkMRMLHierarchyNode *hierarchyNode)
 
 qSlicerSubjectHierarchyFolderPlugin (QObject *parent=NULL)
 
virtual bool reparentItemInsideSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID)
 
Q_INVOKABLE bool resolveHierarchies ()
 
Q_INVOKABLE bool resolveHierarchyForItem (vtkIdType itemID)
 
virtual Q_INVOKABLE const QString roleForPlugin () const
 
virtual QList< QAction * > sceneContextMenuActions () const
 
virtual void setDisplayColor (vtkIdType itemID, QColor color, QMap< int, QVariant > terminologyMetaData)
 
virtual void showContextMenuActionsForItem (vtkIdType itemID)
 
virtual void showVisibilityContextMenuActionsForItem (vtkIdType itemID)
 
virtual QList< QAction * > visibilityContextMenuActions () const
 
virtual QIcon visibilityIcon (int visible)
 Get visibility icon for a visibility state. More...
 
virtual ~qSlicerSubjectHierarchyFolderPlugin ()
 
- Public Member Functions inherited from qSlicerSubjectHierarchyAbstractPlugin
virtual QString displayedItemName (vtkIdType itemID) 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...
 
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=NULL)
 
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 QString tooltip (vtkIdType itemID) const
 Generate tooltip for a owned subject hierarchy item. More...
 
virtual ~qSlicerSubjectHierarchyAbstractPlugin ()
 

Protected Slots

void createFolderUnderCurrentNode ()
 Create folder node under current node. More...
 
void createFolderUnderScene ()
 Create folder node under the scene. More...
 
void onApplyColorToBranchToggled (bool)
 Toggle apply color to branch. More...
 
void onHierarchyNodeChildNodeAdded (vtkObject *parentNodeObject, vtkObject *childNodeObject)
 

Protected Member Functions

void callModifiedOnModelNodesInCurrentBranch ()
 
vtkMRMLModelDisplayNodemodelDisplayNodeForItem (vtkIdType itemID) const
 
- Protected Member Functions inherited from qSlicerSubjectHierarchyAbstractPlugin
void hideAllContextMenuActions () const
 

Protected Attributes

QScopedPointer< qSlicerSubjectHierarchyFolderPluginPrivate > 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)
 

Detailed Description

Subject hierarchy folder plugin.

  1. Supports folder items in subject hierarchy
  2. Supports node hierarchies in subject hierarchy by adding folder items for the intermediate nodes. Handled cases

Scene changes

  1. Hierarchy node added -> Add folder item ( folderPlugin::addNodeToSubjectHierarchy )
  2. New parent is set to a hierarchy node (Modified event for both old and new parents) newParent.vtkMRMLHierarchyNode::ChildNodeAddedEvent(hierarchyNode) -> Set parent of item for hierarchy node to item for new parent ( folderPlugin::onMRMLHierarchyNodeChildNodeAdded )
  3. Scene import ends -> Add each hierarchy node to subject hierarchy and resolve hierarchy on each added item ( addSupportedDataNodesToSubjectHierarchy, folderPlugin::addNodeToSubjectHierarchy, resolveHierarchyForItem )
  4. Data node is associated to a hierarchy node dataNode.vtkMRMLNode::HierarchyModifiedEvent (Should only happen if building hierarchy programmatically from scratch) Remove hierarchy node's item from subject hierarchy ( folderPlugin::onDataNodeAssociatedToHierarchyNode )

Subject hierarchy changes

  1. Item is reparented under an item with node hierarchy 1a. New parent has associated hierarchy node -> Set parent item's hierarchy node as parent of reparented item's hierarchy node ( folderPlugin::reparentItemInsideSubjectHierarchy ) 1b. Otherwise -> Set scene as parent of reparented item's hierarchy node ( folderPlugin::reparentItemInsideSubjectHierarchy )

Definition at line 90 of file qSlicerSubjectHierarchyFolderPlugin.h.

Member Typedef Documentation

◆ Superclass

Definition at line 97 of file qSlicerSubjectHierarchyFolderPlugin.h.

Constructor & Destructor Documentation

◆ qSlicerSubjectHierarchyFolderPlugin()

qSlicerSubjectHierarchyFolderPlugin::qSlicerSubjectHierarchyFolderPlugin ( QObject *  parent = NULL)

◆ ~qSlicerSubjectHierarchyFolderPlugin()

virtual qSlicerSubjectHierarchyFolderPlugin::~qSlicerSubjectHierarchyFolderPlugin ( )
virtual

Member Function Documentation

◆ addNodeToSubjectHierarchy()

virtual bool qSlicerSubjectHierarchyFolderPlugin::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 from qSlicerSubjectHierarchyAbstractPlugin.

◆ callModifiedOnModelNodesInCurrentBranch()

void qSlicerSubjectHierarchyFolderPlugin::callModifiedOnModelNodesInCurrentBranch ( )
protected

◆ canAddNodeToSubjectHierarchy()

virtual double qSlicerSubjectHierarchyFolderPlugin::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).

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

virtual double qSlicerSubjectHierarchyFolderPlugin::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 from qSlicerSubjectHierarchyAbstractPlugin.

◆ canReparentItemInsideSubjectHierarchy()

virtual double qSlicerSubjectHierarchyFolderPlugin::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 from qSlicerSubjectHierarchyAbstractPlugin.

◆ colorItemAttributeName()

Q_INVOKABLE QString qSlicerSubjectHierarchyFolderPlugin::colorItemAttributeName ( ) const
inline

Name of color attribute in folder subject hierarchy items.

Definition at line 215 of file qSlicerSubjectHierarchyFolderPlugin.h.

◆ createFolderUnderCurrentNode

void qSlicerSubjectHierarchyFolderPlugin::createFolderUnderCurrentNode ( )
protectedslot

Create folder node under current node.

◆ createFolderUnderItem()

Q_INVOKABLE vtkIdType qSlicerSubjectHierarchyFolderPlugin::createFolderUnderItem ( vtkIdType  parentItemID)

Create folder under specified item

Parameters
parentNodeParent item for folder to create

◆ createFolderUnderScene

void qSlicerSubjectHierarchyFolderPlugin::createFolderUnderScene ( )
protectedslot

Create folder node under the scene.

◆ editProperties()

virtual void qSlicerSubjectHierarchyFolderPlugin::editProperties ( vtkIdType  itemID)
virtual

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

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ getDisplayColor()

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

Get display color of an owned subject hierarchy item In case of folders only color is set but no terminology. The properties are not used directly, but only if applied to the branch (similarly to how it worked in model hierarchies).

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ hierarchyNodeForItem()

Q_INVOKABLE vtkMRMLHierarchyNode* qSlicerSubjectHierarchyFolderPlugin::hierarchyNodeForItem ( vtkIdType  itemID)

Get hierarchy node for subject hierarchy item. The item can be associated directly to a hierarchy node (if it's an intermediate hierarchy node), or it can be associated to a data node that is associated to a hierarchy node.

Returns
The hierarchy node associated to the item either directly or indirectly. NULL otherwise

◆ icon()

virtual QIcon qSlicerSubjectHierarchyFolderPlugin::icon ( vtkIdType  itemID)
virtual

Get icon of an owned subject hierarchy item

Returns
Icon to set, NULL if nothing to set

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ itemContextMenuActions()

virtual QList<QAction*> qSlicerSubjectHierarchyFolderPlugin::itemContextMenuActions ( ) const
virtual

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

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ itemForHierarchyNode()

Q_INVOKABLE vtkIdType qSlicerSubjectHierarchyFolderPlugin::itemForHierarchyNode ( vtkMRMLHierarchyNode hierarchyNode)

Get subject hierarchy item for a hierarchy node. The item can be associated directly to a hierarchy node (if it's an intermediate hierarchy node), or it can be associated to a data node that is associated to a hierarchy node.

Returns
ID of the item associated to the hierarchy node directly or indirectly. Invalid ID otherwise.

◆ modelDisplayNodeForItem()

vtkMRMLModelDisplayNode* qSlicerSubjectHierarchyFolderPlugin::modelDisplayNodeForItem ( vtkIdType  itemID) const
protected

Retrieve model display node for given item. If the folder item has an associated model display node (created by the plugin, then return that). Otherwise see if it has a model hierarchy node with a display node.

◆ onApplyColorToBranchToggled

void qSlicerSubjectHierarchyFolderPlugin::onApplyColorToBranchToggled ( bool  )
protectedslot

Toggle apply color to branch.

◆ onDataNodeAssociatedToHierarchyNode

void qSlicerSubjectHierarchyFolderPlugin::onDataNodeAssociatedToHierarchyNode ( vtkObject *  dataNodeObject)
slot

Called when hierarchy modified event is invoked for a data node Ensures that if a hierarchy node gets associated to a data node, then the item for the hierarchy node is removed from subject hierarchy (the logic implemented in the folder plugin handles data nodes with hierarchy nodes)

◆ onHierarchyNodeChildNodeAdded

void qSlicerSubjectHierarchyFolderPlugin::onHierarchyNodeChildNodeAdded ( vtkObject *  parentNodeObject,
vtkObject *  childNodeObject 
)
protectedslot

Called when child node was added to hierarchy node Ensures that the hierarchy specified by node hierarchies are mirrored in subject hierarchy

◆ reparentItemInsideSubjectHierarchy()

virtual bool qSlicerSubjectHierarchyFolderPlugin::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 from qSlicerSubjectHierarchyAbstractPlugin.

◆ resolveHierarchies()

Q_INVOKABLE bool qSlicerSubjectHierarchyFolderPlugin::resolveHierarchies ( )

Resolve all node hierarchy items in the scene. Traverses scene for hierarchy nodes, and makes sure the same parents are set in subject hierarchy

◆ resolveHierarchyForItem()

Q_INVOKABLE bool qSlicerSubjectHierarchyFolderPlugin::resolveHierarchyForItem ( vtkIdType  itemID)

Add the item for the hierarchy node to the proper place in subject hierarchy. If the parent node hierarchy item does not exist yet, add that too, all the way to the scene

◆ roleForPlugin()

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

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

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ sceneContextMenuActions()

virtual QList<QAction*> qSlicerSubjectHierarchyFolderPlugin::sceneContextMenuActions ( ) const
virtual

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.

◆ setDisplayColor()

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

Set display color of an owned subject hierarchy item In case of folders only color is set but no terminology. The properties are not used directly, but only if applied to the branch (similarly to how it worked in model hierarchies).

Parameters
colorDisplay color to set
terminologyMetaDataMap containing terminology meta data. Not used in this plugin

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ showContextMenuActionsForItem()

virtual void qSlicerSubjectHierarchyFolderPlugin::showContextMenuActionsForItem ( vtkIdType  itemID)
virtual

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.

◆ showVisibilityContextMenuActionsForItem()

virtual void qSlicerSubjectHierarchyFolderPlugin::showVisibilityContextMenuActionsForItem ( vtkIdType  itemID)
virtual

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

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

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ visibilityContextMenuActions()

virtual QList<QAction*> qSlicerSubjectHierarchyFolderPlugin::visibilityContextMenuActions ( ) const
virtual

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

See also
showVisibilityContextMenuActionsForItem

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

◆ visibilityIcon()

virtual QIcon qSlicerSubjectHierarchyFolderPlugin::visibilityIcon ( int  visible)
virtual

Get visibility icon for a visibility state.

Reimplemented from qSlicerSubjectHierarchyAbstractPlugin.

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerSubjectHierarchyFolderPluginPrivate> qSlicerSubjectHierarchyFolderPlugin::d_ptr
protected

Definition at line 247 of file qSlicerSubjectHierarchyFolderPlugin.h.


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