Slicer  4.8
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  virtual QString title()const { 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)
147 
148 
149  Q_PROPERTY(QStringList dependencies READ dependencies)
155 
156 
157  Q_PROPERTY(QString path READ path)
163 
164 
165  Q_PROPERTY(bool isInstalled READ isInstalled)
169 
170 
171  Q_PROPERTY(bool isBuiltIn READ isBuiltIn)
175 
176 
177  Q_PROPERTY(QStringList associatedNodeTypes READ associatedNodeTypes)
186 
187 public:
188 
189  typedef QObject Superclass;
195  qSlicerAbstractCoreModule(QObject *parent=0);
196  virtual ~qSlicerAbstractCoreModule();
197 
198  virtual void printAdditionalInfo();
199 
201  QString slicerWikiUrl()const{ return "http://www.slicer.org/slicerWiki/index.php"; }
202 
205  void initialize(vtkSlicerApplicationLogic* appLogic);
206  inline bool initialized() { return this->Initialized; }
207 
211  virtual QString name()const;
212  virtual void setName(const QString& name);
213 
216  virtual QString title()const = 0;
217 
223  virtual QStringList categories()const;
224 
226  virtual int index()const;
227 
232  virtual bool isHidden()const;
233 
235  virtual QStringList contributors()const;
236 
239  virtual QString helpText()const;
240 
243  virtual QString acknowledgementText()const;
244 
248  bool isWidgetRepresentationCreationEnabled()const;
249  void setWidgetRepresentationCreationEnabled(bool value);
250 
255  qSlicerAbstractModuleRepresentation* widgetRepresentation();
256 
262  qSlicerAbstractModuleRepresentation* createNewWidgetRepresentation();
263 
266  void setAppLogic(vtkSlicerApplicationLogic* appLogic);
267  vtkSlicerApplicationLogic* appLogic() const;
268 
273  Q_INVOKABLE vtkMRMLAbstractLogic* logic();
274 
276  Q_INVOKABLE vtkMRMLScene* mrmlScene() const;
277 
278  virtual QStringList dependencies()const;
279 
282  QString path()const;
283  void setPath(const QString& newPath);
284 
287  bool isInstalled()const;
288  void setInstalled(bool value);
289 
292  bool isBuiltIn()const;
293  void setBuiltIn(bool value);
294 
296  virtual QStringList associatedNodeTypes()const;
297 
298 public slots:
299 
302  virtual void setMRMLScene(vtkMRMLScene*);
303 
304 protected:
306  virtual void setup() = 0;
307 
309  virtual qSlicerAbstractModuleRepresentation* createWidgetRepresentation() = 0;
310 
313  virtual vtkMRMLAbstractLogic* createLogic() = 0;
314 
315 protected:
316  QScopedPointer<qSlicerAbstractCoreModulePrivate> d_ptr;
317 
318 private:
319  Q_DECLARE_PRIVATE(qSlicerAbstractCoreModule);
320  Q_DISABLE_COPY(qSlicerAbstractCoreModule);
322 
325  void representationDeleted(qSlicerAbstractModuleRepresentation *representation);
327  bool Initialized;
328 };
329 
330 #endif
Superclass for MRML logic classes.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
QScopedPointer< qSlicerAbstractCoreModulePrivate > d_ptr
qSlicerAbstractCoreModule is the base class of any module in Slicer.
QString slicerWikiUrl() const
Convenient method to return slicer wiki URL.