Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkToFPointSetWidget.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 #include "QmitkToFPointSetWidget.h"
14 
16 #include <mitkVtkLayerController.h>
17 
18 #include <vtkTextProperty.h>
19 
20 
21 const std::string QmitkToFPointSetWidget::VIEW_ID = "org.mitk.views.qmitktofpointsetwidget";
22 
23 QmitkToFPointSetWidget::QmitkToFPointSetWidget(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f)
24 , m_DataStorage(nullptr)
25 , m_DistanceImage(nullptr)
26 , m_CameraIntrinsics(nullptr)
27 , m_TextAnnotationAxial(nullptr)
28 , m_TextAnnotationSagittal(nullptr)
29 , m_TextAnnotationCoronal(nullptr)
30 , m_TextAnnotation3D(nullptr)
31 , m_RendererAxial(nullptr)
32 , m_RendererSagittal(nullptr)
33 , m_RendererCoronal(nullptr)
34 , m_Renderer3D(nullptr)
35 , m_MeasurementPointSet2D(nullptr)
36 , m_MeasurementPointSet3DNode(nullptr)
37 , m_PointSet2D(nullptr)
38 , m_PointSet3DNode(nullptr)
39 , m_PointSetInteractor(nullptr)
40 , m_MeasurementPointSetInteractor(nullptr)
41 , m_MeasurementPointSetChangedObserverTag(0)
42 , m_PointSetChangedObserverTag(0)
43 , m_WindowHeight(0)
44 {
45  m_Controls = nullptr;
46  CreateQtPartControl(this);
47 }
48 
50 {
51  this->CleanUpWidget();
52 }
53 
55 {
56  if (!m_Controls)
57  {
58  // create GUI widgets
59  m_Controls = new Ui::QmitkToFPointSetWidgetControls;
60  m_Controls->setupUi(parent);
61 
62  this->CreateConnections();
63  }
64 }
65 
67 {
68  if (m_Controls)
69  {
70  connect((QObject*)(m_Controls->measureButton), SIGNAL(clicked()), (QObject*) this, SLOT(OnMeasurement()));
71  connect((QObject*)(m_Controls->pointSetButton), SIGNAL(clicked()), (QObject*) this, SLOT(OnPointSet()));
72  }
73 }
74 
75 void QmitkToFPointSetWidget::InitializeWidget(QHash<QString, QmitkRenderWindow*> renderWindowHashMap, mitk::DataStorage::Pointer dataStorage, mitk::CameraIntrinsics::Pointer cameraIntrinsics)
76 {
77  // initialize members
78  m_CameraIntrinsics = cameraIntrinsics;
79  m_DataStorage = dataStorage;
80  // Get renderers of render windows
81  m_RendererAxial = renderWindowHashMap.value("axial")->GetRenderer();
82  m_RendererSagittal = renderWindowHashMap.value("sagittal")->GetRenderer();
83  m_RendererCoronal = renderWindowHashMap.value("coronal")->GetRenderer();
84  m_Renderer3D = renderWindowHashMap.value("3d")->GetRenderer();
85  if ((m_RendererAxial.IsNotNull()) && (m_RendererSagittal.IsNotNull()) && (m_RendererCoronal.IsNotNull()) && (m_Renderer3D.IsNotNull()) && (dataStorage.IsNotNull()))
86  {
87  // enable buttons
88  m_Controls->pointSetButton->setEnabled(true);
89  m_Controls->measureButton->setEnabled(true);
90  // initialize axial text annotation
92  m_TextAnnotationAxial->SetText("Choose measurement points with SHIFT+Click");
93  m_TextAnnotationAxial->SetFontSize(16);
94  m_TextAnnotationAxial->SetColor(1, 0, 0);
95  m_TextAnnotationAxial->SetOpacity(1);
96  m_WindowHeight = m_RendererAxial->GetSizeY();
97  mitk::Point2D axialAnnotationPosition;
98  axialAnnotationPosition[0] = 10;
99  axialAnnotationPosition[0] = m_WindowHeight - 30;
100  m_TextAnnotationAxial->SetPosition2D(axialAnnotationPosition);
101  m_TextAnnotationAxial->SetVisibility(false);
102  // add annotation to axial render window
104  // initialize sagittal text annotation
106  m_TextAnnotationSagittal->SetText("Choose measurement points with SHIFT+Click");
107  m_TextAnnotationSagittal->SetFontSize(16);
108  m_TextAnnotationSagittal->SetColor(1, 0, 0);
109  m_TextAnnotationSagittal->SetOpacity(1);
110  m_WindowHeight = m_RendererSagittal->GetSizeY();
111  mitk::Point2D sagittalAnnotationPosition;
112  sagittalAnnotationPosition[0] = 10;
113  sagittalAnnotationPosition[0] = m_WindowHeight - 30;
114  m_TextAnnotationSagittal->SetPosition2D(sagittalAnnotationPosition);
115  m_TextAnnotationSagittal->SetVisibility(false);
116  // add annotation to axial render window
118  // initialize coronal text annotation
120  m_TextAnnotationCoronal->SetText("Choose measurement points with SHIFT+Click");
121  m_TextAnnotationCoronal->SetFontSize(16);
122  m_TextAnnotationCoronal->SetColor(1, 0, 0);
123  m_TextAnnotationCoronal->SetOpacity(1);
124  m_WindowHeight = m_RendererCoronal->GetSizeY();
125  mitk::Point2D coronalAnnotationPosition;
126  coronalAnnotationPosition[0] = 10;
127  coronalAnnotationPosition[0] = m_WindowHeight - 30;
128  m_TextAnnotationCoronal->SetPosition2D(coronalAnnotationPosition);
129  m_TextAnnotationCoronal->SetVisibility(false);
130  // add annotation to axial render window
132  // initialize 3D text annotation
134  m_TextAnnotation3D->SetText("Choose measurement points with SHIFT+Click");
135  m_TextAnnotation3D->SetFontSize(16);
136  m_TextAnnotation3D->SetColor(1, 0, 0);
137  m_TextAnnotation3D->SetOpacity(1);
138  m_WindowHeight = m_Renderer3D->GetSizeY();
139  mitk::Point2D annotationPosition3D;
140  annotationPosition3D[0] = 10;
141  annotationPosition3D[0] = m_WindowHeight - 30;
142  m_TextAnnotation3D->SetPosition2D(annotationPosition3D);
143  m_TextAnnotation3D->SetVisibility(false);
144  // add annotation to axial render window
146 
147  //mitk::LayoutAnnotationRenderer::AddAnnotation(m_TextAnnotation, renderWindowHashMap.value("axial")->GetRenderer());
148  //mitk::LayoutAnnotationRenderer::AddAnnotation(m_TextAnnotation, renderWindowHashMap.value("coronal")->GetRenderer());
149 
151  //this->m_VtkTextActor = vtkSmartPointer<vtkTextActor>::New();
152  //this->m_VtkTextActor->SetInput("Choose measurement points with SHIFT+Click");
153  //m_WindowHeight = renderWindowHashMap.value("axial")->GetRenderer()->GetSizeY();
155  //this->m_VtkTextActor->SetDisplayPosition(50, 50);
156  //this->m_VtkTextActor->GetTextProperty()->SetFontSize(16);
158  //this->m_VtkTextActor->GetTextProperty()->BoldOn();
159  //this->m_VtkTextActor->SetVisibility(1);
160  //if (m_ForegroundRenderer1==nullptr)
161  //{
162  // this->m_ForegroundRenderer1 = vtkSmartPointer<vtkRenderer>::New();
163  // this->m_ForegroundRenderer1->AddActor(m_VtkTextActor);
164  // mitk::VtkLayerController::GetInstance(m_RenderWindow1)->InsertForegroundRenderer(m_ForegroundRenderer1,true);
165  //}
166  //if (m_ForegroundRenderer2==nullptr)
167  //{
168  // this->m_ForegroundRenderer2 = vtkSmartPointer<vtkRenderer>::New();
169  // this->m_ForegroundRenderer2->AddActor(m_VtkTextActor);
170  // mitk::VtkLayerController::GetInstance(m_RenderWindow2)->InsertForegroundRenderer(m_ForegroundRenderer2,true);
171  //}
172  //if (m_ForegroundRenderer3==nullptr)
173  //{
174  // this->m_ForegroundRenderer3 =vtkSmartPointer<vtkRenderer>::New();
175  // this->m_ForegroundRenderer3->AddActor(m_VtkTextActor);
176  // mitk::VtkLayerController::GetInstance(m_RenderWindow3)->InsertForegroundRenderer(m_ForegroundRenderer3,true);
177  //}
178 
179  mitk::DataNode::Pointer measurementPointSet2DNode = dataStorage->GetNamedNode("Measurement PointSet 2D");
180  if (dataStorage->Exists(measurementPointSet2DNode))
181  {
182  dataStorage->Remove(measurementPointSet2DNode);
183  }
184  // initialize 2D measurement point set
186  measurementPointSet2DNode = mitk::DataNode::New();
187  measurementPointSet2DNode->SetName("Measurement PointSet 2D");
188  measurementPointSet2DNode->SetBoolProperty("helper object", true);
189  measurementPointSet2DNode->SetBoolProperty("show contour", true);
190  measurementPointSet2DNode->SetVisibility(false, renderWindowHashMap.value("3d")->GetRenderer());
191  measurementPointSet2DNode->SetData(m_MeasurementPointSet2D);
192  dataStorage->Add(measurementPointSet2DNode);
194  m_MeasurementPointSetInteractor->LoadStateMachine("PointSet.xml");
195  m_MeasurementPointSetInteractor->SetEventConfig("PointSetConfig.xml");
196  m_MeasurementPointSetInteractor->SetDataNode(measurementPointSet2DNode);
197  m_MeasurementPointSetInteractor->SetMaxPoints(2);
198 
199  // create observer for m_MeasurementPointSet2D
200  itk::SimpleMemberCommand<QmitkToFPointSetWidget>::Pointer measurementPointSetChangedCommand;
201  measurementPointSetChangedCommand = itk::SimpleMemberCommand<QmitkToFPointSetWidget>::New();
202  measurementPointSetChangedCommand->SetCallbackFunction(this, &QmitkToFPointSetWidget::MeasurementPointSetChanged);
203  m_MeasurementPointSetChangedObserverTag = m_MeasurementPointSet2D->AddObserver(itk::ModifiedEvent(), measurementPointSetChangedCommand);
204  // initialize 3D measurement PointSet
205  m_MeasurementPointSet3DNode = dataStorage->GetNamedNode("Measurement PointSet 3D");
206  if (dataStorage->Exists(m_MeasurementPointSet3DNode))
207  {
208  dataStorage->Remove(m_MeasurementPointSet3DNode);
209  }
211  m_MeasurementPointSet3DNode->SetName("Measurement PointSet 3D");
212  m_MeasurementPointSet3DNode->SetBoolProperty("helper object", true);
213  m_MeasurementPointSet3DNode->SetBoolProperty("show contour", true);
214  m_MeasurementPointSet3DNode->SetFloatProperty("pointsize", 5.0f);
215  mitk::PointSet::Pointer measurementPointSet3D = mitk::PointSet::New();
216  m_MeasurementPointSet3DNode->SetData(measurementPointSet3D);
217  dataStorage->Add(m_MeasurementPointSet3DNode);
218 
219  // initialize PointSets
220  mitk::DataNode::Pointer pointSet2DNode = dataStorage->GetNamedNode("ToF PointSet 2D");
221  if (dataStorage->Exists(pointSet2DNode))
222  {
223  dataStorage->Remove(pointSet2DNode);
224  }
226  pointSet2DNode = mitk::DataNode::New();
227  pointSet2DNode->SetName("ToF PointSet 2D");
228  pointSet2DNode->SetVisibility(false, renderWindowHashMap.value("3d")->GetRenderer());
229  pointSet2DNode->SetData(m_PointSet2D);
230  dataStorage->Add(pointSet2DNode);
232  m_PointSetInteractor->LoadStateMachine("PointSet.xml");
233  m_PointSetInteractor->SetEventConfig("PointSetConfig.xml");
234  m_PointSetInteractor->SetDataNode(pointSet2DNode);
235 
236  // create observer for m_MeasurementPointSet2D
237  itk::SimpleMemberCommand<QmitkToFPointSetWidget>::Pointer pointSetChangedCommand;
238  pointSetChangedCommand = itk::SimpleMemberCommand<QmitkToFPointSetWidget>::New();
239  pointSetChangedCommand->SetCallbackFunction(this, &QmitkToFPointSetWidget::PointSetChanged);
240  m_PointSetChangedObserverTag = m_PointSet2D->AddObserver(itk::ModifiedEvent(), pointSetChangedCommand);
241  // initialize 3D point set
242  mitk::DataNode::Pointer pointSet3DNode = dataStorage->GetNamedNode("ToF PointSet 3D");
243  if (dataStorage->Exists(pointSet3DNode))
244  {
245  dataStorage->Remove(pointSet3DNode);
246  }
248  m_PointSet3DNode->SetName("ToF PointSet 3D");
249  m_PointSet3DNode->SetFloatProperty("pointsize", 5.0f);
251  m_PointSet3DNode->SetData(pointSet3D);
252  dataStorage->Add(m_PointSet3DNode);
253  }
254 }
255 
257 {
258  // toggle button state
259  if (m_Controls->measureButton->isChecked())
260  {
261  m_Controls->measureButton->setChecked(false);
262  this->OnMeasurement();
263  }
264  if (m_Controls->pointSetButton->isChecked())
265  {
266  m_Controls->pointSetButton->setChecked(false);
267  this->OnPointSet();
268  }
269  // remove observer
270  if (m_MeasurementPointSet2D.IsNotNull())
271  {
273  }
274  if (m_PointSet2D.IsNotNull())
275  {
277  }
278  // if (m_DistanceImage.IsNotNull())
279  // {
280  // m_DistanceImage->RemoveObserver(m_DistanceImageChangedObserverTag);
281  // }
283  //if (m_ForegroundRenderer1&&m_RenderWindow1)
284  //{
285  // if (mitk::VtkLayerController::GetInstance(m_RenderWindow1))
286  // {
287  // mitk::VtkLayerController::GetInstance(m_RenderWindow1)->RemoveRenderer(m_ForegroundRenderer1);
288  // }
289  // m_ForegroundRenderer1 = nullptr;
290  //}
291  //if (m_ForegroundRenderer2&&m_RenderWindow2)
292  //{
293  // if (mitk::VtkLayerController::GetInstance(m_RenderWindow2))
294  // {
295  // mitk::VtkLayerController::GetInstance(m_RenderWindow2)->RemoveRenderer(m_ForegroundRenderer2);
296  // }
297  // m_ForegroundRenderer2 = nullptr;
298  //}
299  //if (m_ForegroundRenderer3&&m_RenderWindow3)
300  //{
301  // if (mitk::VtkLayerController::GetInstance(m_RenderWindow3))
302  // {
303  // mitk::VtkLayerController::GetInstance(m_RenderWindow3)->RemoveRenderer(m_ForegroundRenderer3);
304  // }
305  // m_ForegroundRenderer3 = nullptr;
306  //}
308  {
310  }
311 }
312 
314 {
315  // // remove existing observer
316  // if (m_DistanceImage.IsNotNull())
317  // {
318  // m_DistanceImage->RemoveObserver(m_DistanceImageChangedObserverTag);
319  // }
320  m_DistanceImage = distanceImage;
321  // // create observer for m_DistanceImage
322  // itk::SimpleMemberCommand<QmitkToFPointSetWidget>::Pointer distanceImageChangedCommand;
323  // distanceImageChangedCommand = itk::SimpleMemberCommand<QmitkToFPointSetWidget>::New();
324  // distanceImageChangedCommand->SetCallbackFunction(this, &QmitkToFPointSetWidget::MeasurementPointSetChanged);
325  // m_DistanceImageChangedObserverTag = m_DistanceImage->AddObserver(itk::ModifiedEvent(), distanceImageChangedCommand);
326 }
327 
328 void QmitkToFPointSetWidget::SetCameraIntrinsics(mitk::CameraIntrinsics::Pointer cameraIntrinsics)
329 {
330  m_CameraIntrinsics = cameraIntrinsics;
331 }
332 
334 {
335  // always show 2D PointSet in foreground
336  mitk::DataNode::Pointer pointSetNode = m_DataStorage->GetNamedNode("Measurement PointSet 2D");
337  if (pointSetNode.IsNotNull())
338  {
339  pointSetNode->SetIntProperty("layer", 100);
340  }
341  if (m_Controls->measureButton->isChecked())
342  {
343  // disable point set interaction
344  if (m_Controls->pointSetButton->isChecked())
345  {
346  m_Controls->pointSetButton->setChecked(false);
347  // remove interactor
348  m_PointSetInteractor->EnableInteraction(false);
349  }
350  // show overlays
351  m_TextAnnotationAxial->SetText("Choose measurement points with SHIFT+Click");
352  m_TextAnnotationSagittal->SetText("Choose measurement points with SHIFT+Click");
353  m_TextAnnotationCoronal->SetText("Choose measurement points with SHIFT+Click");
354  m_TextAnnotation3D->SetText("Choose measurement points with SHIFT+Click");
355  m_TextAnnotationAxial->SetVisibility(true);
356  m_TextAnnotationSagittal->SetVisibility(true);
357  m_TextAnnotationCoronal->SetVisibility(true);
358  m_TextAnnotation3D->SetVisibility(true);
359  // enable interactor
360  m_MeasurementPointSetInteractor->EnableInteraction(true);
361  // initial update of measurement
363  }
364  else
365  {
366  // hide overlays
367  m_TextAnnotationAxial->SetVisibility(false);
368  m_TextAnnotationSagittal->SetVisibility(false);
369  m_TextAnnotationCoronal->SetVisibility(false);
370  m_TextAnnotation3D->SetVisibility(false);
371  // disable interactor
372  m_MeasurementPointSetInteractor->EnableInteraction(false);
373  }
374 }
375 
377 {
378  // always show 2D PointSet in foreground
379  mitk::DataNode::Pointer pointSetNode = m_DataStorage->GetNamedNode("ToF PointSet 2D");
380  if (pointSetNode.IsNotNull())
381  {
382  pointSetNode->SetIntProperty("layer", 100);
383  }
384  if (m_Controls->pointSetButton->isChecked())
385  {
386  // disable measurement
387  if (m_Controls->measureButton->isChecked())
388  {
389  m_Controls->measureButton->setChecked(false);
390  // remove interactor
391  m_MeasurementPointSetInteractor->EnableInteraction(false);
392  }
393  // show overlays
394  m_TextAnnotationAxial->SetText("Choose points with SHIFT+Click");
395  m_TextAnnotationSagittal->SetText("Choose points with SHIFT+Click");
396  m_TextAnnotationCoronal->SetText("Choose points with SHIFT+Click");
397  m_TextAnnotation3D->SetText("Choose points with SHIFT+Click");
398  m_TextAnnotationAxial->SetVisibility(true);
399  m_TextAnnotationSagittal->SetVisibility(true);
400  m_TextAnnotationCoronal->SetVisibility(true);
401  m_TextAnnotation3D->SetVisibility(true);
402  // enable interactor
403  m_PointSetInteractor->EnableInteraction(true);
404  // initial update of PointSet
405  this->PointSetChanged();
406  }
407  else
408  {
409  // hide overlays
410  m_TextAnnotationAxial->SetVisibility(false);
411  m_TextAnnotationSagittal->SetVisibility(false);
412  m_TextAnnotationCoronal->SetVisibility(false);
413  m_TextAnnotation3D->SetVisibility(false);
414  // disable interactor
415  m_PointSetInteractor->EnableInteraction(false);
416  }
417 }
418 
420 {
421  if (m_MeasurementPointSet2D->GetSize() == 2)
422  {
423  // check if points are inside the image range
424  int imageSizeX = m_DistanceImage->GetDimensions()[0];
425  int imageSizeY = m_DistanceImage->GetDimensions()[1];
426  mitk::Point3D point1 = m_MeasurementPointSet2D->GetPoint(0);
427  mitk::Point3D point2 = m_MeasurementPointSet2D->GetPoint(1);
428  if ((point1[0] >= 0.0f) && (point1[0] < imageSizeX) && (point1[1] >= 0) && (point1[1] < imageSizeY) &&
429  (point2[0] >= 0.0f) && (point2[0] < imageSizeX) && (point2[1] >= 0) && (point2[1] < imageSizeY))
430  {
431  // create PointSet filter
433  if (m_CameraIntrinsics.IsNotNull())
434  {
435  toFDistanceImageToPointSetFilter->SetCameraIntrinsics(m_CameraIntrinsics);
436  }
437  toFDistanceImageToPointSetFilter->SetInput(m_DistanceImage);
438  toFDistanceImageToPointSetFilter->SetSubset(m_MeasurementPointSet2D);
439  toFDistanceImageToPointSetFilter->Update();
440  mitk::PointSet::Pointer measurementPointSet3D = toFDistanceImageToPointSetFilter->GetOutput();
441  m_MeasurementPointSet3DNode->SetData(measurementPointSet3D);
442 
443  // calculate distance between points
444  if (measurementPointSet3D->GetSize() == 2)
445  {
446  mitk::Point3D point1 = measurementPointSet3D->GetPoint(0);
447  mitk::Point3D point2 = measurementPointSet3D->GetPoint(1);
448  float distance = point1.EuclideanDistanceTo(point2);
449  std::stringstream stream;
450  stream << distance << " mm";
451  m_TextAnnotationAxial->SetText(stream.str().c_str());
452  m_TextAnnotationSagittal->SetText(stream.str().c_str());
453  m_TextAnnotationCoronal->SetText(stream.str().c_str());
454  m_TextAnnotation3D->SetText(stream.str().c_str());
455  //this->m_VtkTextActor->SetInput(stream.str().c_str());
456  }
457  else
458  {
459  m_TextAnnotationAxial->SetText("Choose measurement points with SHIFT+Click");
460  m_TextAnnotationSagittal->SetText("Choose measurement points with SHIFT+Click");
461  m_TextAnnotationCoronal->SetText("Choose measurement points with SHIFT+Click");
462  m_TextAnnotation3D->SetText("Choose measurement points with SHIFT+Click");
463  }
464  }
465  else
466  {
467  this->m_TextAnnotationAxial->SetText("Measurement outside image range.");
468  this->m_TextAnnotationSagittal->SetText("Measurement outside image range.");
469  this->m_TextAnnotationCoronal->SetText("Measurement outside image range.");
470  this->m_TextAnnotation3D->SetText("Measurement outside image range.");
471  }
472  }
473  else
474  {
475  // initialize 3D pointset empty
477  m_MeasurementPointSet3DNode->SetData(pointSet3D);
478  }
479 }
480 
482 {
483  if (m_DistanceImage.IsNotNull())
484  {
485  int imageSizeX = m_DistanceImage->GetDimensions()[0];
486  int imageSizeY = m_DistanceImage->GetDimensions()[1];
487  int pointSetValid = 1;
488  for (int i = 0; i < m_PointSet2D->GetSize(); i++)
489  {
490  mitk::Point3D currentPoint = m_PointSet2D->GetPoint(i);
491  if ((currentPoint[0] >= 0.0f) && (currentPoint[0] < imageSizeX) && (currentPoint[1] >= 0) && (currentPoint[1] < imageSizeY))
492  {
493  pointSetValid *= 1;
494  }
495  else
496  {
497  pointSetValid *= 0;
498  }
499  }
500  if (m_PointSet2D->GetSize() > 0)
501  {
502  if (pointSetValid)
503  {
504  // create PointSet filter
506  if (m_CameraIntrinsics.IsNotNull())
507  {
508  toFDistanceImageToPointSetFilter->SetCameraIntrinsics(m_CameraIntrinsics);
509  }
510  toFDistanceImageToPointSetFilter->SetInput(m_DistanceImage);
511  toFDistanceImageToPointSetFilter->SetSubset(m_PointSet2D);
512  toFDistanceImageToPointSetFilter->Update();
513  mitk::PointSet::Pointer pointSet3D = toFDistanceImageToPointSetFilter->GetOutput();
514  m_PointSet3DNode->SetData(pointSet3D);
515  this->m_TextAnnotation3D->SetText("Choose points with SHIFT+Click");
516  }
517  else
518  {
519  this->m_TextAnnotation3D->SetText("Point set outside image range.");
520  }
521  }
522  else
523  {
524  // initialize 3D pointset empty
526  m_PointSet3DNode->SetData(pointSet3D);
527  }
528  }
529 }
mitk::TextAnnotation2D::Pointer m_TextAnnotationCoronal
text annotation used to display measurement in axial window
mitk::VtkPropRenderer::Pointer m_RendererSagittal
renderer of sagittal render window
void PointSetChanged()
function called when the 2D PointSet has changed
static const std::string VIEW_ID
static Pointer New()
mitk::VtkPropRenderer::Pointer m_RendererAxial
renderer of axial render window
mitk::PointSetDataInteractor::Pointer m_MeasurementPointSetInteractor
PointSetInteractor used for measurement.
void SetDistanceImage(mitk::Image::Pointer distanceImage)
set the image holding the distance information used for measuring
long m_PointSetChangedObserverTag
observer tag for PointSet observer
static void AddAnnotation(Annotation *annotation, const std::string &rendererID, Alignment alignment=TopLeft, double marginX=5, double marginY=5, int priority=-1)
void OnMeasurement()
Activates the interactor for the measurement point set.
mitk::DataNode::Pointer m_PointSet3DNode
DataNode holding the 3D ToF coordinates.
mitk::Image::Pointer m_DistanceImage
image holding the range data of the ToF camera
static Pointer New()
mitk::DataNode::Pointer m_MeasurementPointSet3DNode
DataNode holding the 3D ToF coordinates used for measuring.
void SetCameraIntrinsics(mitk::CameraIntrinsics::Pointer cameraIntrinsics)
Set intrinsic parameters of the used device.
virtual void CreateQtPartControl(QWidget *parent)
mitk::TextAnnotation2D::Pointer m_TextAnnotation3D
text annotation used to display measurement in 3d window
long m_MeasurementPointSetChangedObserverTag
observer tag for measurement PointSet observer
mitk::PointSet::Pointer m_MeasurementPointSet2D
PointSet holding the 2D ToF image point selection used for measuring.
mitk::DataStorage::Pointer m_DataStorage
void OnPointSet()
Activates the interactor for the point set.
static Pointer New()
void InitializeWidget(QHash< QString, QmitkRenderWindow *> renderWindowHashMap, mitk::DataStorage::Pointer dataStorage, mitk::CameraIntrinsics::Pointer cameraIntrinsics=nullptr)
initializes the widget. Observers to the change events of the point sets are created, text actors are activated to be rendered into the foreground of the render window.
static RenderingManager * GetInstance()
void CleanUpWidget()
cleans up the widget when it&#39;s functionality is not used anymore. Removes observers and deletes foreg...
Ui::QmitkToFPointSetWidgetControls * m_Controls
member holding the UI elements of this widget
mitk::PointSet::Pointer m_PointSet2D
PointSet holding the 2D ToF image points.
int m_WindowHeight
Height of the renderWindow.
mitk::VtkPropRenderer::Pointer m_RendererCoronal
renderer of coronal render window
mitk::TextAnnotation2D::Pointer m_TextAnnotationSagittal
text annotation used to display measurement in axial window
void MeasurementPointSetChanged()
function called when the 2D measurement PointSet has changed
QmitkToFPointSetWidget(QWidget *p=nullptr, Qt::WindowFlags f1=nullptr)
mitk::DataStorage::Pointer m_DataStorage
member holding the set DataStorage
mitk::TextAnnotation2D::Pointer m_TextAnnotationAxial
text annotation used to display measurements in axial window
mitk::VtkPropRenderer::Pointer m_Renderer3D
renderer of 3D render window
mitk::CameraIntrinsics::Pointer m_CameraIntrinsics
intrinsic parameters of the camera
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
mitk::PointSetDataInteractor::Pointer m_PointSetInteractor
PointSetInteractor used for PointSet definition.