Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qSlicerTerminologyNavigatorWidget.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Seattle Children�s Hospital d/b/a Seattle Children�s Research Institute.
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 Csaba Pinter, PerkLab, Queen's University
17 and was partially supported through the Applied Cancer Research Unit program of Cancer Care
18 Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
19 and by Murat Maga (Seattle Children's Research Institute).
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
38class qSlicerTerminologyNavigatorWidgetPrivate;
39
40class QColor;
41class QTableWidgetItem;
42class QItemSelection;
45
48class Q_SLICER_MODULE_TERMINOLOGIES_WIDGETS_EXPORT qSlicerTerminologyNavigatorWidget : public qMRMLWidget
49{
50 Q_OBJECT
51 QVTK_OBJECT
52
55
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
69public:
71 explicit qSlicerTerminologyNavigatorWidget(QWidget* parent = nullptr);
74
75#ifndef __VTK_WRAP__
76 class Q_SLICER_MODULE_TERMINOLOGIES_WIDGETS_EXPORT TerminologyInfoBundle
77 {
78 public:
80 TerminologyInfoBundle(vtkSlicerTerminologyEntry* entry, QString name, bool nameAutoGenerated, QColor color, bool colorAutoGenerated, QColor generatedColor);
84
85 QString Name;
86 bool NameAutoGenerated{ true }; // indicates that the name does not contain valuable information
87 QColor Color;
88 bool ColorAutoGenerated{ true }; // indicates that the color does not contain valuable information
90 private:
91 vtkSlicerTerminologyEntry* TerminologyEntry{ nullptr };
92 };
93
99#endif // __VTK_WRAP__
100
107
110
113
115 Q_INVOKABLE static QString nameFromTerminology(vtkSlicerTerminologyEntry* entry);
122
123public slots:
126
129
130protected slots:
134 void onTypeSelected(QTableWidgetItem*, QTableWidgetItem*);
139
141 void onRegionSelected(QTableWidgetItem*,QTableWidgetItem*);
144
145 void onColorSelected(const QItemSelection& selected, const QItemSelection& deselected);
146 void onColorRowDoubleClicked(const QModelIndex &index);
147
148 void onNameChanged(QString);
150 void onColorChanged(QColor);
152
155
158
160
162
163signals:
170
171protected:
172 QScopedPointer<qSlicerTerminologyNavigatorWidgetPrivate> d_ptr;
173
174private:
175 Q_DECLARE_PRIVATE(qSlicerTerminologyNavigatorWidget);
176 Q_DISABLE_COPY(qSlicerTerminologyNavigatorWidget);
177};
178
179#endif
qMRMLWidget(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
TerminologyInfoBundle(vtkSlicerTerminologyEntry *entry, QString name, bool nameAutoGenerated, QColor color, bool colorAutoGenerated, QColor generatedColor)
const TerminologyInfoBundle & operator=(const TerminologyInfoBundle &other)
void setRegionSectionVisible(bool)
Show/hide region section section.
void terminologyInfo(TerminologyInfoBundle &terminologyInfo)
Q_INVOKABLE bool setTerminologyEntry(vtkSlicerTerminologyEntry *entry)
qSlicerTerminologyNavigatorWidget(QWidget *parent=nullptr)
Constructor.
QScopedPointer< qSlicerTerminologyNavigatorWidgetPrivate > d_ptr
QColor recommendedColorFromCurrentTerminology()
Get recommended color from type (or type modifier if any) of the current terminology in the widget.
Q_INVOKABLE bool terminologyEntry(vtkSlicerTerminologyEntry *entry)
static Q_INVOKABLE QColor recommendedColorFromTerminology(vtkSlicerTerminologyEntry *entry)
Get recommended color from type (or type modifier if any) of the given terminology entry.
void typeDoubleClicked()
Emitted when type is double clicked (in terminology mode). It can be interpreted as having made a sel...
QString nameFromCurrentTerminology()
Generate name for current terminology.
void setTerminologyInfo(TerminologyInfoBundle &terminologyInfo)
Set selection to widget: terminology and meta-data (name, color, auto-generated flags)
static Q_INVOKABLE QString nameFromTerminology(vtkSlicerTerminologyEntry *entry)
Generate name for given terminology.
void onRegionSelected(QTableWidgetItem *, QTableWidgetItem *)
void selectionValidityChanged(bool)
Emitted when selection becomes valid (true argument) or invalid (false argument)
void setOverrideSectionVisible(bool)
Show/hide name and color override section.
~qSlicerTerminologyNavigatorWidget() override
Destructor.
void onColorRowDoubleClicked(const QModelIndex &index)
bool regionSectionVisible() const
Get whether region section are visible.
void onColorSelected(const QItemSelection &selected, const QItemSelection &deselected)
void onTypeSelected(QTableWidgetItem *, QTableWidgetItem *)
bool overrideSectionVisible() const
Get whether name and color override section is visible.
void colorDoubleClicked()
Emitted when color is double clicked (in color mode). It can be interpreted as having made a selectio...
Terminology property category object.
Terminology property type object.