Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkPAUSViewerView.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 // Blueberry
14 #include <berryISelectionService.h>
15 #include <berryIWorkbenchWindow.h>
19 #include "mitkTextAnnotation2D.h"
20 
21 #include "QmitkPAUSViewerView.h"
22 
23 const std::string QmitkPAUSViewerView::VIEW_ID = "org.mitk.views.photoacoustics.pausviewer";
24 
25 QmitkPAUSViewerView::QmitkPAUSViewerView() : m_PADataStorage(mitk::StandaloneDataStorage::New()), m_USDataStorage(mitk::StandaloneDataStorage::New()), m_UltrasoundReference(nullptr)
26 {
27 }
28 
30 {
31  if(m_UltrasoundReference != nullptr)
32  *m_UltrasoundReference = nullptr;
33 }
34 
36 {
37  AddOverlays();
38 }
39 
41 {
42 }
43 
45  const QList<mitk::DataNode::Pointer>& /*nodes*/)
46 {
47 }
48 
50 {
51  m_Controls = new Ui::QmitkPAUSViewerViewControls;
52  m_Controls->setupUi(parent);
53 
54  m_Controls->m_PARenderWindow->GetRenderer()->SetDataStorage(m_PADataStorage);
55  m_Controls->m_USRenderWindow->GetRenderer()->SetDataStorage(m_USDataStorage);
56 }
57 
59 {
60  if (m_Controls == nullptr)
61  return;
62 
63  m_PADataStorage = paStore;
64  m_Controls->m_PARenderWindow->GetRenderer()->SetDataStorage(m_PADataStorage);
65  m_Controls->m_PALevelWindow->SetDataStorage(m_PADataStorage);
66 }
67 
69 {
70  if (m_Controls == nullptr)
71  return;
72 
73  m_USDataStorage = usStore;
74  m_Controls->m_USRenderWindow->GetRenderer()->SetDataStorage(m_USDataStorage);
75  m_Controls->m_USLevelWindow->SetDataStorage(m_USDataStorage);
76 }
77 
79 {
80  if (m_Controls == nullptr)
81  return nullptr;
82 
83  return m_Controls->m_PARenderWindow->GetRenderWindow();
84 }
85 
87 {
88  if (m_Controls == nullptr)
89  return nullptr;
90 
91  return m_Controls->m_USRenderWindow->GetRenderWindow();
92 }
93 
94 
96 {
97  //if (m_PARenderer == nullptr || /*m_PAOverlayController == nullptr||*/ m_USRenderer == nullptr /*|| m_USOverlayController == nullptr*/)
98  //{
101  //}
102  MITK_INFO << "1111111111111111111111";
104  //scaleAnnotation->SetLeftAxisVisibility(true);
105  //scaleAnnotation->SetRightAxisVisibility(false);
106  //scaleAnnotation->SetRightAxisVisibility(false);
107  //scaleAnnotation->SetTopAxisVisibility(false);
108  //scaleAnnotation->SetCornerOffsetFactor(0);
109  MITK_INFO << "1111111111111111111111";
110 
111  // Add Overlays
113  // Create a textAnnotation2D
115 
116  textAnnotation->SetText("Test!"); // set UTF-8 encoded text to render
117  textAnnotation->SetFontSize(40);
118  textAnnotation->SetColor(1, 0, 0); // Set text color to red
119  textAnnotation->SetOpacity(0.5);
120  MITK_INFO << "1111111111111111111111";
121 
122  // The position of the Annotation can be set to a fixed coordinate on the display.
123  mitk::Point2D pos;
124  pos[0] = 10;
125  pos[1] = 20;
126  textAnnotation->SetPosition2D(pos);
127  MITK_INFO << "1111111111111111111111";
128 
129  std::string rendererID = m_PARenderer->GetName();
130 
131  // The LayoutAnnotationRenderer can place the TextAnnotation2D at some defined corner positions
133  textAnnotation, rendererID, mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
135  textAnnotation, m_PARenderer.GetPointer(), mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
137  textAnnotation, m_PARenderer.GetPointer());
138  MITK_INFO << "1111111111111111111111";
139 
140 
143  MITK_INFO << "1111111111111111111111";
144 
145 }
146 
148 {
149  // m_PAOverlayManager->RemoveAllOverlays();
150 }
151 
153 {
154  m_UltrasoundReference = ultrasoundReference;
155 }
void SetPADataStorage(mitk::StandaloneDataStorage::Pointer paStore)
Ui::QmitkPAUSViewerViewControls * m_Controls
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
#define MITK_INFO
Definition: mitkLogMacros.h:18
mitk::StandaloneDataStorage::Pointer m_USDataStorage
void SetUSDataStorage(mitk::StandaloneDataStorage::Pointer usStore)
DataCollection - Class to facilitate loading/accessing structured data.
static void AddAnnotation(Annotation *annotation, const std::string &rendererID, Alignment alignment=TopLeft, double marginX=5, double marginY=5, int priority=-1)
static Pointer New()
void OnSelectionChanged(berry::IWorkbenchPart::Pointer, const QList< mitk::DataNode::Pointer > &) override
vtkRenderWindow * GetUSRenderWindow()
mitk::BaseRenderer::Pointer m_USRenderer
static void AddAnnotation(Annotation *Annotation, const std::string &rendererID)
QmitkPAUSViewerView ** m_UltrasoundReference
vtkRenderWindow * GetPARenderWindow()
mitk::StandaloneDataStorage::Pointer m_PADataStorage
void SetUltrasoundReference(QmitkPAUSViewerView **ultrasoundReference)
mitk::BaseRenderer::Pointer m_PARenderer
static const std::string VIEW_ID
void CreateQtPartControl(QWidget *parent) override