54 m_Controls.m_ZonesWidget->SetDataStorage(this->GetDataStorage());
61 connect(
m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalReadyForNextStep()),
63 connect(
m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalNoLongerReadyForNextStep()),
66 connect(
m_Controls.m_TabWidget, SIGNAL(currentChanged (
int )),
this, SLOT(OnTabSwitch(
int )) );
74 connect(
m_Controls.m_BtnNeedleView, SIGNAL(clicked ()),
this, SLOT(OnNeedleViewToogle()) );
79 m_Controls.m_TabWidget->setTabEnabled(1,
false);
80 m_Controls.m_TabWidget->setTabEnabled(2,
false);
85 m_RangeMeterStyle =
"QProgressBar:horizontal {\nborder: 1px solid gray;\nborder-radius: 3px;\nbackground: white;\npadding: 1px;\ntext-align: center;\n}\nQProgressBar::chunk:horizontal {\nbackground: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #StartColor#, stop: 0.8 #StartColor#, stop: 1 #StopColor#);\n}";
86 QBoxLayout * layout =
new QBoxLayout(QBoxLayout::Down,
m_Controls.m_RangeBox);
88 QShortcut *shortcut =
new QShortcut(QKeySequence(Qt::Key_PageDown), parent);
89 QObject::connect(shortcut, SIGNAL(activated()),
m_Controls.m_BtnNeedleView, SLOT(animateClick()) );
91 m_Controls.m_CombinedModalitySelectionWidget->OnActivateStep();
111 MITK_WARN <<
"No device selected.";
115 QApplication::setOverrideCursor(Qt::WaitCursor);
119 QApplication::restoreOverrideCursor();
134 mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow(
"3d")->GetRenderWindow());
140 mitk::Vector3D direction;
144 m_CameraVis->SetDirectionOfProjectionInToolCoordinates(direction);
148 m_CameraVis->SetViewUpInToolCoordinates(direction);
151 mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode(
"Needle Path");
154 node = mitk::DataNode::New();
155 node->SetName(
"Needle Path");
157 node->SetBoolProperty(
"show contour",
true);
158 this->GetDataStorage()->Add(node);
159 node->SetFloatProperty(
"opacity", 0.80f );
167 m_USStream->SetFloatProperty(
"opacity", 0.80f );
171 m_Controls.m_TabWidget->setTabEnabled(1,
true);
172 m_Controls.m_TabWidget->setTabEnabled(2,
true);
234 mitk::DataNode::Pointer zone =
m_Zones.at(i);
237 bool success =
m_Zones.at(i)->GetColor(zoneColor);
238 QString zoneColorString =
"#555555";
241 QString zoneColorString = QString(
"#%1%2%3").arg(
static_cast<unsigned int>(zoneColor[0]*255), 2, 16, QChar(
'0'))
242 .arg(
static_cast<unsigned int>(zoneColor[1]*255), 2, 16, QChar(
'0')).arg(
static_cast<unsigned int>(zoneColor[2]*255), 2, 16, QChar(
'0'));
245 QProgressBar* meter =
new QProgressBar();
246 meter->setMinimum(0);
247 meter->setMaximum(100);
249 QString zoneName = zone->GetName().c_str();
250 meter->setFormat(zoneName +
": No Data");
252 style = style.replace(
"#StartColor#", zoneColorString);
253 style = style.replace(
"#StopColor#", zoneColorString);
254 meter->setStyleSheet(style);
255 meter->setVisible(
true);
262 mitk::NavigationData::Pointer needle = this->
m_Tracker->GetOutput(0);
263 if (! needle->IsDataValid())
return;
264 mitk::Point3D needlePosition = needle->GetPosition();
266 for (
int i = 0; i <
m_Zones.size(); i++)
268 mitk::Point3D zoneOrigin =
m_Zones.at(i)->GetData()->GetGeometry()->GetOrigin();
270 mitk::ScalarType distance = sqrt( pow(zoneOrigin[0] - needlePosition[0], 2) + pow(zoneOrigin[1] - needlePosition[1], 2) + pow(zoneOrigin[2] - needlePosition[2], 2) );
273 m_Zones.at(i)->GetFloatProperty(
"zone.size", zoneSize);
274 distance = distance - zoneSize;
278 m_Zones.at(i)->GetColor(zoneColor);
279 QString zoneColorString = QString(
"#%1%2%3").arg(
static_cast<unsigned int>(zoneColor[0]*255), 2, 16, QChar(
'0'))
280 .arg(
static_cast<unsigned int>(zoneColor[1]*255), 2, 16, QChar(
'0')).arg(
static_cast<unsigned int>(zoneColor[2]*255), 2, 16, QChar(
'0'));
282 QString text =
m_Zones.at(i)->GetName().c_str();
288 style = style.replace(
"#StartColor#",
"red");
289 style = style.replace(
"#StopColor#",
"red");
290 text = text +
": VIOLATED";
295 style = style.replace(
"#StartColor#", zoneColorString);
296 style = style.replace(
"#StopColor#",
"red");
297 text = text +
": " + QString::number(distance) +
" mm";
298 value = 100 - 100 * ((float) distance / (float )
MAXRANGE);
302 style = style.replace(
"#StartColor#", zoneColorString);
303 style = style.replace(
"#StopColor#", zoneColorString);
304 text = text +
": " + QString::number(distance) +
" mm";
305 value = 100 - 100 * ((float) distance / (float )
MAXRANGE);
309 style = style.replace(
"#StartColor#", zoneColorString);
310 style = style.replace(
"#StopColor#", zoneColorString);
311 text = text +
": " + QString::number(distance) +
" mm";
316 meter->setStyleSheet(style);
317 meter->setFormat(text);
318 meter->setValue(value);