Slicer  4.10
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 QColor;
41 class QTableWidgetItem;
42 class QItemSelection;
45 
49 class Q_SLICER_MODULE_TERMINOLOGIES_WIDGETS_EXPORT qSlicerTerminologyNavigatorWidget : public qMRMLWidget
50 {
51  Q_OBJECT
52  QVTK_OBJECT
53 
54  Q_PROPERTY(bool anatomicRegionSectionVisible READ anatomicRegionSectionVisible WRITE setAnatomicRegionSectionVisible)
55 
56 
57  enum TerminologyItemDataRole
58  {
59  CodingSchemeDesignatorRole = Qt::UserRole + 100,
60  CodeValueRole,
61  // Roles for type items referencing category
62  CategoryCodingSchemeDesignatorRole,
63  CategoryCodeValueRole,
64  CategoryCodeMeaningRole,
65  // Last role (always keep last)
66  LastTerminologyRole
67  };
68 
69 public:
71  explicit qSlicerTerminologyNavigatorWidget(QWidget* parent = 0);
74 
76  {
77  public:
79  TerminologyInfoBundle(vtkSlicerTerminologyEntry* entry, QString name, bool nameAutoGenerated, QColor color, bool colorAutoGenerated, QColor generatedColor);
81  const TerminologyInfoBundle& operator=(const TerminologyInfoBundle& other);
82  vtkSlicerTerminologyEntry* GetTerminologyEntry();
83 
84  QString Name;
86  QColor Color;
89  private:
90  vtkSlicerTerminologyEntry* TerminologyEntry;
91  };
92 
95  void terminologyInfo(TerminologyInfoBundle &terminologyInfo);
97  void setTerminologyInfo(TerminologyInfoBundle &terminologyInfo);
98 
101  bool terminologyEntry(vtkSlicerTerminologyEntry* entry);
104  bool setTerminologyEntry(vtkSlicerTerminologyEntry* entry);
105 
107  bool anatomicRegionSectionVisible() const;
108 
110  Q_INVOKABLE static QString nameFromTerminology(vtkSlicerTerminologyEntry* entry);
112  QString nameFromCurrentTerminology();
114  Q_INVOKABLE static QColor recommendedColorFromTerminology(vtkSlicerTerminologyEntry* entry);
116  QColor recommendedColorFromCurrentTerminology();
117 
118 public slots:
120  void setAnatomicRegionSectionVisible(bool);
121 
122 protected:
124  void setCurrentTerminology(QString terminologyName);
128  bool setCurrentCategory(vtkSlicerTerminologyCategory* category);
130  void updateWidgetFromCurrentCategory();
133  bool setCurrentType(vtkSlicerTerminologyType* type);
136  bool setCurrentTypeModifier(vtkSlicerTerminologyType* modifier);
138  void setCurrentAnatomicContext(QString contextName);
141  bool setCurrentRegion(vtkSlicerTerminologyType* region);
144  bool setCurrentRegionModifier(vtkSlicerTerminologyType* modifier);
145 
146 protected:
148  void populateTerminologyComboBox();
150  void populateCategoryTable();
152  void populateTypeTable();
154  void populateTypeModifierComboBox();
155 
157  void populateAnatomicContextComboBox();
159  void populateRegionTable();
161  void populateRegionModifierComboBox();
162 
164  void copyContextToUserDirectory(QString filePath);
165 
166 protected slots:
167  void onTerminologySelectionChanged(int);
168  void onCategorySelectionChanged();
169  void onTypeSelected(QTableWidgetItem*, QTableWidgetItem*);
170  void onTypeModifierSelectionChanged(int);
171  void onCategorySearchTextChanged(QString);
172  void onTypeSearchTextChanged(QString);
173 
174  void onAnatomicContextSelectionChanged(int);
175  void onRegionSelected(QTableWidgetItem*,QTableWidgetItem*);
176  void onRegionModifierSelectionChanged(int);
177  void onRegionSearchTextChanged(QString);
178 
179  void onNameChanged(QString);
180  void onResetNameClicked();
181  void onColorChanged(QColor);
182  void onResetColorClicked();
183 
184  void onLoadTerminologyClicked();
185  void onLoadAnatomicContextClicked();
186 
187  void anatomicalRegionExpandButtonUp();
188  void anatomicalRegionExpandButtonDown();
189 
190  void onLogicModified();
191 
192 signals:
194  void selectionValidityChanged(bool);
195 
196 protected:
197  QScopedPointer<qSlicerTerminologyNavigatorWidgetPrivate> d_ptr;
198 
199 private:
200  Q_DECLARE_PRIVATE(qSlicerTerminologyNavigatorWidget);
201  Q_DISABLE_COPY(qSlicerTerminologyNavigatorWidget);
202 };
203 
204 #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.