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

Singleton class managing Subject Hierarchy plugins. More...

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

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

Properties

bool autoDeleteSubjectHierarchyChildren
 
bool displayPatientBirthDateInSubjectHierarchyItemName
 
bool displayPatientIDInSubjectHierarchyItemName
 
bool displayStudyDateInSubjectHierarchyItemName
 
bool displayStudyIDInSubjectHierarchyItemName
 

Public Member Functions

Q_INVOKABLE QList< qSlicerSubjectHierarchyAbstractPlugin * > allPlugins ()
 Returns all plugins (registered plugins and default plugin) More...
 
Q_INVOKABLE bool autoDeleteSubjectHierarchyChildren () const
 
Q_INVOKABLE vtkIdType currentItem ()
 
Q_INVOKABLE QList< vtkIdType > currentItems ()
 
Q_INVOKABLE void currentItems (vtkIdList *selectedItems)
 
Q_INVOKABLE qSlicerSubjectHierarchyDefaultPlugindefaultPlugin ()
 Get default plugin instance. More...
 
Q_INVOKABLE bool displayPatientBirthDateInSubjectHierarchyItemName () const
 
Q_INVOKABLE bool displayPatientIDInSubjectHierarchyItemName () const
 
Q_INVOKABLE bool displayStudyDateInSubjectHierarchyItemName () const
 
Q_INVOKABLE bool displayStudyIDInSubjectHierarchyItemName () const
 
qSlicerSubjectHierarchyAbstractPluginfindAndSetOwnerPluginForSubjectHierarchyItem (vtkIdType itemID)
 
qSlicerSubjectHierarchyAbstractPluginfindOwnerPluginForSubjectHierarchyItem (vtkIdType itemID)
 
Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugingetOwnerPluginForSubjectHierarchyItem (vtkIdType itemID)
 
Q_INVOKABLE vtkMRMLScenemrmlScene () const
 Get MRML scene. More...
 
void observeSubjectHierarchyNode (vtkMRMLSubjectHierarchyNode *shNode)
 
Q_INVOKABLE qSlicerSubjectHierarchyAbstractPluginpluginByName (QString name)
 
Q_INVOKABLE qSlicerSubjectHierarchyPluginLogicpluginLogic ()
 Get plugin logic. More...
 
QList< qSlicerSubjectHierarchyAbstractPlugin * > pluginsForAddingNodeToSubjectHierarchy (vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID)
 
QList< qSlicerSubjectHierarchyAbstractPlugin * > pluginsForReparentingItemInSubjectHierarchy (vtkIdType itemID, vtkIdType parentItemID)
 
 qSlicerSubjectHierarchyPluginHandler (QObject *parent=nullptr)
 
Q_INVOKABLE QList< qSlicerSubjectHierarchyAbstractPlugin * > registeredPlugins ()
 Get list of registered plugins. More...
 
Q_INVOKABLE bool registerPlugin (qSlicerSubjectHierarchyAbstractPlugin *plugin)
 
qSlicerSubjectHierarchyAbstractPluginselectPluginFromDialog (QString textToDisplay, QList< qSlicerSubjectHierarchyAbstractPlugin *> candidatePlugins)
 
Q_INVOKABLE void setAutoDeleteSubjectHierarchyChildren (bool flag)
 
Q_INVOKABLE void setCurrentItem (vtkIdType itemID)
 
Q_INVOKABLE void setCurrentItems (QList< vtkIdType > items)
 
Q_INVOKABLE void setDisplayPatientBirthDateInSubjectHierarchyItemName (bool on)
 
Q_INVOKABLE void setDisplayPatientIDInSubjectHierarchyItemName (bool on)
 
Q_INVOKABLE void setDisplayStudyDateInSubjectHierarchyItemName (bool on)
 
Q_INVOKABLE void setDisplayStudyIDInSubjectHierarchyItemName (bool on)
 
void setMRMLScene (vtkMRMLScene *scene)
 Set MRML scene. More...
 
Q_INVOKABLE void setPluginLogic (qSlicerSubjectHierarchyPluginLogic *pluginLogic)
 Set plugin logic. More...
 
void showItemsInView (vtkIdList *itemIDsToShow, vtkMRMLAbstractViewNode *viewNode)
 Show a list of items in a selected view (used for drag&drop of items into a view node) More...
 
Q_INVOKABLE vtkMRMLSubjectHierarchyNodesubjectHierarchyNode () const
 Get subject hierarchy node. More...
 
 ~qSlicerSubjectHierarchyPluginHandler () override
 Private destructor made public to enable python wrapping. More...
 

Static Public Member Functions

static Q_INVOKABLE qSlicerSubjectHierarchyPluginHandlerinstance ()
 
static void setInstance (qSlicerSubjectHierarchyPluginHandler *instance)
 Allows cleanup of the singleton at application exit. More...
 

Public Attributes

QDateTime LastPluginRegistrationTime
 Timestamp of the last plugin registration. Used to allow context menus be repopulated if needed. More...
 

Static Protected Member Functions

static void onSubjectHierarchyNodeEvent (vtkObject *caller, unsigned long event, void *clientData, void *callData)
 Handle subject hierarchy node events. More...
 

Protected Attributes

vtkSmartPointer< vtkCallbackCommand > m_CallBack
 Callback handling deletion of the subject hierarchy node. More...
 
QList< vtkIdType > m_CurrentItems
 
qSlicerSubjectHierarchyDefaultPluginm_DefaultPlugin
 
vtkWeakPointer< vtkMRMLScenem_MRMLScene
 MRML scene (to get new subject hierarchy node if the stored one is deleted) More...
 
qSlicerSubjectHierarchyPluginLogicm_PluginLogic {nullptr}
 Plugin logic. More...
 
QList< qSlicerSubjectHierarchyAbstractPlugin * > m_RegisteredPlugins
 List of registered plugin instances. More...
 

Friends

class qSlicerSubjectHierarchyPluginHandlerCleanup
 

Detailed Description

Singleton class managing Subject Hierarchy plugins.

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

Definition at line 55 of file qSlicerSubjectHierarchyPluginHandler.h.

Property Documentation

◆ autoDeleteSubjectHierarchyChildren

bool qSlicerSubjectHierarchyPluginHandler::autoDeleteSubjectHierarchyChildren
readwrite

Flag determining whether children of subject hierarchy nodes are automatically deleted upon deleting a parent subject hierarchy node. By default, a pop-up question asking the user to confirm the deletion of children nodes will be shown.

Definition at line 63 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ displayPatientBirthDateInSubjectHierarchyItemName

bool qSlicerSubjectHierarchyPluginHandler::displayPatientBirthDateInSubjectHierarchyItemName
readwrite

Flag determining whether the patient birth date tag is included in the name of the patient subject hierarchy item name after loading from DICOM. False by default

Definition at line 71 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ displayPatientIDInSubjectHierarchyItemName

bool qSlicerSubjectHierarchyPluginHandler::displayPatientIDInSubjectHierarchyItemName
readwrite

Flag determining whether the patient ID tag is included in the name of the patient subject hierarchy item name after loading from DICOM. True by default

Definition at line 67 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ displayStudyDateInSubjectHierarchyItemName

bool qSlicerSubjectHierarchyPluginHandler::displayStudyDateInSubjectHierarchyItemName
readwrite

Flag determining whether the study date tag is included in the name of the study subject hierarchy item name after loading from DICOM. True by default

Definition at line 79 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ displayStudyIDInSubjectHierarchyItemName

bool qSlicerSubjectHierarchyPluginHandler::displayStudyIDInSubjectHierarchyItemName
readwrite

Flag determining whether the study ID tag is included in the name of the study subject hierarchy item name after loading from DICOM. False by default

Definition at line 75 of file qSlicerSubjectHierarchyPluginHandler.h.

Constructor & Destructor Documentation

◆ qSlicerSubjectHierarchyPluginHandler()

qSlicerSubjectHierarchyPluginHandler::qSlicerSubjectHierarchyPluginHandler ( QObject *  parent = nullptr)

Private constructor made public to enable python wrapping IMPORTANT: Should not be used for creating plugin handler! Use instance() instead.

◆ ~qSlicerSubjectHierarchyPluginHandler()

qSlicerSubjectHierarchyPluginHandler::~qSlicerSubjectHierarchyPluginHandler ( )
override

Private destructor made public to enable python wrapping.

Member Function Documentation

◆ allPlugins()

Q_INVOKABLE QList<qSlicerSubjectHierarchyAbstractPlugin*> qSlicerSubjectHierarchyPluginHandler::allPlugins ( )

Returns all plugins (registered plugins and default plugin)

◆ autoDeleteSubjectHierarchyChildren()

Q_INVOKABLE bool qSlicerSubjectHierarchyPluginHandler::autoDeleteSubjectHierarchyChildren ( ) const

◆ currentItem()

Q_INVOKABLE vtkIdType qSlicerSubjectHierarchyPluginHandler::currentItem ( )

Get current subject hierarchy item (single selection only). This function is called from the plugins when exposing and performing the supported actions. As the plugin actions are not aggregated on multi-selection, this function is never called from plugins in that case (and thus invalid ID is returned). IMPORTANT NOTE: This function is solely used for plugin-provided context menus. This is NOT to be used for getting the selected item of individual widgets (tree views, comboboxes).

Returns
Current item if only one is selected, otherwise INVALID_ITEM_ID

◆ currentItems() [1/2]

Q_INVOKABLE QList<vtkIdType> qSlicerSubjectHierarchyPluginHandler::currentItems ( )

Get current subject hierarchy items in case of multi-selection IMPORTANT NOTE: This function is solely used for plugin-provided context menus. This is NOT to be used for getting the selected items of individual widgets (tree views, comboboxes).

◆ currentItems() [2/2]

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::currentItems ( vtkIdList *  selectedItems)

◆ defaultPlugin()

Q_INVOKABLE qSlicerSubjectHierarchyDefaultPlugin* qSlicerSubjectHierarchyPluginHandler::defaultPlugin ( )

Get default plugin instance.

◆ displayPatientBirthDateInSubjectHierarchyItemName()

Q_INVOKABLE bool qSlicerSubjectHierarchyPluginHandler::displayPatientBirthDateInSubjectHierarchyItemName ( ) const

◆ displayPatientIDInSubjectHierarchyItemName()

Q_INVOKABLE bool qSlicerSubjectHierarchyPluginHandler::displayPatientIDInSubjectHierarchyItemName ( ) const

◆ displayStudyDateInSubjectHierarchyItemName()

Q_INVOKABLE bool qSlicerSubjectHierarchyPluginHandler::displayStudyDateInSubjectHierarchyItemName ( ) const

◆ displayStudyIDInSubjectHierarchyItemName()

Q_INVOKABLE bool qSlicerSubjectHierarchyPluginHandler::displayStudyIDInSubjectHierarchyItemName ( ) const

◆ findAndSetOwnerPluginForSubjectHierarchyItem()

qSlicerSubjectHierarchyAbstractPlugin* qSlicerSubjectHierarchyPluginHandler::findAndSetOwnerPluginForSubjectHierarchyItem ( vtkIdType  itemID)

Find and set plugin that is most suitable to own a subject hierarchy item The best plugins are found based on the confidence numbers they return for the inputs.

Parameters
itemItem to be owned

◆ findOwnerPluginForSubjectHierarchyItem()

qSlicerSubjectHierarchyAbstractPlugin* qSlicerSubjectHierarchyPluginHandler::findOwnerPluginForSubjectHierarchyItem ( vtkIdType  itemID)

Find plugin that is most suitable to own a subject hierarchy item. This method does not set it to the item! The best plugins are found based on the confidence numbers they return for the inputs.

Parameters
itemItem to be owned

◆ getOwnerPluginForSubjectHierarchyItem()

Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin* qSlicerSubjectHierarchyPluginHandler::getOwnerPluginForSubjectHierarchyItem ( vtkIdType  itemID)

Get plugin owning a certain subject hierarchy item. This function doesn't try to find a suitable plugin, it just returns the one already assigned.

◆ instance()

static Q_INVOKABLE qSlicerSubjectHierarchyPluginHandler* qSlicerSubjectHierarchyPluginHandler::instance ( )
static

Instance getter for the singleton class

Returns
Instance object

◆ mrmlScene()

Q_INVOKABLE vtkMRMLScene* qSlicerSubjectHierarchyPluginHandler::mrmlScene ( ) const

Get MRML scene.

◆ observeSubjectHierarchyNode()

void qSlicerSubjectHierarchyPluginHandler::observeSubjectHierarchyNode ( vtkMRMLSubjectHierarchyNode shNode)

Add an observer on the given SH node to watch for changes and react as needed

Parameters
shNodethe subject hierarchy node to observe

◆ onSubjectHierarchyNodeEvent()

static void qSlicerSubjectHierarchyPluginHandler::onSubjectHierarchyNodeEvent ( vtkObject *  caller,
unsigned long  event,
void *  clientData,
void *  callData 
)
staticprotected

Handle subject hierarchy node events.

◆ pluginByName()

Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin* qSlicerSubjectHierarchyPluginHandler::pluginByName ( QString  name)

Get a plugin by name

Returns
The plugin instance if exists, nullptr otherwise

◆ pluginLogic()

Q_INVOKABLE qSlicerSubjectHierarchyPluginLogic* qSlicerSubjectHierarchyPluginHandler::pluginLogic ( )

Get plugin logic.

◆ pluginsForAddingNodeToSubjectHierarchy()

QList<qSlicerSubjectHierarchyAbstractPlugin*> qSlicerSubjectHierarchyPluginHandler::pluginsForAddingNodeToSubjectHierarchy ( vtkMRMLNode node,
vtkIdType  parentItemID = vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID 
)

Returns the plugin that can handle a node the best for adding it from outside to inside the subject hierarchy The best plugins are found based on the confidence numbers they return for the inputs.

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
The most suitable plugins if found, empty list otherwise

◆ pluginsForReparentingItemInSubjectHierarchy()

QList<qSlicerSubjectHierarchyAbstractPlugin*> qSlicerSubjectHierarchyPluginHandler::pluginsForReparentingItemInSubjectHierarchy ( vtkIdType  itemID,
vtkIdType  parentItemID 
)

Returns the plugin that can handle an item the best for reparenting it inside the subject hierarchy The best plugins are found based on the confidence numbers they return for the inputs.

Parameters
itemIDItem to be reparented in the hierarchy
parentItemIDProspective parent of the item to reparent.
Returns
The most suitable plugins if found, empty list otherwise

◆ registeredPlugins()

Q_INVOKABLE QList<qSlicerSubjectHierarchyAbstractPlugin*> qSlicerSubjectHierarchyPluginHandler::registeredPlugins ( )
inline

Get list of registered plugins.

Definition at line 142 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ registerPlugin()

Q_INVOKABLE bool qSlicerSubjectHierarchyPluginHandler::registerPlugin ( qSlicerSubjectHierarchyAbstractPlugin plugin)

Register a plugin

Returns
True if plugin registered successfully, false otherwise

◆ selectPluginFromDialog()

qSlicerSubjectHierarchyAbstractPlugin* qSlicerSubjectHierarchyPluginHandler::selectPluginFromDialog ( QString  textToDisplay,
QList< qSlicerSubjectHierarchyAbstractPlugin *>  candidatePlugins 
)

Used when multiple plugins are found with the same confidence number for an item. Pops up a simple dialog asking to choose one plugin from a list. Note: This should happen very rarely. If happens frequently, then confidence numbers returned by plugins need review.

Parameters
textToDisplayText assembled by the caller displaying the reason and basis (items) of the choice
candidatePluginsList of plugins to choose from
Returns
Plugin chosen by the user

◆ setAutoDeleteSubjectHierarchyChildren()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setAutoDeleteSubjectHierarchyChildren ( bool  flag)

◆ setCurrentItem()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setCurrentItem ( vtkIdType  itemID)

Set current subject hierarchy item (single selection only) IMPORTANT NOTE: This function will not change the selection in individual widgets (tree views, comboboxes). This is solely used for plugin-provided context menus.

◆ setCurrentItems()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setCurrentItems ( QList< vtkIdType >  items)

Set current subject hierarchy items in case of multi-selection IMPORTANT NOTE: This function will not change the selection in individual widgets (tree views, comboboxes). This is solely used for plugin-provided context menus.

◆ setDisplayPatientBirthDateInSubjectHierarchyItemName()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setDisplayPatientBirthDateInSubjectHierarchyItemName ( bool  on)

◆ setDisplayPatientIDInSubjectHierarchyItemName()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setDisplayPatientIDInSubjectHierarchyItemName ( bool  on)

◆ setDisplayStudyDateInSubjectHierarchyItemName()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setDisplayStudyDateInSubjectHierarchyItemName ( bool  on)

◆ setDisplayStudyIDInSubjectHierarchyItemName()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setDisplayStudyIDInSubjectHierarchyItemName ( bool  on)

◆ setInstance()

static void qSlicerSubjectHierarchyPluginHandler::setInstance ( qSlicerSubjectHierarchyPluginHandler instance)
static

Allows cleanup of the singleton at application exit.

◆ setMRMLScene()

void qSlicerSubjectHierarchyPluginHandler::setMRMLScene ( vtkMRMLScene scene)

Set MRML scene.

◆ setPluginLogic()

Q_INVOKABLE void qSlicerSubjectHierarchyPluginHandler::setPluginLogic ( qSlicerSubjectHierarchyPluginLogic pluginLogic)

Set plugin logic.

◆ showItemsInView()

void qSlicerSubjectHierarchyPluginHandler::showItemsInView ( vtkIdList *  itemIDsToShow,
vtkMRMLAbstractViewNode viewNode 
)

Show a list of items in a selected view (used for drag&drop of items into a view node)

◆ subjectHierarchyNode()

Q_INVOKABLE vtkMRMLSubjectHierarchyNode* qSlicerSubjectHierarchyPluginHandler::subjectHierarchyNode ( ) const

Get subject hierarchy node.

Friends And Related Function Documentation

◆ qSlicerSubjectHierarchyPluginHandlerCleanup

friend class qSlicerSubjectHierarchyPluginHandlerCleanup
friend

Definition at line 241 of file qSlicerSubjectHierarchyPluginHandler.h.

Member Data Documentation

◆ LastPluginRegistrationTime

QDateTime qSlicerSubjectHierarchyPluginHandler::LastPluginRegistrationTime

Timestamp of the last plugin registration. Used to allow context menus be repopulated if needed.

Definition at line 237 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ m_CallBack

vtkSmartPointer<vtkCallbackCommand> qSlicerSubjectHierarchyPluginHandler::m_CallBack
protected

Callback handling deletion of the subject hierarchy node.

Definition at line 226 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ m_CurrentItems

QList<vtkIdType> qSlicerSubjectHierarchyPluginHandler::m_CurrentItems
protected

Current subject hierarchy item(s) (selected items in the tree view e.g. for context menu request)

Definition at line 217 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ m_DefaultPlugin

qSlicerSubjectHierarchyDefaultPlugin* qSlicerSubjectHierarchyPluginHandler::m_DefaultPlugin
protected

Instance of the default plugin to access it if there is no suitable plugin found (the default plugin instance cannot be in the registered list, as then it would never be returned)

Definition at line 213 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ m_MRMLScene

vtkWeakPointer<vtkMRMLScene> qSlicerSubjectHierarchyPluginHandler::m_MRMLScene
protected

MRML scene (to get new subject hierarchy node if the stored one is deleted)

Definition at line 220 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ m_PluginLogic

qSlicerSubjectHierarchyPluginLogic* qSlicerSubjectHierarchyPluginHandler::m_PluginLogic {nullptr}
protected

Plugin logic.

Definition at line 223 of file qSlicerSubjectHierarchyPluginHandler.h.

◆ m_RegisteredPlugins

QList<qSlicerSubjectHierarchyAbstractPlugin*> qSlicerSubjectHierarchyPluginHandler::m_RegisteredPlugins
protected

List of registered plugin instances.

Definition at line 209 of file qSlicerSubjectHierarchyPluginHandler.h.


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