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