예제 #1
0
void QmitkViewCoordinator::PartActivated( berry::IWorkbenchPartReference::Pointer partRef )
{
  //MITK_INFO << "*** PartActivated (" << partRef->GetPart(false)->GetPartName() << ")";
  berry::IWorkbenchPart* part = partRef->GetPart(false).GetPointer();

  // Check for a render window part and inform IRenderWindowPartListener views
  // that it was activated
  if ( mitk::IRenderWindowPart* renderPart = dynamic_cast<mitk::IRenderWindowPart*>(part) )
  {
    if (m_VisibleRenderWindowPart != renderPart)
    {
      RenderWindowPartActivated(renderPart);
      m_ActiveRenderWindowPart = renderPart;
      m_VisibleRenderWindowPart = renderPart;
    }
  }

  // Check if the activated part wants to be notified
  if (mitk::ILifecycleAwarePart* lifecycleAwarePart = dynamic_cast<mitk::ILifecycleAwarePart*>(part))
  {
    lifecycleAwarePart->Activated();
  }

  // Check if a zombie view has been activated.
  if (mitk::IZombieViewPart* zombieView = dynamic_cast<mitk::IZombieViewPart*>(part))
  {
    if (m_ActiveZombieView && (m_ActiveZombieView != zombieView))
    {
      // Another zombie view has been activated. Tell the old one about it.
      m_ActiveZombieView->ActivatedZombieView(partRef);
      m_ActiveZombieView = zombieView;
    }
  }
}
예제 #2
0
void QmitkRegionGrowingView::CreateQtPartControl( QWidget *parent )
{
  // create GUI widgets from the Qt Designer's .ui file
  m_Controls.setupUi( parent );
  connect( m_Controls.buttonPerformImageProcessing, SIGNAL(clicked()), this, SLOT(DoImageProcessing()) );

  //! [cpp-createqtpartcontrol]
  // create a QmitkPointListWidget and add it to the widget created from .ui file
  m_PointListWidget = new QmitkPointListWidget();
  m_Controls.verticalLayout->addWidget(m_PointListWidget, 1);

  // retrieve a possibly existing IRenderWindowPart
  if (mitk::IRenderWindowPart* renderWindowPart = GetRenderWindowPart())
  {
    // let the point set widget know about the render window part (crosshair updates)
    RenderWindowPartActivated(renderWindowPart);
  }

  // create a new DataNode containing a PointSet with some interaction
  m_PointSet = mitk::PointSet::New();
  mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New();
  pointSetNode->SetData( m_PointSet );
  pointSetNode->SetName("seed points for region growing");
  pointSetNode->SetProperty("helper object", mitk::BoolProperty::New(true) );
  pointSetNode->SetProperty("layer", mitk::IntProperty::New(1024) );

  // add the pointset to the data storage (for rendering and access by other modules)
  GetDataStorage()->Add( pointSetNode );

  // tell the GUI widget about the point set
  m_PointListWidget->SetPointSetNode( pointSetNode );
  //! [cpp-createqtpartcontrol]
}
예제 #3
0
void QmitkDicomInspectorView::CreateQtPartControl(QWidget* parent)
{
  // create GUI widgets from the Qt Designer's .ui file
  m_Controls.setupUi(parent);

  m_Controls.labelNode->setText(QString("select node..."));
  m_Controls.labelTime->setText(QString(""));
  m_Controls.labelSlice->setText(QString(""));

  mitk::IRenderWindowPart* renderWindowPart = GetRenderWindowPart();
  RenderWindowPartActivated(renderWindowPart);
}
예제 #4
0
void QmitkViewCoordinator::PartVisible( berry::IWorkbenchPartReference::Pointer partRef )
{
  //MITK_INFO << "*** PartVisible (" << partRef->GetPart(false)->GetPartName() << ")";
  berry::IWorkbenchPart* part = partRef->GetPart(false).GetPointer();

  // Check for a render window part and inform IRenderWindowPartListener views
  // that it was activated
  if ( mitk::IRenderWindowPart* renderPart = dynamic_cast<mitk::IRenderWindowPart*>(part) )
  {
    if (!m_ActiveRenderWindowPart)
    {
      RenderWindowPartActivated(renderPart);
      m_VisibleRenderWindowPart = renderPart;
    }
  }

  if (mitk::ILifecycleAwarePart* lifecycleAwarePart = dynamic_cast<mitk::ILifecycleAwarePart*>(part))
  {
    lifecycleAwarePart->Visible();
  }
}
예제 #5
0
void QmitkSemanticRelationsView::CreateQtPartControl(QWidget* parent)
{
  // create GUI widgets
  m_Controls.setupUi(parent);

  m_LesionInfoWidget = new QmitkLesionInfoWidget(GetDataStorage(), parent);
  m_Controls.gridLayout->addWidget(m_LesionInfoWidget);

  m_PatientTableInspector = new QmitkPatientTableInspector(parent);
  m_PatientTableInspector->SetDataStorage(GetDataStorage());
  m_Controls.gridLayout->addWidget(m_PatientTableInspector);

  QGridLayout* dndDataNodeWidgetLayout = new QGridLayout;
  dndDataNodeWidgetLayout->addWidget(m_PatientTableInspector, 0, 0);
  dndDataNodeWidgetLayout->setContentsMargins(0, 0, 0, 0);

  m_DnDDataNodeWidget = new QmitkDnDDataNodeWidget(parent);
  m_DnDDataNodeWidget->setLayout(dndDataNodeWidgetLayout);

  m_Controls.gridLayout->addWidget(m_DnDDataNodeWidget);

  m_ContextMenu = new QmitkSemanticRelationsContextMenu(GetSite(), m_PatientTableInspector);
  m_ContextMenu->SetDataStorage(GetDataStorage());

  mitk::IRenderWindowPart* renderWindowPart = GetRenderWindowPart();
  if (nullptr != renderWindowPart)
  {
    RenderWindowPartActivated(renderWindowPart);
  }

  SetUpConnections();

  const auto& allCaseIDs = mitk::RelationStorage::GetAllCaseIDs();
  for (const auto& caseID : allCaseIDs)
  {
    AddToComboBox(caseID);
  }
}
예제 #6
0
void QmitkSegmentationView::CreateQtPartControl(QWidget* parent)
{
   // setup the basic GUI of this view
   m_Parent = parent;

   m_Controls = new Ui::QmitkSegmentationControls;
   m_Controls->setupUi(parent);

   m_Controls->patImageSelector->SetDataStorage(GetDataStorage());
   m_Controls->patImageSelector->SetPredicate(m_IsAPatientImagePredicate);

   UpdateWarningLabel(tr("Please load an image"));

   if (m_Controls->patImageSelector->GetSelectedNode().IsNotNull())
   {
     UpdateWarningLabel(tr("Select or create a new segmentation"));
   }

   m_Controls->segImageSelector->SetDataStorage(GetDataStorage());
   m_Controls->segImageSelector->SetPredicate(m_IsASegmentationImagePredicate);
   if (m_Controls->segImageSelector->GetSelectedNode().IsNotNull())
   {
     UpdateWarningLabel("");
   }

   mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
   assert(toolManager);

   toolManager->SetDataStorage(*(GetDataStorage()));
   toolManager->InitializeTools();

   // all part of open source MITK
   m_Controls->m_ManualToolSelectionBox2D->setEnabled(true);
   m_Controls->m_ManualToolSelectionBox2D->SetGenerateAccelerators(true);
   m_Controls->m_ManualToolSelectionBox2D->SetToolGUIArea( m_Controls->m_ManualToolGUIContainer2D );
   m_Controls->m_ManualToolSelectionBox2D->SetDisplayedToolGroups(tr("Add Subtract Correction Paint Wipe 'Region Growing' Fill Erase 'Live Wire' '2D Fast Marching'").toStdString());
   m_Controls->m_ManualToolSelectionBox2D->SetLayoutColumns(3);
   m_Controls->m_ManualToolSelectionBox2D->SetEnabledMode( QmitkToolSelectionBox::EnabledWithReferenceAndWorkingDataVisible );
   connect( m_Controls->m_ManualToolSelectionBox2D, SIGNAL(ToolSelected(int)), this, SLOT(OnManualTool2DSelected(int)) );

   //setup 3D Tools
   m_Controls->m_ManualToolSelectionBox3D->setEnabled(true);
   m_Controls->m_ManualToolSelectionBox3D->SetGenerateAccelerators(true);
   m_Controls->m_ManualToolSelectionBox3D->SetToolGUIArea( m_Controls->m_ManualToolGUIContainer3D );
   //specify tools to be added to 3D Tool area
   m_Controls->m_ManualToolSelectionBox3D->SetDisplayedToolGroups(tr("Threshold 'UL Threshold' Otsu 'Fast Marching 3D' 'Region Growing 3D' Watershed Picking").toStdString());
   m_Controls->m_ManualToolSelectionBox3D->SetLayoutColumns(3);
   m_Controls->m_ManualToolSelectionBox3D->SetEnabledMode( QmitkToolSelectionBox::EnabledWithReferenceAndWorkingDataVisible );

   //Hide 3D selection box, show 2D selection box
   m_Controls->m_ManualToolSelectionBox3D->hide();
   m_Controls->m_ManualToolSelectionBox2D->show();

   // update the list of segmentations
   toolManager->NewNodesGenerated += mitk::MessageDelegate<QmitkSegmentationView>(this, &QmitkSegmentationView::NewNodesGenerated);
   // update the list of segmentations
   toolManager->NewNodeObjectsGenerated += mitk::MessageDelegate1<QmitkSegmentationView, mitk::ToolManager::DataVectorType*>(this, &QmitkSegmentationView::NewNodeObjectsGenerated);

   // create signal/slot connections
   connect(m_Controls->patImageSelector, SIGNAL(OnSelectionChanged(const mitk::DataNode*)), this, SLOT(OnPatientComboBoxSelectionChanged(const mitk::DataNode*)));
   connect(m_Controls->segImageSelector, SIGNAL(OnSelectionChanged(const mitk::DataNode*)), this, SLOT(OnSegmentationComboBoxSelectionChanged(const mitk::DataNode*)));
   connect( m_Controls->btnNewSegmentation, SIGNAL(clicked()), this, SLOT(CreateNewSegmentation()) );
   //  connect( m_Controls->CreateSegmentationFromSurface, SIGNAL(clicked()), this, SLOT(CreateSegmentationFromSurface()) );
   //  connect( m_Controls->widgetStack, SIGNAL(currentChanged(int)), this, SLOT(ToolboxStackPageChanged(int)) );

   connect( m_Controls->tabWidgetSegmentationTools, SIGNAL(currentChanged(int)), this, SLOT(OnTabWidgetChanged(int)));

   //  connect(m_Controls->MaskSurfaces,  SIGNAL( OnSelectionChanged( const mitk::DataNode* ) ),
   //      this, SLOT( OnSurfaceSelectionChanged( ) ) );

   connect(m_Controls->m_SlicesInterpolator, SIGNAL(SignalShowMarkerNodes(bool)), this, SLOT(OnShowMarkerNodes(bool)));

   //  m_Controls->MaskSurfaces->SetDataStorage(this->GetDataStorage());
   //  m_Controls->MaskSurfaces->SetPredicate(mitk::NodePredicateDataType::New("Surface"));

   mitk::DataStorage::SetOfObjects::ConstPointer patientImages = GetDataStorage()->GetSubset(m_IsAPatientImagePredicate);
   if (!patientImages->empty())
   {
     OnSelectionChanged(*patientImages->begin());
   }

   // set callback function for already existing nodes (images & segmentations)
   mitk::DataStorage::SetOfObjects::ConstPointer allImages = GetDataStorage()->GetSubset(m_IsOfTypeImagePredicate);
   for (mitk::DataStorage::SetOfObjects::const_iterator iter = allImages->begin(); iter != allImages->end(); ++iter)
   {
     mitk::DataNode* node = *iter;
     itk::SimpleMemberCommand<QmitkSegmentationView>::Pointer command = itk::SimpleMemberCommand<QmitkSegmentationView>::New();
     command->SetCallbackFunction(this, &QmitkSegmentationView::OnVisiblePropertyChanged);
     m_WorkingDataObserverTags.insert(std::pair<mitk::DataNode*, unsigned long>(node, node->GetProperty("visible")->AddObserver(itk::ModifiedEvent(), command)));

     itk::SimpleMemberCommand<QmitkSegmentationView>::Pointer command2 = itk::SimpleMemberCommand<QmitkSegmentationView>::New();
     command2->SetCallbackFunction(this, &QmitkSegmentationView::OnBinaryPropertyChanged);
     m_BinaryPropertyObserverTags.insert(std::pair<mitk::DataNode*, unsigned long>(node, node->GetProperty("binary")->AddObserver(itk::ModifiedEvent(), command2)));
   }

   itk::SimpleMemberCommand<QmitkSegmentationView>::Pointer command = itk::SimpleMemberCommand<QmitkSegmentationView>::New();
   command->SetCallbackFunction(this, &QmitkSegmentationView::RenderingManagerReinitialized);
   m_RenderingManagerObserverTag = mitk::RenderingManager::GetInstance()->AddObserver(mitk::RenderingManagerViewsInitializedEvent(), command);

   InitToolManagerSelection(m_Controls->patImageSelector->GetSelectedNode(), m_Controls->segImageSelector->GetSelectedNode());

   m_RenderWindowPart = GetRenderWindowPart();
   if (m_RenderWindowPart)
   {
     RenderWindowPartActivated(m_RenderWindowPart);
   }
}