void QmitkUSNavigationStepMarkerIntervention::OnSettingsChanged(const itk::SmartPointer<mitk::DataNode> settingsNode)
{
  if (settingsNode.IsNull())
  {
    return;
  }

  int numberOfTargets;
  if (settingsNode->GetIntProperty("settings.number-of-targets", numberOfTargets))
  {
    m_NumberOfTargets = numberOfTargets;
    m_TargetUpdateFilter->SetNumberOfTargets(numberOfTargets);

    m_PlacementQualityCalculator->SetOptimalAngle(m_TargetUpdateFilter->GetOptimalAngle());
  }

  std::string referenceSensorName;
  if (settingsNode->GetStringProperty("settings.reference-name-selected", referenceSensorName))
  {
    m_ReferenceSensorName = referenceSensorName;
  }

  std::string needleSensorName;
  if (settingsNode->GetStringProperty("settings.needle-name-selected", needleSensorName))
  {
    m_NeedleSensorName = needleSensorName;
  }

  this->UpdateSensorsNames();
}
void QmitkUSNavigationStepTumourSelection::OnSettingsChanged(const itk::SmartPointer<mitk::DataNode> settingsNode)
{
  if (settingsNode.IsNull()) { return; }

  float securityDistance;
  if (settingsNode->GetFloatProperty("settings.security-distance", securityDistance))
  {
    m_SecurityDistance = securityDistance;
  }

  std::string stateMachineFilename;
  if (settingsNode->GetStringProperty("settings.interaction-concept", stateMachineFilename) && stateMachineFilename != m_StateMachineFilename)
  {
    m_StateMachineFilename = stateMachineFilename;
    m_Interactor->LoadStateMachine(stateMachineFilename, us::ModuleRegistry::GetModule("MitkUS"));
  }

  std::string referenceSensorName;
  if (settingsNode->GetStringProperty("settings.reference-name-selected", referenceSensorName))
  {
    m_ReferenceSensorName = referenceSensorName;
  }

  this->UpdateReferenceSensorName();
}
void QmitkUSNavigationProcessWidget::SetDataStorage(itk::SmartPointer<mitk::DataStorage> dataStorage)
{
  m_DataStorage = dataStorage;

  if ( dataStorage.IsNull() )
  {
    mitkThrow() << "Data Storage must not be null for QmitkUSNavigationProcessWidget.";
  }

  // test if base node is already in the data storage and add it if not
  m_BaseNode = dataStorage->GetNamedNode(QmitkUSAbstractNavigationStep::DATANAME_BASENODE);
  if ( m_BaseNode.IsNull() )
  {
    m_BaseNode = mitk::DataNode::New();
    m_BaseNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_BASENODE);
    dataStorage->Add(m_BaseNode);
  }

  // base node and image stream node may be the same node
  if ( strcmp(QmitkUSAbstractNavigationStep::DATANAME_BASENODE, QmitkUSAbstractNavigationStep::DATANAME_IMAGESTREAM) != 0)
  {
    m_ImageStreamNode = dataStorage->GetNamedNode(QmitkUSAbstractNavigationStep::DATANAME_IMAGESTREAM);
    if (m_ImageStreamNode.IsNull())
    {
      // Create Node for US Stream
      m_ImageStreamNode = mitk::DataNode::New();
      m_ImageStreamNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_IMAGESTREAM);
      dataStorage->Add(m_ImageStreamNode);
    }
  }
  else
  {
    m_ImageStreamNode = m_BaseNode;
  }


  m_SettingsNode =
    dataStorage->GetNamedDerivedNode(QmitkUSAbstractNavigationStep::DATANAME_SETTINGS, m_BaseNode);

  if ( m_SettingsNode.IsNull() )
  {
    m_SettingsNode = mitk::DataNode::New();
    m_SettingsNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_SETTINGS);
    dataStorage->Add(m_SettingsNode, m_BaseNode);
  }

  if (m_SettingsWidget) { m_SettingsWidget->SetSettingsNode(m_SettingsNode); }

}
void mitk::USNavigationTargetIntersectionFilter::SetLine(itk::SmartPointer<mitk::PointSet> line)
{
  if ( line.IsNull() || line->GetSize() != 2 )
  {
    mitkThrow() << "Line must consist of exact two points.";
  }

  // copy points from the PointSet to arrays
  m_LinePoint1[0] = line->GetPoint(0)[0];
  m_LinePoint1[1] = line->GetPoint(0)[1];
  m_LinePoint1[2] = line->GetPoint(0)[2];
  m_LinePoint2[0] = line->GetPoint(1)[0];
  m_LinePoint2[1] = line->GetPoint(1)[1];
  m_LinePoint2[2] = line->GetPoint(1)[2];
}
void QmitkUSNavigationStepZoneMarking::OnSettingsChanged(const itk::SmartPointer<mitk::DataNode> settingsNode)
{
  if ( settingsNode.IsNull() ) { return; }

  std::string stateMachineFilename;
  if ( settingsNode->GetStringProperty("settings.interaction-concept", stateMachineFilename) && stateMachineFilename != m_StateMachineFilename )
  {
    m_StateMachineFilename = stateMachineFilename;
    ui->zonesWidget->SetStateMachineFilename(stateMachineFilename);
  }

  std::string referenceSensorName;
  if ( settingsNode->GetStringProperty("settings.reference-name-selected", referenceSensorName) )
  {
    m_ReferenceSensorName = referenceSensorName;
  }

  this->UpdateReferenceSensorName();
}
void QmitkUSNavigationStepPunctuationIntervention::OnSettingsChanged(const itk::SmartPointer<mitk::DataNode> settingsNode)
{
  if ( settingsNode.IsNull() ) { return; }
}