Slicer 5.8
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) 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
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
53 Q_PROPERTY(bool anatomicRegionSectionVisible READ anatomicRegionSectionVisible WRITE setAnatomicRegionSectionVisible)
54 Q_PROPERTY(bool overrideSectionVisible READ overrideSectionVisible WRITE setOverrideSectionVisible)
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;
87 QColor Color;
90 private:
91 vtkSlicerTerminologyEntry* TerminologyEntry;
92 };
93
96 void terminologyInfo(TerminologyInfoBundle &terminologyInfo);
99#endif // __VTK_WRAP__
100
107
110
113
115 Q_INVOKABLE static QString nameFromTerminology(vtkSlicerTerminologyEntry* entry);
122
123public slots:
126
129
130protected:
132 void setCurrentTerminology(QString terminologyName);
146 void setCurrentAnatomicContext(QString contextName);
153
154protected:
163
170
172 void copyContextToUserDirectory(QString filePath);
173
174protected slots:
178 void onTypeSelected(QTableWidgetItem*, QTableWidgetItem*);
183
185 void onRegionSelected(QTableWidgetItem*,QTableWidgetItem*);
188
189 void onNameChanged(QString);
191 void onColorChanged(QColor);
193
196
199
201
202signals:
207
208protected:
209 QScopedPointer<qSlicerTerminologyNavigatorWidgetPrivate> d_ptr;
210
211private:
212 Q_DECLARE_PRIVATE(qSlicerTerminologyNavigatorWidget);
213 Q_DISABLE_COPY(qSlicerTerminologyNavigatorWidget);
214};
215
216#endif
Base class for any widget that requires a MRML Scene.
Definition qMRMLWidget.h:36
TerminologyInfoBundle(vtkSlicerTerminologyEntry *entry, QString name, bool nameAutoGenerated, QColor color, bool colorAutoGenerated, QColor generatedColor)
const TerminologyInfoBundle & operator=(const TerminologyInfoBundle &other)
Qt widget for browsing a terminology dictionary. DICOM properties of the selected entry can also be s...
bool setCurrentRegion(vtkSlicerTerminologyType *region)
void updateWidgetFromCurrentCategory()
Update widget UI based on the current category selection.
void setAnatomicRegionSectionVisible(bool)
Show/hide anatomic region section section.
void terminologyInfo(TerminologyInfoBundle &terminologyInfo)
void setCurrentTerminology(QString terminologyName)
Set current terminology to widget.
Q_INVOKABLE bool setTerminologyEntry(vtkSlicerTerminologyEntry *entry)
bool anatomicRegionSectionVisible() const
Get whether anatomic region section are visible.
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.
void populateTerminologyComboBox()
Populate terminology combobox based on current selection.
bool setCurrentType(vtkSlicerTerminologyType *type)
Q_INVOKABLE bool terminologyEntry(vtkSlicerTerminologyEntry *entry)
void copyContextToUserDirectory(QString filePath)
Copy terminology or anatomic context file to user folder.
static Q_INVOKABLE QColor recommendedColorFromTerminology(vtkSlicerTerminologyEntry *entry)
Get recommended color from type (or type modifier if any) of the given terminology entry.
void populateRegionTable()
Populate region table based on selected anatomic region context and type search term.
void setCurrentAnatomicContext(QString contextName)
Set current anatomic context to widget.
void populateAnatomicContextComboBox()
Populate anatomic region context combobox based on current selection.
void populateTypeTable()
Populate type table based on selected category and type search term.
void populateCategoryTable()
Populate category table based on selected terminology and category search term.
void typeDoubleClicked()
Emitted when type is double clicked. It can be interpreted as having made a selection.
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.
bool setCurrentCategory(vtkSlicerTerminologyCategory *category)
void populateTypeModifierComboBox()
Populate type modifier combobox based on current selection.
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 populateRegionModifierComboBox()
Populate region modifier combobox based on current selection.
bool setCurrentRegionModifier(vtkSlicerTerminologyType *modifier)
bool setCurrentTypeModifier(vtkSlicerTerminologyType *modifier)
void onTypeSelected(QTableWidgetItem *, QTableWidgetItem *)
bool overrideSectionVisible() const
Get whether name and color override section is visible.
Terminology property category object.
Terminology property type object.