Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
Medical Imaging Interaction Toolkit
QmitkRegEvalSettingsWidget.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 ============================================================================*/
12 
14 
19 #include "mitkRegVisPropertyTags.h"
21 
23 {
24  if (this->m_selectedEvalNode.GetPointer() != node)
25  {
26  this->m_selectedEvalNode = node;
28  }
29 };
30 
32  : QWidget(parent), m_internalBlendUpdate(false), m_internalUpdate(false)
33 {
34  this->setupUi(this);
35 
37 
38  for (unsigned int pos = 0; pos < sampleProp->Size(); ++pos)
39  {
40  this->comboStyle->insertItem(pos, QString::fromStdString(sampleProp->GetEnumString(pos)));
41  }
42 
43  connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboStyleChanged(int)));
44 
45  connect(pbBlend50, SIGNAL(clicked()), this, SLOT(OnBlend50Pushed()));
46  connect(pbBlendTarget, SIGNAL(clicked()), this, SLOT(OnBlendTargetPushed()));
47  connect(pbBlendMoving, SIGNAL(clicked()), this, SLOT(OnBlendMovingPushed()));
48  connect(pbBlendToggle, SIGNAL(clicked()), this, SLOT(OnBlendTogglePushed()));
49  connect(slideBlend, SIGNAL(valueChanged(int)), this, SLOT(OnSlideBlendChanged(int)));
50  connect(sbBlend, SIGNAL(valueChanged(int)), this, SLOT(OnSpinBlendChanged(int)));
51 
52  connect(sbChecker, SIGNAL(valueChanged(int)), this, SLOT(OnSpinCheckerChanged(int)));
53 
54  connect(radioWipeCross, SIGNAL(toggled(bool)), this, SLOT(OnWipeStyleChanged()));
55  connect(radioWipeH, SIGNAL(toggled(bool)), this, SLOT(OnWipeStyleChanged()));
56  connect(radioWipeV, SIGNAL(toggled(bool)), this, SLOT(OnWipeStyleChanged()));
57 
58  connect(radioTargetContour, SIGNAL(toggled(bool)), this, SLOT(OnContourStyleChanged()));
59 
60  this->ConfigureControls();
61 }
62 
64 {
65  m_internalUpdate = true;
66  this->comboStyle->setEnabled(this->m_selectedEvalNode.IsNotNull());
67 
68  if (this->m_selectedEvalNode.IsNotNull())
69  {
70  mitk::RegEvalStyleProperty *evalProp = nullptr;
71 
72  if (this->m_selectedEvalNode->GetProperty(evalProp, mitk::nodeProp_RegEvalStyle))
73  {
74  OnComboStyleChanged(evalProp->GetValueAsId());
75  this->comboStyle->setCurrentIndex(evalProp->GetValueAsId());
76  }
77 
78  int factor = 50;
79  this->m_selectedEvalNode->GetIntProperty(mitk::nodeProp_RegEvalBlendFactor, factor);
80  this->sbBlend->setValue(factor);
81 
82  int count = 3;
83  this->m_selectedEvalNode->GetIntProperty(mitk::nodeProp_RegEvalCheckerCount, count);
84  this->sbChecker->setValue(count);
85 
86  bool targetContour = true;
87  this->m_selectedEvalNode->GetBoolProperty(mitk::nodeProp_RegEvalTargetContour, targetContour);
88  this->radioTargetContour->setChecked(targetContour);
89  }
90  else
91  {
92  this->groupBlend->setVisible(false);
93  this->groupCheck->setVisible(false);
94  this->groupWipe->setVisible(false);
95  this->groupContour->setVisible(false);
96  }
97  m_internalUpdate = false;
98 }
99 
101 {
102  groupBlend->setVisible(index == 0);
103  groupCheck->setVisible(index == 2);
104  groupWipe->setVisible(index == 3);
105  groupContour->setVisible(index == 5);
106 
107  if (m_selectedEvalNode.IsNotNull())
108  {
109  m_selectedEvalNode->SetProperty(mitk::nodeProp_RegEvalStyle, mitk::RegEvalStyleProperty::New(index));
110  if (!m_internalUpdate)
111  {
112  emit SettingsChanged(m_selectedEvalNode.GetPointer());
113  }
114  }
115 };
116 
118 {
119  sbBlend->setValue(50);
120 };
121 
123 {
124  sbBlend->setValue(0);
125 };
126 
128 {
129  sbBlend->setValue(100);
130 };
131 
133 {
134  sbBlend->setValue(100 - sbBlend->value());
135 };
136 
138 {
139  m_internalBlendUpdate = true;
140  sbBlend->setValue(factor);
141  m_internalBlendUpdate = false;
142 };
143 
145 {
146  if (m_selectedEvalNode.IsNotNull())
147  {
148  m_selectedEvalNode->SetIntProperty(mitk::nodeProp_RegEvalBlendFactor, factor);
149 
150  if (!m_internalBlendUpdate)
151  {
152  this->slideBlend->setValue(factor);
153  }
154  if (!m_internalUpdate)
155  {
156  emit SettingsChanged(m_selectedEvalNode.GetPointer());
157  }
158  }
159 };
160 
162 {
163  if (m_selectedEvalNode.IsNotNull())
164  {
165  m_selectedEvalNode->SetIntProperty(mitk::nodeProp_RegEvalCheckerCount, count);
166  if (!m_internalUpdate)
167  {
168  emit SettingsChanged(m_selectedEvalNode.GetPointer());
169  }
170  }
171 };
172 
174 {
175  if (m_selectedEvalNode.IsNotNull())
176  {
177  if (this->radioWipeCross->isChecked())
178  {
179  m_selectedEvalNode->SetProperty(mitk::nodeProp_RegEvalWipeStyle, mitk::RegEvalWipeStyleProperty::New(0));
180  }
181  else if (this->radioWipeH->isChecked())
182  {
183  m_selectedEvalNode->SetProperty(mitk::nodeProp_RegEvalWipeStyle, mitk::RegEvalWipeStyleProperty::New(1));
184  }
185  else
186  {
187  m_selectedEvalNode->SetProperty(mitk::nodeProp_RegEvalWipeStyle, mitk::RegEvalWipeStyleProperty::New(2));
188  }
189 
190  if (!m_internalUpdate)
191  {
192  emit SettingsChanged(m_selectedEvalNode.GetPointer());
193  }
194  }
195 };
196 
198 {
199  if (m_selectedEvalNode.IsNotNull())
200  {
201  m_selectedEvalNode->SetBoolProperty(mitk::nodeProp_RegEvalTargetContour, radioTargetContour->isChecked());
202  if (!m_internalUpdate)
203  {
204  emit SettingsChanged(m_selectedEvalNode.GetPointer());
205  }
206  }
207 };
virtual IdType GetValueAsId() const
const char *const nodeProp_RegEvalCheckerCount
void SetNode(mitk::DataNode *node)
Slot that can be used to set the node that should be configured by the widget.
QmitkRegEvalSettingsWidget(QWidget *parent=nullptr)
const char *const nodeProp_RegEvalBlendFactor
const char *const nodeProp_RegEvalWipeStyle
void SettingsChanged(mitk::DataNode *node)
const char *const nodeProp_RegEvalStyle
const char *const nodeProp_RegEvalTargetContour
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57