Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerTerminologyNavigatorWidget.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6  Queen's University, Kingston, ON, Canada. All Rights Reserved.
7 
8  See COPYRIGHT.txt
9  or http://www.slicer.org/copyright/copyright.txt for details.
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16 
17  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18  and was supported through the Applied Cancer Research Unit program of Cancer Care
19  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20 
21 ==============================================================================*/
22 
23 #ifndef __qSlicerTerminologyNavigatorWidget_h
24 #define __qSlicerTerminologyNavigatorWidget_h
25 
26 // MRMLWidgets includes
27 #include "qMRMLWidget.h"
28 
29 // Terminologies includes
30 #include "qSlicerTerminologiesModuleWidgetsExport.h"
31 
33 
34 // CTK includes
35 #include <ctkPimpl.h>
36 #include <ctkVTKObject.h>
37 
38 class qSlicerTerminologyNavigatorWidgetPrivate;
39 
40 class QTableWidgetItem;
41 class QColor;
44 
48 class Q_SLICER_MODULE_TERMINOLOGIES_WIDGETS_EXPORT qSlicerTerminologyNavigatorWidget : public qMRMLWidget
49 {
50  Q_OBJECT
51  QVTK_OBJECT
52 
53  Q_PROPERTY(bool anatomicRegionSectionVisible READ anatomicRegionSectionVisible WRITE setAnatomicRegionSectionVisible)
54 
55 
56  enum TerminologyItemDataRole
57  {
58  CodingSchemeDesignatorRole = Qt::UserRole + 100,
59  CodeValueRole
60  };
61 
62 public:
64  explicit qSlicerTerminologyNavigatorWidget(QWidget* parent = 0);
67 
69  {
70  public:
72  TerminologyInfoBundle(vtkSlicerTerminologyEntry* entry, QString name, bool nameAutoGenerated, QColor color, bool colorAutoGenerated, QColor generatedColor);
74  const TerminologyInfoBundle& operator=(const TerminologyInfoBundle& other);
75  vtkSlicerTerminologyEntry* GetTerminologyEntry();
76 
77  QString Name;
79  QColor Color;
82  private:
83  vtkSlicerTerminologyEntry* TerminologyEntry;
84  };
85 
88  void terminologyInfo(TerminologyInfoBundle &terminologyInfo);
90  void setTerminologyInfo(TerminologyInfoBundle &terminologyInfo);
91 
94  bool terminologyEntry(vtkSlicerTerminologyEntry* entry);
97  bool setTerminologyEntry(vtkSlicerTerminologyEntry* entry);
98 
100  bool anatomicRegionSectionVisible() const;
101 
103  Q_INVOKABLE static QString nameFromTerminology(vtkSlicerTerminologyEntry* entry);
105  QString nameFromCurrentTerminology();
107  Q_INVOKABLE static QColor recommendedColorFromTerminology(vtkSlicerTerminologyEntry* entry);
109  QColor recommendedColorFromCurrentTerminology();
110 
111 public slots:
113  void setAnatomicRegionSectionVisible(bool);
114 
116  void setCurrentTerminology(QString terminologyName);
119  bool setCurrentCategory(vtkSlicerTerminologyCategory* category);
122  bool setCurrentType(vtkSlicerTerminologyType* type);
125  bool setCurrentTypeModifier(vtkSlicerTerminologyType* modifier);
127  void setCurrentAnatomicContext(QString contextName);
130  bool setCurrentRegion(vtkSlicerTerminologyType* region);
133  bool setCurrentRegionModifier(vtkSlicerTerminologyType* modifier);
134 
135 protected:
137  void populateTerminologyComboBox();
139  void populateCategoryTable();
141  void populateTypeTable();
143  void populateTypeModifierComboBox();
144 
146  void populateAnatomicContextComboBox();
148  void populateRegionTable();
150  void populateRegionModifierComboBox();
151 
153  void copyContextToUserDirectory(QString filePath);
154 
155 protected slots:
156  void onTerminologySelectionChanged(int);
157  void onCategorySelected(QTableWidgetItem*,QTableWidgetItem*);
158  void onTypeSelected(QTableWidgetItem*,QTableWidgetItem*);
159  void onTypeModifierSelectionChanged(int);
160  void onCategorySearchTextChanged(QString);
161  void onTypeSearchTextChanged(QString);
162 
163  void onAnatomicContextSelectionChanged(int);
164  void onRegionSelected(QTableWidgetItem*,QTableWidgetItem*);
165  void onRegionModifierSelectionChanged(int);
166  void onRegionSearchTextChanged(QString);
167 
168  void onNameChanged(QString);
169  void onResetNameClicked();
170  void onColorChanged(QColor);
171  void onResetColorClicked();
172 
173  void onLoadTerminologyClicked();
174  void onLoadAnatomicContextClicked();
175 
176  void onLogicModified();
177 
178 signals:
180  void selectionValidityChanged(bool);
181 
182 protected:
183  QScopedPointer<qSlicerTerminologyNavigatorWidgetPrivate> d_ptr;
184 
185 private:
186  Q_DECLARE_PRIVATE(qSlicerTerminologyNavigatorWidget);
187  Q_DISABLE_COPY(qSlicerTerminologyNavigatorWidget);
188 };
189 
190 #endif
QScopedPointer< qSlicerTerminologyNavigatorWidgetPrivate > d_ptr
Terminology property type object.
Base class for any widget that requires a MRML Scene.
Definition: qMRMLWidget.h:35
Qt widget for browsing a terminology dictionary. DICOM properties of the selected entry can also be s...
Terminology property category object.