コード例 #1
0
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();
}
コード例 #2
0
void QmitkUSNavigationCombinedSettingsWidget::OnSetSettingsNode(itk::SmartPointer<mitk::DataNode> settingsNode, bool overwriteValues)
{
  if ( overwriteValues )
  {
    settingsNode->SetStringProperty("settings.application", ui->applicationComboBox->currentText().toStdString().c_str());
    settingsNode->SetStringProperty("settings.interaction-concept", this->InteractionNameToFile(ui->interactionConceptComboBox->currentText()).toStdString().c_str());
    settingsNode->SetBoolProperty("settings.experiment-mode", ui->experimentModeCheckBox->isChecked());
    settingsNode->SetStringProperty("settings.experiment-results-directory", ui->experimentResultsPathButton->directory().toStdString().c_str());

    settingsNode->SetFloatProperty("settings.security-distance", ui->securityDistanceSpinBox->value());
    settingsNode->SetIntProperty("settings.number-of-targets", ui->numberOfTargetsSpinBox->value());
    settingsNode->SetBoolProperty("settings.use-planning-step", ui->planningStepUsageCheckBox->isChecked());

    settingsNode->SetStringProperty("settings.needle-name-selected", ui->needleNameComboBox->currentText().toStdString().c_str());
    settingsNode->SetStringProperty("settings.reference-name-selected", ui->referenceNameComboBox->currentText().toStdString().c_str());
  }
  else
  {
    std::string stringProperty;
    float floatProperty;
    bool boolProperty;

    // load state of application setting combo box
    if ( ! settingsNode->GetStringProperty("settings.application", stringProperty) ) { stringProperty = ""; }
    int lastIndex = ui->applicationComboBox->findText(QString::fromStdString(stringProperty));
    if (lastIndex == -1) { lastIndex = 0; }
    ui->applicationComboBox->setCurrentIndex(lastIndex);
    this->OnApplicationChanged(lastIndex);

    // load state of interaction concept setting combo box
    if ( ! settingsNode->GetStringProperty("settings.interaction-concept", stringProperty) ) { stringProperty = ""; }
    lastIndex = ui->interactionConceptComboBox->findText(QString::fromStdString(stringProperty));
    if (lastIndex == -1) { lastIndex = 0; }
    ui->interactionConceptComboBox->setCurrentIndex(lastIndex);

    if ( ! settingsNode->GetBoolProperty("settings.experiment-mode", boolProperty) ) { boolProperty = false; }
    ui->experimentModeCheckBox->setChecked(boolProperty);

    if ( ! settingsNode->GetStringProperty("settings.experiment-results-directory", stringProperty) ) { stringProperty = ""; }
    ui->experimentResultsPathButton->setDirectory(QString::fromStdString(stringProperty));

    if ( ! settingsNode->GetFloatProperty("settings.security-distance", floatProperty) ) { floatProperty = 2.0; }
    ui->securityDistanceSpinBox->setValue(floatProperty);

    if ( ! settingsNode->GetFloatProperty("settings.number-of-targets", floatProperty) ) { floatProperty = 3; }
    ui->numberOfTargetsSpinBox->setValue(static_cast<int>(floatProperty));

    if ( ! settingsNode->GetBoolProperty("settings.use-planning-step", boolProperty) ) { boolProperty = true; }
    ui->planningStepUsageCheckBox->setChecked(boolProperty);

    if ( ! settingsNode->GetStringProperty("settings.needle-names", stringProperty) ) { stringProperty = ""; }
    QString needleNames = QString::fromStdString(stringProperty);

    ui->needleNameComboBox->clear();
    ui->needleNameComboBox->addItems(needleNames.split(";", QString::SkipEmptyParts));

    if ( ! settingsNode->GetStringProperty("settings.needle-name-selected", stringProperty) ) { stringProperty = ""; }
    int index = ui->needleNameComboBox->findText(QString::fromStdString(stringProperty));
    if (index == -1)
    {
      ui->needleNameComboBox->addItem(QString::fromStdString(stringProperty));
      ui->needleNameComboBox->setCurrentIndex(ui->needleNameComboBox->count()-1);
    }
    else
    {
      ui->needleNameComboBox->setCurrentIndex(index);
    }

    if ( ! settingsNode->GetStringProperty("settings.reference-names", stringProperty) ) { stringProperty = ""; }
    QString referenceNames = QString::fromStdString(stringProperty);

    ui->referenceNameComboBox->clear();
    ui->referenceNameComboBox->addItems(referenceNames.split(";", QString::SkipEmptyParts));

    if ( ! settingsNode->GetStringProperty("settings.reference-name-selected", stringProperty) ) { stringProperty = ""; }
    index = ui->referenceNameComboBox->findText(QString::fromStdString(stringProperty));
    if (index == -1)
    {
      ui->referenceNameComboBox->addItem(QString::fromStdString(stringProperty));
      ui->referenceNameComboBox->setCurrentIndex(ui->referenceNameComboBox->count()-1);
    }
    else
    {
      ui->referenceNameComboBox->setCurrentIndex(index);
    }
  }
}