Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members
qSlicerAbstractCoreModule Class Referenceabstract

qSlicerAbstractCoreModule is the base class of any module in Slicer. More...

#include <Base/QTCore/qSlicerAbstractCoreModule.h>

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

and not \a title.

Any object deriving from QObject must have the Q_OBJECT macro in order to have the signal/slots working and the meta-class name valid. The following properties are added to the meta-class and though are available through PythonQt. This property contains the name of the module. e.g. "Volumes", "VolumeRendering", "SampleData"... The name identifies a module and must be unique. In comparison to title, name contains only letter characters, no space/hyphen/apostrophe. The module name is set by the module factory (the registered item key string). Because name is unique, slots and functions that take a module as argument should use

typedef QObject Superclass
 
QString name
 
QString title
 
QStringList categories
 
int index
 
bool hidden
 
bool widgetRepresentationCreationEnabled
 
QString helpText
 
QString acknowledgementText
 
QStringList contributors
 
QString slicerWikiUrl
 
QString defaultDocumentationLink
 
QStringList dependencies
 
QString path
 
bool isInstalled
 
bool isBuiltIn
 
QStringList associatedNodeTypes
 
QScopedPointer< qSlicerAbstractCoreModulePrivate > d_ptr
 
class qSlicerAbstractModuleRepresentation
 
 qSlicerAbstractCoreModule (QObject *parent=nullptr)
 
 ~qSlicerAbstractCoreModule () override
 
virtual void printAdditionalInfo ()
 
QString slicerWikiUrl () const
 Convenience method to return slicer wiki URL. More...
 
QString defaultDocumentationLink () const
 
void initialize (vtkSlicerApplicationLogic *appLogic)
 
virtual QString name () const
 
virtual void setName (const QString &name)
 
virtual QString title () const =0
 
virtual QStringList categories () const
 
virtual int index () const
 Return the category index of the module. More...
 
virtual bool isHidden () const
 
virtual QStringList contributors () const
 Return the contributors of the module. More...
 
virtual QString helpText () const
 
virtual QString acknowledgementText () const
 
bool isWidgetRepresentationCreationEnabled () const
 
void setWidgetRepresentationCreationEnabled (bool value)
 
qSlicerAbstractModuleRepresentationwidgetRepresentation ()
 
qSlicerAbstractModuleRepresentationcreateNewWidgetRepresentation ()
 
void setAppLogic (vtkSlicerApplicationLogic *appLogic)
 
vtkSlicerApplicationLogicappLogic () const
 
vtkMRMLAbstractLogicmoduleLogic (const QString &moduleName) const
 Convenience method for getting another module's logic from appLogic. More...
 
Q_INVOKABLE vtkMRMLAbstractLogiclogic ()
 
Q_INVOKABLE vtkMRMLScenemrmlScene () const
 Return a pointer on the MRML scene. More...
 
virtual QStringList dependencies () const
 
QString path () const
 
void setPath (const QString &newPath)
 
bool isInstalled () const
 
void setInstalled (bool value)
 
bool isBuiltIn () const
 
void setBuiltIn (bool value)
 
virtual QStringList associatedNodeTypes () const
 Return node types associated with this module (e.g., node types this module can edit) More...
 
virtual void setMRMLScene (vtkMRMLScene *)
 
virtual void setup ()=0
 All initialization code should be done in the setup. More...
 
virtual qSlicerAbstractModuleRepresentationcreateWidgetRepresentation ()=0
 Create and return a widget representation for the module. More...
 
virtual vtkMRMLAbstractLogiccreateLogic ()=0
 

Detailed Description

qSlicerAbstractCoreModule is the base class of any module in Slicer.

Core modules, Loadable modules, CLI modules derive from it. It is responsible to create the UI and the Logic: createWidgetRepresentation() and createLogic() must be reimplemented in derived classes. A Slicer module has a name and a title: The name is its UID, the title displayed to the user. When a MRML scene is set to the module, the module set the scene to the UI widget and the logic.

Definition at line 55 of file qSlicerAbstractCoreModule.h.

Member Typedef Documentation

◆ Superclass

Definition at line 195 of file qSlicerAbstractCoreModule.h.

Property Documentation

◆ acknowledgementText

QString qSlicerAbstractCoreModule::acknowledgementText
read

This property holds the acknowledgments for the module Credits (organization, grants, thanks...) can be given and are displayed in the acknowledgment tab in the module panel. The contributors of the module will automatically be appended when needed, don't duplicate the information in the acknowledgements. acknowledgementText() must be reimplemented for each module.

See also
helpText, contributors

Definition at line 132 of file qSlicerAbstractCoreModule.h.

◆ associatedNodeTypes

QStringList qSlicerAbstractCoreModule::associatedNodeTypes
read

This property specifies node classes this module is associated with. All children node classes are also associated with the module. Currently association is only used for editing node properties. If a node class is specified in this property and setEditedNode() and nodeEditable() methods are implemented in the module's widget then "Edit properties" function in node selector widgets will activate this module and select the chosen node. Any module can associate nodes with any module, by calling qSlicerApplication::application()->registerNodeModule() method.

Definition at line 191 of file qSlicerAbstractCoreModule.h.

◆ categories

QStringList qSlicerAbstractCoreModule::categories
read

This property holds the categories a module belongs to. It is used to organize modules in the modules menu. Sub-categories are supported by using '.' as a a separator to specify a subcategory (no depth limit), e.g.: "Filtering.Arithmetic". A category doesn't have to exist, it will be created if needed. The method categories() must be reimplemented for each module. An empty category means the module shows up at the top level. It is possible to define more than 1 category, the module will then be visible in all the listed categories

Definition at line 92 of file qSlicerAbstractCoreModule.h.

◆ contributors

QStringList qSlicerAbstractCoreModule::contributors
read

This property holds the authors of the module It is shown in the Acknowledgement page. If there are multiple contributors, they must be listed in the order of contribution. For each contributor, the name of the institution can succeed the author: e.g. John Doe, CompanyName Inc. contributors() must be reimplemented for each module.

See also
helpText, acknowledgementText

Definition at line 141 of file qSlicerAbstractCoreModule.h.

◆ defaultDocumentationLink

QString qSlicerAbstractCoreModule::defaultDocumentationLink
read

Auto-generated string that contains a paragraph that links to the default module documentation location on ReadTheDocs. It can be used in the help/acknowledgement.

Definition at line 152 of file qSlicerAbstractCoreModule.h.

◆ dependencies

QStringList qSlicerAbstractCoreModule::dependencies
read

This property holds the module name list of the module dependencies. It is used to order the loading of the modules. When setup() is called it is ensured that all the dependencies have already been setup. There is no dependency cycle check, so special care must be taken to avoid infinite loop. By default, there is no dependencies.

Definition at line 152 of file qSlicerAbstractCoreModule.h.

◆ helpText

QString qSlicerAbstractCoreModule::helpText
read

This property holds the help of the module. The help is displayed inside the module as a tab. helpText must be reimplemented for each module.

See also
acknowledgement, contributors

Definition at line 123 of file qSlicerAbstractCoreModule.h.

◆ hidden

bool qSlicerAbstractCoreModule::hidden
read

This property holds whether the module is visible to the user. If the module is hidden, it doesn't appear in the list of modules menu. However, the module is programmatically accessible. By default, modules are visible (hidden == false).

See also
isHidden

Definition at line 108 of file qSlicerAbstractCoreModule.h.

◆ index

int qSlicerAbstractCoreModule::index
read

This property controls the index used to sort modules in the module selector's menu in the module's category. An index of 0 means the module should be first in the category, a value of 1 if the module should be second and so on. -1 means that the module should be added at the end. In case modules indexes have the same index, the alphabetical order will be used. -1 by default.

Definition at line 101 of file qSlicerAbstractCoreModule.h.

◆ isBuiltIn

bool qSlicerAbstractCoreModule::isBuiltIn
read

This property holds whether module is a built-in Slicer module or one from an extension or any user-specified folder. isBuiltIn is set by the module factory and shouldn't be reimplemented in each module.

Definition at line 180 of file qSlicerAbstractCoreModule.h.

◆ isInstalled

bool qSlicerAbstractCoreModule::isInstalled
read

This property holds whether the module is loaded from an installed directory. isInstalled is set by the module factory and shouldn't be reimplemented in each module.

Definition at line 174 of file qSlicerAbstractCoreModule.h.

◆ name

QString qSlicerAbstractCoreModule::name
read

Definition at line 73 of file qSlicerAbstractCoreModule.h.

◆ path

QString qSlicerAbstractCoreModule::path
read

This property holds the path of the module if any. The path is the library (dll, so...) location on disk. path is set by the module factory and shouldn't be reimplemented in each module.

Todo:
Ideally this function should be added within the qSlicerLoadableModule.

Definition at line 168 of file qSlicerAbstractCoreModule.h.

◆ slicerWikiUrl

QString qSlicerAbstractCoreModule::slicerWikiUrl
read

This property holds the URL of the module for the Slicer wiki. It can be used in the help/acknowledgement. This method is being phased out, as module documentations is moving to ReadTheDocs. Modules that already documented on ReadTheDocs can use defaultDocumentationLink property instead.

Definition at line 147 of file qSlicerAbstractCoreModule.h.

◆ title

QString qSlicerAbstractCoreModule::title
read

This property contains the title of the module. e.g. "Volumes", "Volume Rendering", "Welcome to Slicer"... title (not name) is displayed to the user in the GUI (but internally name is used to uniquely identify the module). The module title can contain any characters. title() must be overwritten for each module.

Definition at line 81 of file qSlicerAbstractCoreModule.h.

◆ widgetRepresentationCreationEnabled

bool qSlicerAbstractCoreModule::widgetRepresentationCreationEnabled
readwrite

This property holds whether the module should be able to create new widget representations or not. By default, modules can create new widget representations.

See also
isWidgetRepresentationCreationEnabled
setWidgetRepresentationCreationEnabled

Definition at line 117 of file qSlicerAbstractCoreModule.h.

Constructor & Destructor Documentation

◆ qSlicerAbstractCoreModule()

qSlicerAbstractCoreModule::qSlicerAbstractCoreModule ( QObject *  parent = nullptr)

Constructor Warning: If there is no parent given, make sure you delete the object. The modules can typically be instantiated before the application is initialized (module manager, iomanager...). Most of the initialization must be done in qSlicerAbstractCoreModule::setup()

◆ ~qSlicerAbstractCoreModule()

qSlicerAbstractCoreModule::~qSlicerAbstractCoreModule ( )
override

Member Function Documentation

◆ acknowledgementText()

virtual QString qSlicerAbstractCoreModule::acknowledgementText ( ) const
virtual

◆ appLogic()

vtkSlicerApplicationLogic* qSlicerAbstractCoreModule::appLogic ( ) const

◆ associatedNodeTypes()

virtual QStringList qSlicerAbstractCoreModule::associatedNodeTypes ( ) const
virtual

◆ categories()

virtual QStringList qSlicerAbstractCoreModule::categories ( ) const
virtual

◆ contributors()

virtual QStringList qSlicerAbstractCoreModule::contributors ( ) const
virtual

◆ createLogic()

virtual vtkMRMLAbstractLogic* qSlicerAbstractCoreModule::createLogic ( )
protectedpure virtual

◆ createNewWidgetRepresentation()

qSlicerAbstractModuleRepresentation* qSlicerAbstractCoreModule::createNewWidgetRepresentation ( )

Force the creation of a new widget representation. It does not return the widget of the module, but a new instance instead. It can be useful when embedding a module widget into another module.

See also
widgetRepresentation(), createWidgetRepresentation()
isWidgetRepresentationCreationEnabled()

◆ createWidgetRepresentation()

virtual qSlicerAbstractModuleRepresentation* qSlicerAbstractCoreModule::createWidgetRepresentation ( )
protectedpure virtual

◆ defaultDocumentationLink()

QString qSlicerAbstractCoreModule::defaultDocumentationLink ( ) const

Convenience method that returns a string that can be inserted into the application help text that contains link to the module's documentation in current Slicer version's documentation on ReadTheDocs. The text is "For more information, see the online documentation." and it points to https://slicer.readthedocs.io/en/(version)/user_guide/modules/(modulename).html

◆ dependencies()

virtual QStringList qSlicerAbstractCoreModule::dependencies ( ) const
virtual

◆ helpText()

virtual QString qSlicerAbstractCoreModule::helpText ( ) const
virtual

◆ index()

virtual int qSlicerAbstractCoreModule::index ( ) const
virtual

Return the category index of the module.

Reimplemented in qSlicerScriptedLoadableModule, and qSlicerCLIModule.

◆ initialize()

void qSlicerAbstractCoreModule::initialize ( vtkSlicerApplicationLogic appLogic)

Initialize the module, an appLogic must be given to initialize the module

◆ isBuiltIn()

bool qSlicerAbstractCoreModule::isBuiltIn ( ) const

Determine if this module is a built-in Slicer module or one from an extension or any user-specified folder.

◆ isHidden()

virtual bool qSlicerAbstractCoreModule::isHidden ( ) const
virtual

Returns true if the module should be hidden to the user. By default, interactive modules are visible and non-interactive modules are hidden.

See also
hidden, isWidgetRepresentationCreationEnabled

Reimplemented in qSlicerScriptedLoadableModule, qSlicerSubjectHierarchyModule, qSlicerUnitsModule, and qSlicerColorsModule.

◆ isInstalled()

bool qSlicerAbstractCoreModule::isInstalled ( ) const

Return true is this instance of the module is loaded from an installed directory

Todo:
Ideally this function should be added within the qSlicerLoadableModule.

◆ isWidgetRepresentationCreationEnabled()

bool qSlicerAbstractCoreModule::isWidgetRepresentationCreationEnabled ( ) const

Set/Get if the module should be able to create new widget representations or not.

See also
widgetRepresentation()

◆ logic()

Q_INVOKABLE vtkMRMLAbstractLogic* qSlicerAbstractCoreModule::logic ( )

This method allows to get a pointer to the module logic. If no moduleLogic already exists, one will be created calling the 'createLogic' method. A module logic is typically a vtkSlicerModuleLogic but not necessarily.

◆ moduleLogic()

vtkMRMLAbstractLogic* qSlicerAbstractCoreModule::moduleLogic ( const QString &  moduleName) const

Convenience method for getting another module's logic from appLogic.

◆ mrmlScene()

Q_INVOKABLE vtkMRMLScene* qSlicerAbstractCoreModule::mrmlScene ( ) const

Return a pointer on the MRML scene.

◆ name()

virtual QString qSlicerAbstractCoreModule::name ( ) const
virtual

Set/Get the name of the module. The name is used to uniquely describe a module: name must be unique. The name is set by the module factory (the registered item key string).

◆ path()

QString qSlicerAbstractCoreModule::path ( ) const

Returns path if any

Todo:
Ideally this function should be added within the qSlicerLoadableModule.

◆ printAdditionalInfo()

virtual void qSlicerAbstractCoreModule::printAdditionalInfo ( )
virtual

◆ setAppLogic()

void qSlicerAbstractCoreModule::setAppLogic ( vtkSlicerApplicationLogic appLogic)

Get/Set the application logic. It must be set.

◆ setBuiltIn()

void qSlicerAbstractCoreModule::setBuiltIn ( bool  value)

◆ setInstalled()

void qSlicerAbstractCoreModule::setInstalled ( bool  value)

◆ setMRMLScene

virtual void qSlicerAbstractCoreModule::setMRMLScene ( vtkMRMLScene )
virtualslot

Set the current MRML scene to the module, it is propagated to the logic and representations if any

Reimplemented in qSlicerViewControllersModule, qSlicerMarkupsModule, and qSlicerColorsModule.

◆ setName()

virtual void qSlicerAbstractCoreModule::setName ( const QString &  name)
virtual

◆ setPath()

void qSlicerAbstractCoreModule::setPath ( const QString &  newPath)

◆ setup()

virtual void qSlicerAbstractCoreModule::setup ( )
protectedpure virtual

◆ setWidgetRepresentationCreationEnabled()

void qSlicerAbstractCoreModule::setWidgetRepresentationCreationEnabled ( bool  value)

◆ slicerWikiUrl()

QString qSlicerAbstractCoreModule::slicerWikiUrl ( ) const
inline

Convenience method to return slicer wiki URL.

Definition at line 207 of file qSlicerAbstractCoreModule.h.

◆ title()

virtual QString qSlicerAbstractCoreModule::title ( ) const
pure virtual

Title of the module, (displayed to the user) title() must be reimplemented in derived classes.

Implemented in qSlicerCLIModule, and qSlicerScriptedLoadableModule.

◆ widgetRepresentation()

qSlicerAbstractModuleRepresentation* qSlicerAbstractCoreModule::widgetRepresentation ( )

This method allows to get a pointer to the WidgetRepresentation. If no WidgetRepresentation already exists, one will be created calling 'createWidgetRepresentation' method.

See also
createNewWidgetRepresentation(), createWidgetRepresentation()

Friends And Related Function Documentation

◆ qSlicerAbstractModuleRepresentation

Definition at line 335 of file qSlicerAbstractCoreModule.h.

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerAbstractCoreModulePrivate> qSlicerAbstractCoreModule::d_ptr
protected

Definition at line 330 of file qSlicerAbstractCoreModule.h.


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