Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkPixelManipulationToolGUI.cpp
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 ============================================================================*/
13 
14 #include <QBoxLayout>
15 #include <QPushButton>
16 #include <QRadioButton>
17 
19 
21 {
22  QBoxLayout *mainLayout = new QVBoxLayout(this);
23  QRadioButton *radio1 = new QRadioButton("change the masked pixels by value: ", this);
24  QRadioButton *radio2 = new QRadioButton("set the masked pixels to value: ", this);
25 
26  radio1->setChecked(true);
27 
28  connect(radio1, SIGNAL(toggled(bool)), this, SLOT(SetFixedValueOff(bool)));
29  connect(radio2, SIGNAL(toggled(bool)), this, SLOT(SetFixedValueOn(bool)));
30 
31  mainLayout->addWidget(radio1);
32  mainLayout->addWidget(radio2);
33 
34  m_Slider = new QSlider(Qt::Horizontal, this);
35  m_Slider->setRange(-5000, 5000);
36  m_Slider->setValue(0);
37 
38  connect(m_Slider, SIGNAL(valueChanged(int)), this, SLOT(OnSliderValueChanged(int)));
39 
40  m_Spinner = new QSpinBox(this);
41  m_Spinner->setRange(-5000, 5000);
42  m_Spinner->setValue(0);
43 
44  connect(m_Spinner, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxChanged()));
45 
46  QBoxLayout *layout1 = new QHBoxLayout();
47  layout1->addWidget(m_Slider);
48  layout1->addWidget(m_Spinner);
49 
50  QPushButton *okButton = new QPushButton("Ok");
51 
52  connect(okButton, SIGNAL(clicked()), this, SLOT(OnOkButtonClicked()));
53 
54  mainLayout->addLayout(layout1);
55  mainLayout->addWidget(okButton);
56 
57  connect(this, SIGNAL(NewToolAssociated(mitk::Tool *)), this, SLOT(OnNewToolAssociated(mitk::Tool *)));
58 }
59 
61 {
62  if (m_PixelManipulationTool.IsNotNull())
63  {
64  }
65 }
66 
68 {
69  if (m_PixelManipulationTool.IsNotNull())
70  {
71  }
73  if (m_PixelManipulationTool.IsNotNull())
74  {
75  }
76 }
77 
79 {
80  if (flag)
81  {
82  if (m_PixelManipulationTool.IsNotNull())
83  m_PixelManipulationTool->SetFixedValue(false);
84  }
85 }
86 
88 {
89  if (flag)
90  {
91  if (m_PixelManipulationTool.IsNotNull())
92  m_PixelManipulationTool->SetFixedValue(true);
93  }
94 }
95 
97 {
98  m_Slider->setValue(m_Spinner->value());
99 }
100 
102 {
103  if (m_PixelManipulationTool.IsNotNull())
104  {
105  m_PixelManipulationTool->SetValue(value);
106  m_Spinner->setValue(value);
107  }
108 }
109 
111 {
112  if (m_PixelManipulationTool.IsNotNull())
113  {
114  m_PixelManipulationTool->CalculateImage();
115  }
116 }
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:86
void NewToolAssociated(mitk::Tool *)
MITK_TOOL_GUI_MACRO(, QmitkPixelManipulationToolGUI, "")
Base class for GUIs belonging to mitk::Tool classes.
Definition: QmitkToolGUI.h:32
mitk::PixelManipulationTool::Pointer m_PixelManipulationTool