bool QmitkUSNavigationStepPlacementPlanning::OnActivateStep()
{
  emit SignalReadyForNextStep();

  m_NodeDisplacementFilter->SelectInput(m_ReferenceSensorIndex);
  m_NeedleProjectionFilter->SelectInput(m_NeedleSensorIndex);

  if ( m_PlannedTargetNodes.empty() ) { m_CurrentTargetIndex = 0; }
  else { m_CurrentTargetIndex = m_PlannedTargetNodes.size() - 1; }

  m_TargetNode = this->GetNamedDerivedNode(USNavigationMarkerPlacement::DATANAME_TARGETSURFACE,
    USNavigationMarkerPlacement::DATANAME_TUMOUR);
  m_TargetNode->SetBoolProperty("visible", true);

  // set lookup table of tumour node
  m_TargetNode->SetProperty("LookupTable", m_TargetColorLookupTableProperty);

  m_TargetUpdateFilter->SetTargetStructure(m_TargetNode);

  for ( QVector<itk::SmartPointer<mitk::DataNode> >::iterator it = m_PlannedTargetNodes.begin();
    it != m_PlannedTargetNodes.end(); ++it )
  {
    (*it)->SetBoolProperty("visible", true);
  }

  this->UpdateTargetDescriptions();

  //m_TargetUpdateFilter->UpdateTargetScores();

  return true;
}
bool QmitkUSNavigationStepZoneMarking::OnActivateStep()
{
  m_ZoneDisplacementFilter->SelectInput(m_ReferenceSensorIndex);

  emit SignalReadyForNextStep();

  return true;
}
bool QmitkUSNavigationStepTumourSelection::OnActivateStep()
{
  m_Interactor = mitk::USZonesInteractor::New();
  m_Interactor->LoadStateMachine(m_StateMachineFilename, us::ModuleRegistry::GetModule("MitkUS"));
  m_Interactor->SetEventConfig("globalConfig.xml");

  m_NodeDisplacementFilter->SelectInput(m_ReferenceSensorIndex);

  //target selection is optional
  if (m_targetSelectionOptional) { emit SignalReadyForNextStep(); }

  return true;
}
Beispiel #4
0
void USNavigation::CreateQtPartControl( QWidget *parent )
{
  m_Timer = new QTimer(this);
  m_RangeMeterTimer = new QTimer(this);
  // create GUI widgets from the Qt Designer's .ui file
  m_Controls.setupUi( parent );

  m_Controls.m_ZonesWidget->SetDataStorage(this->GetDataStorage());

  // Timer
  connect( m_Timer, SIGNAL(timeout()), this, SLOT(Update()));
  connect( m_RangeMeterTimer, SIGNAL(timeout()), this, SLOT(UpdateMeters()));

  connect( m_Controls.m_BtnSelectDevices, SIGNAL(clicked()), this, SLOT(OnSelectDevices()) );
  connect( m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalReadyForNextStep()),
           this, SLOT(OnDeviceSelected()) );
  connect( m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalNoLongerReadyForNextStep()),
           this, SLOT(OnDeviceDeselected()) );

  connect( m_Controls.m_TabWidget, SIGNAL(currentChanged ( int )), this, SLOT(OnTabSwitch( int )) );

  // Zones
  connect( m_Controls.m_BtnFreeze, SIGNAL(clicked()), this, SLOT(OnFreeze()) );
  connect( m_Controls.m_ZonesWidget, SIGNAL(ZoneAdded()), this, SLOT(OnZoneAdded()) );
  // Navigation
  connect( m_Controls.m_BtnStartIntervention, SIGNAL(clicked ()), this, SLOT(OnStartIntervention()) );
  connect( m_Controls.m_BtnReset, SIGNAL(clicked ()), this, SLOT(OnReset()) );
  connect( m_Controls.m_BtnNeedleView, SIGNAL(clicked ()), this, SLOT(OnNeedleViewToogle()) );

  m_Freeze = false;
  m_IsNeedleViewActive = false;

  m_Controls.m_TabWidget->setTabEnabled(1, false);
  m_Controls.m_TabWidget->setTabEnabled(2, false);
  m_ZoneFilter = mitk::NodeDisplacementFilter::New();
  m_NeedleProjectionFilter = mitk::NeedleProjectionFilter::New();
  m_SmoothingFilter = mitk::NavigationDataSmoothingFilter::New();
  m_CameraVis = mitk::CameraVisualization::New();
  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}";
  QBoxLayout * layout = new QBoxLayout(QBoxLayout::Down, m_Controls.m_RangeBox);
  // Pedal Support for Needle View
  QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_PageDown), parent);
  QObject::connect(shortcut, SIGNAL(activated()), m_Controls.m_BtnNeedleView, SLOT(animateClick()) );

  m_Controls.m_CombinedModalitySelectionWidget->OnActivateStep();
}
void QmitkUSNavigationStepTumourSelection::TumourNodeChanged(const mitk::DataNode* dataNode)
{
  // only changes of tumour node are of interest
  if (dataNode != m_TumourNode) { return; }

  float size;
  dataNode->GetFloatProperty("zone.size", size);

  ui->tumourSizeSlider->setValue(static_cast<int>(size));

  bool created;
  if (dataNode->GetBoolProperty("zone.created", created) && created)
  {
    if (ui->freezeImageButton->isChecked())
    {
      m_NodeDisplacementFilter->AddNode(const_cast<mitk::DataNode*>(dataNode));

      m_TargetSurfaceNode->SetData(this->CreateTargetSurface());
      m_NodeDisplacementFilter->AddNode(m_TargetSurfaceNode);

      MITK_INFO("QmitkUSAbstractNavigationStep")("QmitkUSNavigationStepTumourSelection")
        << "Tumour created with center " << dataNode->GetData()->GetGeometry()->GetOrigin()
        << " and radius " << size << ".";

      mitk::DataNode::Pointer tumourResultNode = mitk::DataNode::New();
      tumourResultNode->SetName("TumourResult");
      tumourResultNode->SetProperty("USNavigation::TumourCenter",
        mitk::Point3dProperty::New(dataNode->GetData()->GetGeometry()->GetOrigin()));
      tumourResultNode->SetProperty("USNavigation::TumourRadius", mitk::DoubleProperty::New(size));

      emit SignalIntermediateResult(tumourResultNode);

      ui->freezeImageButton->Unfreeze();
    }

    ui->tumourSearchExplanationLabel->setEnabled(false);
    ui->tumourSizeExplanationLabel->setEnabled(true);
    ui->tumourSizeLabel->setEnabled(true);
    ui->tumourSizeSlider->setEnabled(true);
    ui->deleteTumourButton->setEnabled(true);

    emit SignalReadyForNextStep();
  }
}