Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
QmitkNewSegmentationDialog.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkNewSegmentationDialog_h
14 #define QmitkNewSegmentationDialog_h
15 
17 
18 #include <mitkColorProperty.h>
19 
20 #include <vector>
21 #include <utility>
22 
23 #include <QColor>
24 #include <QDialog>
25 #include <QString>
26 
27 namespace mitk
28 {
29  class LabelSetImage;
30  class Label;
31 }
32 
33 namespace Ui
34 {
36 }
37 
41 {
42  Q_OBJECT
43 
44 public:
45  using SuggestionsType = std::vector<std::pair<QString, QColor>>;
46 
47  enum Mode
48  {
50  RenameLabel
51  };
52 
58  static bool DoRenameLabel(mitk::Label* label, mitk::LabelSetImage* segmentation, QWidget* parent = nullptr, Mode mode = NewLabel);
59 
60  explicit QmitkNewSegmentationDialog(QWidget *parent = nullptr, mitk::LabelSetImage* labelSetImage = nullptr, Mode mode = NewLabel);
61  ~QmitkNewSegmentationDialog() override;
62 
63  QString GetName() const;
64  mitk::Color GetColor() const;
65 
66  void SetName(const QString& name);
67  void SetColor(const mitk::Color& color);
68 
69 private:
70  void OnAccept();
71  void OnFinished(int result);
72  void OnSuggestionSelected();
73  void OnColorButtonClicked();
74  void OnTextChanged(const QString& text);
75 
76  void SetSuggestions(const SuggestionsType& suggestions, bool replaceStandardSuggestions = false);
77  void UpdateColorButtonBackground();
78  void UpdateNameList();
79 
80  Ui::QmitkNewSegmentationDialog* m_Ui;
81 
82  bool m_SuggestOnce;
83 
84  QString m_Name;
85  QColor m_Color;
86 
87  SuggestionsType m_Suggestions;
88 };
89 
90 #endif
QmitkNewSegmentationDialog::NewLabel
@ NewLabel
Definition: QmitkNewSegmentationDialog.h:49
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:35
QmitkNewSegmentationDialog::Mode
Mode
Definition: QmitkNewSegmentationDialog.h:47
MITK_QT_SEGMENTATION
#define MITK_QT_SEGMENTATION
Definition: org_mitk_gui_qt_segmentation_Export.h:26
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
Ui
Definition: BlueBerryExampleLauncherDialog.h:21
mitk::Label
A data structure describing a label.
Definition: mitkLabel.h:28
org_mitk_gui_qt_segmentation_Export.h
QmitkNewSegmentationDialog
Dialog for naming labels.
Definition: QmitkNewSegmentationDialog.h:40
QmitkNewSegmentationDialog::SuggestionsType
std::vector< std::pair< QString, QColor > > SuggestionsType
Definition: QmitkNewSegmentationDialog.h:45
mitkColorProperty.h
mitk::LabelSetImage
LabelSetImage class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:29