Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerAbstractCoreModule.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerAbstractCoreModule_h
22 #define __qSlicerAbstractCoreModule_h
23 
24 // Qt includes
25 #include <QObject>
26 #include <QStringList>
27 
28 // CTK includes
29 #include <ctkPimpl.h>
30 
31 // QTBase includes
32 #include "qSlicerBaseQTCoreExport.h"
33 
37 class vtkMRMLScene;
38 class qSlicerAbstractCoreModulePrivate;
39 
40 
41 #define qSlicerGetTitleMacro(_TITLE) \
42  static QString staticTitle() { return _TITLE; } \
43  QString title() const override { return _TITLE; }
44 
46 //
55 class Q_SLICER_BASE_QTCORE_EXPORT qSlicerAbstractCoreModule : public QObject
56 {
59  Q_OBJECT
60 
63 
73  Q_PROPERTY(QString name READ name)
74 
75 
76  Q_PROPERTY(QString title READ title)
82 
83 
84  Q_PROPERTY(QStringList categories READ categories)
93 
94 
95  Q_PROPERTY(int index READ index)
102 
103 
104  Q_PROPERTY(bool hidden READ isHidden)
109 
110 
111  Q_PROPERTY(bool widgetRepresentationCreationEnabled
116  READ isWidgetRepresentationCreationEnabled
117  WRITE setWidgetRepresentationCreationEnabled)
118 
119 
120  Q_PROPERTY(QString helpText READ helpText)
124 
125 
126  Q_PROPERTY(QString acknowledgementText READ acknowledgementText)
133 
134 
135  Q_PROPERTY(QStringList contributors READ contributors)
142 
143 
144  Q_PROPERTY(QString slicerWikiUrl READ slicerWikiUrl)
148 
149 
150  Q_PROPERTY(QString defaultDocumentationLink READ defaultDocumentationLink);
153 
160  Q_PROPERTY(QStringList dependencies READ dependencies)
161 
162 
163  Q_PROPERTY(QString path READ path)
169 
170 
171  Q_PROPERTY(bool isInstalled READ isInstalled)
175 
176 
177  Q_PROPERTY(bool isBuiltIn READ isBuiltIn)
181 
182 
183  Q_PROPERTY(QStringList associatedNodeTypes READ associatedNodeTypes)
192 
193 public:
194 
195  typedef QObject Superclass;
201  qSlicerAbstractCoreModule(QObject *parent=nullptr);
202  ~qSlicerAbstractCoreModule() override;
203 
204  virtual void printAdditionalInfo();
205 
207  QString slicerWikiUrl()const{ return "http://www.slicer.org/slicerWiki/index.php"; }
208 
213  QString defaultDocumentationLink()const;
214 
217  void initialize(vtkSlicerApplicationLogic* appLogic);
218 
222  virtual QString name()const;
223  virtual void setName(const QString& name);
224 
227  virtual QString title()const = 0;
228 
234  virtual QStringList categories()const;
235 
237  virtual int index()const;
238 
243  virtual bool isHidden()const;
244 
246  virtual QStringList contributors()const;
247 
250  virtual QString helpText()const;
251 
254  virtual QString acknowledgementText()const;
255 
259  bool isWidgetRepresentationCreationEnabled()const;
260  void setWidgetRepresentationCreationEnabled(bool value);
261 
266  qSlicerAbstractModuleRepresentation* widgetRepresentation();
267 
273  qSlicerAbstractModuleRepresentation* createNewWidgetRepresentation();
274 
277  void setAppLogic(vtkSlicerApplicationLogic* appLogic);
278  vtkSlicerApplicationLogic* appLogic() const;
279 
284  Q_INVOKABLE vtkMRMLAbstractLogic* logic();
285 
287  Q_INVOKABLE vtkMRMLScene* mrmlScene() const;
288 
289  virtual QStringList dependencies()const;
290 
293  QString path()const;
294  void setPath(const QString& newPath);
295 
298  bool isInstalled()const;
299  void setInstalled(bool value);
300 
303  bool isBuiltIn()const;
304  void setBuiltIn(bool value);
305 
307  virtual QStringList associatedNodeTypes()const;
308 
309 public slots:
310 
313  virtual void setMRMLScene(vtkMRMLScene*);
314 
315 protected:
317  virtual void setup() = 0;
318 
320  virtual qSlicerAbstractModuleRepresentation* createWidgetRepresentation() = 0;
321 
324  virtual vtkMRMLAbstractLogic* createLogic() = 0;
325 
326 protected:
327  QScopedPointer<qSlicerAbstractCoreModulePrivate> d_ptr;
328 
329 private:
330  Q_DECLARE_PRIVATE(qSlicerAbstractCoreModule);
331  Q_DISABLE_COPY(qSlicerAbstractCoreModule);
333 
336  void representationDeleted(qSlicerAbstractModuleRepresentation *representation);
337 };
338 
339 #endif
Superclass for MRML logic classes.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:60
QScopedPointer< qSlicerAbstractCoreModulePrivate > d_ptr
qSlicerAbstractCoreModule is the base class of any module in Slicer.
QString slicerWikiUrl() const
Convenience method to return slicer wiki URL.