Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
17 
18 #include <QBoxLayout>
19 #include <QPushButton>
20 #include <QRadioButton>
21 
23 
25 {
26  QBoxLayout *mainLayout = new QVBoxLayout(this);
27  QRadioButton *radio1 = new QRadioButton("change the masked pixels by value: ", this);
28  QRadioButton *radio2 = new QRadioButton("set the masked pixels to value: ", this);
29 
30  radio1->setChecked(true);
31 
32  connect(radio1, SIGNAL(toggled(bool)), this, SLOT(SetFixedValueOff(bool)));
33  connect(radio2, SIGNAL(toggled(bool)), this, SLOT(SetFixedValueOn(bool)));
34 
35  mainLayout->addWidget(radio1);
36  mainLayout->addWidget(radio2);
37 
38  m_Slider = new QSlider(Qt::Horizontal, this);
39  m_Slider->setRange(-5000, 5000);
40  m_Slider->setValue(0);
41 
42  connect(m_Slider, SIGNAL(valueChanged(int)), this, SLOT(OnSliderValueChanged(int)));
43 
44  m_Spinner = new QSpinBox(this);
45  m_Spinner->setRange(-5000, 5000);
46  m_Spinner->setValue(0);
47 
48  connect(m_Spinner, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxChanged()));
49 
50  QBoxLayout *layout1 = new QHBoxLayout();
51  layout1->addWidget(m_Slider);
52  layout1->addWidget(m_Spinner);
53 
54  QPushButton *okButton = new QPushButton("Ok");
55 
56  connect(okButton, SIGNAL(clicked()), this, SLOT(OnOkButtonClicked()));
57 
58  mainLayout->addLayout(layout1);
59  mainLayout->addWidget(okButton);
60 
61  connect(this, SIGNAL(NewToolAssociated(mitk::Tool *)), this, SLOT(OnNewToolAssociated(mitk::Tool *)));
62 }
63 
65 {
66  if (m_PixelManipulationTool.IsNotNull())
67  {
68  }
69 }
70 
72 {
73  if (m_PixelManipulationTool.IsNotNull())
74  {
75  }
77  if (m_PixelManipulationTool.IsNotNull())
78  {
79  }
80 }
81 
83 {
84  if (flag)
85  {
86  if (m_PixelManipulationTool.IsNotNull())
87  m_PixelManipulationTool->SetFixedValue(false);
88  }
89 }
90 
92 {
93  if (flag)
94  {
95  if (m_PixelManipulationTool.IsNotNull())
96  m_PixelManipulationTool->SetFixedValue(true);
97  }
98 }
99 
101 {
102  m_Slider->setValue(m_Spinner->value());
103 }
104 
106 {
107  if (m_PixelManipulationTool.IsNotNull())
108  {
109  m_PixelManipulationTool->SetValue(value);
110  m_Spinner->setValue(value);
111  }
112 }
113 
115 {
116  if (m_PixelManipulationTool.IsNotNull())
117  {
118  m_PixelManipulationTool->CalculateImage();
119  }
120 }
MITK_TOOL_GUI_MACRO(, QmitkPixelManipulationToolGUI,"")
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:92
void NewToolAssociated(mitk::Tool *)
Base class for GUIs belonging to mitk::Tool classes.
Definition: QmitkToolGUI.h:36
mitk::PixelManipulationTool::Pointer m_PixelManipulationTool