void QmitkUSNavigationStepPunctuationIntervention::UpdateBodyMarkerStatus(mitk::NavigationData::Pointer bodyMarker)
{
  if ( bodyMarker.IsNull() )
  {
    MITK_ERROR("QmitkUSAbstractNavigationStep")("QmitkUSNavigationStepPunctuationIntervention")
      << "Current Navigation Data for body marker of Combined Modality must not be null.";
    mitkThrow() << "Current Navigation Data for body marker of Combined Modality must not be null.";
  }

  bool valid = bodyMarker->IsDataValid();

  // update body marker status label
  if (valid)
  {
    ui->bodyMarkerTrackingStatusLabel->setStyleSheet(
      "background-color: #8bff8b; margin-right: 1em; margin-left: 1em; border: 1px solid grey");
    ui->bodyMarkerTrackingStatusLabel->setText("Body marker is inside the tracking volume.");
  }
  else
  {
    ui->bodyMarkerTrackingStatusLabel->setStyleSheet(
          "background-color: #ff7878; margin-right: 1em; margin-left: 1em; border: 1px solid grey");
    ui->bodyMarkerTrackingStatusLabel->setText("Body marker is not inside the tracking volume.");
  }

  ui->riskStructuresRangeGroupBox->setEnabled(valid);
}
void QmitkUSNavigationZoneDistancesWidget::UpdateDistancesToNeedlePosition(mitk::NavigationData::Pointer needle)
{
  if ( needle.IsNull() )
  {
    MITK_ERROR("QmitkUSAbstractNavigationStep")("QmitkUSNavigationStepMarkerIntervention")
      << "Current Navigation Data for needle must not be null.";
    mitkThrow() << "Current Navigation Data for needle must not be null.";
  }

  // get needle position
  if (needle->IsDataValid())
  {
    mitk::Point3D needlePosition = needle->GetPosition();

    for (int n = 0; n < m_ZoneNodes.size(); ++n)
    {
      mitk::Point3D zoneOrigin = m_ZoneNodes.at(n)->GetData()->GetGeometry()->GetOrigin();

      // calculate absolute distance
      mitk::ScalarType distance = sqrt( pow(zoneOrigin[0] - needlePosition[0], 2) + pow(zoneOrigin[1] - needlePosition[1], 2) + pow(zoneOrigin[2] - needlePosition[2], 2) );

      // subtract zone size
      float zoneSize;
      m_ZoneNodes.at(n)->GetFloatProperty(m_SizePropertyKey.c_str(), zoneSize);
      distance = distance - zoneSize;

      m_ZoneProgressBars.at(n)->setValue(distance);

      if ( distance < 0 ) { SignalZoneViolated(m_ZoneNodes.at(n), needlePosition); }
    }
  }
}