Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
91 private:
92 vtkSlicerTerminologyEntry* TerminologyEntry{ nullptr };
93 };
94
100#endif // __VTK_WRAP__
101
108
111
114
116 Q_INVOKABLE static QString nameFromTerminology(vtkSlicerTerminologyEntry* entry);
123
124public slots:
127
130
131protected slots:
135 void onTypeSelected(QTableWidgetItem*, QTableWidgetItem*);
140
142 void onRegionSelected(QTableWidgetItem*, QTableWidgetItem*);
145
146 void onColorSelected(const QItemSelection& selected, const QItemSelection& deselected);
147 void onColorRowDoubleClicked(const QModelIndex& index);
148
149 void onNameChanged(QString);
151 void onColorChanged(QColor);
153
156
159
161
162 // Set focus on color item in list, name editor or property name search box so that the user can just start typing.
164
165signals:
172
173protected:
174 QScopedPointer<qSlicerTerminologyNavigatorWidgetPrivate> d_ptr;
175
176private:
177 Q_DECLARE_PRIVATE(qSlicerTerminologyNavigatorWidget);
178 Q_DISABLE_COPY(qSlicerTerminologyNavigatorWidget);
179};
180
181#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.