CustusX  20.03-rc1
An IGT application
cxViewWrapper2D.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 /*
13  * cxViewWrapper2D.cpp
14  *
15  * \date Mar 24, 2010
16  * \author christiana
17  */
18 
19 
20 #include "cxViewWrapper2D.h"
21 #include <vector>
22 #include <vtkCamera.h>
23 #include <vtkRenderer.h>
24 #include <vtkRenderWindow.h>
25 
26 #include <QAction>
27 #include <QActionGroup>
28 #include <QMenu>
29 #include <QMouseEvent>
30 #include <QWheelEvent>
31 
32 #include "cxUtilHelpers.h"
33 #include "cxView.h"
34 #include "cxSliceProxy.h"
35 #include "cxSlicerRepSW.h"
36 #include "cxToolRep2D.h"
39 #include "cxDisplayTextRep.h"
40 
41 #include "cxManualTool.h"
42 #include "cxTrackingService.h"
43 #include "cxViewGroup.h"
44 #include "cxSlicePlanes3DRep.h"
45 #include "cxSliceComputer.h"
46 #include "cxGeometricRep2D.h"
47 #include "cxDataLocations.h"
48 #include "cxSettings.h"
49 #include "cxGLHelpers.h"
50 #include "cxData.h"
51 #include "cxMesh.h"
52 #include "cxImage.h"
53 #include "cxTrackedStream.h"
54 #include "cxPointMetricRep2D.h"
55 
56 #include "cxViewFollower.h"
57 #include "cxVisServices.h"
58 #include "cx2DZoomHandler.h"
59 #include "cxNavigation.h"
60 #include "cxDataRepContainer.h"
61 #include "vtkRenderWindowInteractor.h"
62 #include "cxPatientModelService.h"
63 #include "cxLogger.h"
64 #include "cxViewService.h"
66 
67 #include "cxTexture3DSlicerRep.h"
68 
69 namespace cx
70 {
71 
73  ViewWrapper(backend),
74  mOrientationActionGroup(new QActionGroup(view.get()))
75 {
76  qRegisterMetaType<Vector3D>("Vector3D");
77  mView = view;
78  this->connectContextMenu(mView);
79 
80  // disable vtk interactor: this wrapper IS an interactor
81  mView->getRenderWindow()->GetInteractor()->Disable();
82  mView->getRenderer()->GetActiveCamera()->SetParallelProjection(true);
83  double clipDepth = 1.0; // 1mm depth, i.e. all 3D props rendered outside this range is not shown.
84  double length = clipDepth*10;
85  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
86  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
87 
88  // slice proxy
89  mSliceProxy = SliceProxy::create(mServices->patient());
90 
91  mDataRepContainer.reset(new DataRepContainer());
92  mDataRepContainer->setSliceProxy(mSliceProxy);
93  mDataRepContainer->setView(mView);
94 
95  mViewFollower = ViewFollower::create(mServices->patient());
96  mViewFollower->setSliceProxy(mSliceProxy);
97 
98  addReps();
99 
100  mZoom2D.reset(new Zoom2DHandler());
101  connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged()));
102 
103  connect(mServices->tracking().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(activeToolChangedSlot()));
104  connect(mView.get(), SIGNAL(resized(QSize)), this, SLOT(viewportChanged()));
105  connect(mView.get(), SIGNAL(shown()), this, SLOT(showSlot()));
106  connect(mView.get(), SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SLOT(mousePressSlot(int, int, Qt::MouseButtons)));
107  connect(mView.get(), SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SLOT(mouseMoveSlot(int, int, Qt::MouseButtons)));
108  connect(mView.get(), SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SLOT(mouseWheelSlot(int, int, int, int, Qt::MouseButtons)));
109 
111 
112  this->activeToolChangedSlot();
113  this->updateView();
114 }
115 
117 {
118  if (mView)
119  mView->removeReps();
120 }
121 
122 void ViewWrapper2D::changeZoom(double delta)
123 {
124  if (similar(delta, 1.0))
125  return;
126 
127  double zoom = mZoom2D->getFactor();
128 // CX_LOG_CHANNEL_DEBUG("CA") << "changing zoom from " << zoom << " by " << delta;
129  zoom *= delta;
130 // CX_LOG_CHANNEL_DEBUG("CA") << " new zoom:" << zoom;
131  mZoom2D->setFactor(zoom);
132 // CX_LOG_CHANNEL_DEBUG("CA") << " got zoom:" << mZoom2D->getFactor();
133 }
134 
136 {
137  if(!this->isAnyplane())
138  return;
139 
140  Transform3D sMr = mSliceProxy->get_sMr();
141  Transform3D vpMs = mView->get_vpMs();
142 
143  Vector3D p_s = vpMs.inv().coord(click_vp);
144  Vector3D p_r = sMr.inv().coord(p_s);
145 
146  emit pointSampled(p_r);
147 }
148 
149 void ViewWrapper2D::appendToContextMenu(QMenu& contextMenu)
150 {
151  contextMenu.addSeparator();
152  mZoom2D->addActionsToMenu(&contextMenu);
153 
154  contextMenu.addSeparator();
155  QAction* showManualTool = new QAction("Show Manual Tool 2D", &contextMenu);
156  showManualTool->setCheckable(true);
157  showManualTool->setChecked(settings()->value("View2D/showManualTool").toBool());
158  connect(showManualTool, SIGNAL(triggered(bool)), this, SLOT(showManualToolSlot(bool)));
159  contextMenu.addAction(showManualTool);
160 }
161 
163 {
165 
166  mZoom2D->setGroupData(group);
167  connect(group.get(), SIGNAL(optionsChanged()), this, SLOT(optionChangedSlot()));
168  this->optionChangedSlot();
169 }
170 
171 void ViewWrapper2D::optionChangedSlot()
172 {
173  ViewGroupData::Options options = mGroupData->getOptions();
174 
175  if (mPickerGlyphRep)
176  {
177  mPickerGlyphRep->setMesh(options.mPickerGlyph);
178  }
179 }
180 
181 void ViewWrapper2D::addReps()
182 {
183  // annotation rep
184  mOrientationAnnotationRep = OrientationAnnotationSmartRep::New();
185  mView->addRep(mOrientationAnnotationRep);
186 
187  this->ViewWrapper::addReps();
188 
189  // tool rep
190  mToolRep2D = ToolRep2D::New(mServices->spaceProvider(), "Tool2D_" + mView->getName());
191  mToolRep2D->setSliceProxy(mSliceProxy);
192  mToolRep2D->setUseCrosshair(true);
193  this->toggleShowManualTool();
194 
195  mPickerGlyphRep = GeometricRep2D::New("PickerGlyphRep_" + mView->getName());
196  mPickerGlyphRep->setSliceProxy(mSliceProxy);
197  if (mGroupData)
198  {
199  mPickerGlyphRep->setMesh(mGroupData->getOptions().mPickerGlyph);
200  }
201  mView->addRep(mPickerGlyphRep);
202 }
203 
205 {
207 
208  if (key == "View2D/useGPU2DRendering")
209  {
210  this->updateView();
211  }
212  if (key == "View2D/useLinearInterpolationIn2DRendering")
213  {
214  this->updateView();
215  }
216  if (key == "Navigation/anyplaneViewOffset")
217  {
218  this->updateView();
219  }
220  if (key == "View2D/showManualTool")
221  {
222  this->toggleShowManualTool();
223  }
224 }
225 
226 void ViewWrapper2D::toggleShowManualTool()
227 {
228  if (settings()->value("View2D/showManualTool").toBool())
229  mView->addRep(mToolRep2D);
230  else
231  mView->removeRep(mToolRep2D);
232 }
233 
234 void ViewWrapper2D::removeAndResetSliceRep()
235 {
236  if (mSliceRep)
237  {
238  mView->removeRep(mSliceRep);
239  mSliceRep.reset();
240  }
241 }
242 
243 void ViewWrapper2D::removeAndResetMultiSliceRep()
244 {
245  if (mMultiSliceRep)
246  {
247  mView->removeRep(mMultiSliceRep);
248  mMultiSliceRep.reset();
249  }
250 }
251 
252 bool ViewWrapper2D::createAndAddMultiSliceRep()
253 {
255  {
256  CX_LOG_WARNING() << "ViewWrapper2D::createAndAddMultiSliceRep(): Got no mSharedOpenGLContext";
257  return false;
258  }
259  if (mMultiSliceRep)
260  return true;
261 
263  mMultiSliceRep->setShaderPath(DataLocations::findConfigFolder("/shaders"));
264  mMultiSliceRep->setSliceProxy(mSliceProxy);
265  mMultiSliceRep->setRenderWindow(mView->getRenderWindow());
266 
267  mView->addRep(mMultiSliceRep);
268 
269  return true;
270 }
271 
277 void ViewWrapper2D::recreateMultiSlicer()
278 {
279  this->removeAndResetSliceRep();
280 
281  if (!this->useGPU2DRendering())
282  {
283  this->removeAndResetMultiSliceRep();
284  return;
285  }
286 
287  if(!this->createAndAddMultiSliceRep())
288  {
289  return;
290  }
291 
292  if (mGroupData)
293  mMultiSliceRep->setImages(this->getImagesToView());
294  else
295  mMultiSliceRep->setImages(std::vector<ImagePtr>());
296 
297  this->viewportChanged();
298 }
299 
300 std::vector<ImagePtr> ViewWrapper2D::getImagesToView()
301 {
302  bool include2D = this->isAnyplane();
303  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), include2D);
304  return images;
305 }
306 
307 bool ViewWrapper2D::isAnyplane()
308 {
309  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
310  return plane == ptANYPLANE;
311 }
312 
316 void ViewWrapper2D::viewportChanged()
317 {
318  if (!mView->getRenderer()->IsActiveCameraCreated())
319  return;
320 
321  mView->setZoomFactor(mZoom2D->getFactor());
322 
323  double viewHeight = mView->getViewport_s().range()[1];
324  mView->getRenderer()->GetActiveCamera()->SetParallelScale(viewHeight / 2);
325 
326  // Heuristic guess for a good clip depth. The point is to show 3D data clipped in 2D
327  // with a suitable thickness projected onto the plane.
328  double clipDepth = 2.0; // i.e. all 3D props rendered outside this range is not shown.
329  double length = clipDepth*10;
330  clipDepth = viewHeight/120 + 1.5;
331  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
332  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
333 
334  mSliceProxy->setToolViewportHeight(viewHeight);
335  double anyplaneViewOffset = settings()->value("Navigation/anyplaneViewOffset").toDouble();
336  mSliceProxy->initializeFromPlane(mSliceProxy->getComputer().getPlaneType(), false, true, viewHeight, anyplaneViewOffset);
337 
338  DoubleBoundingBox3D BB_vp = getViewport();
339  Transform3D vpMs = mView->get_vpMs();
340  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
341  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
342 
343  mToolRep2D->setViewportData(vpMs, BB_vp);
344  if (mSlicePlanes3DMarker)
345  {
346  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, BB_s);
347  }
348 }
349 
350 void ViewWrapper2D::applyViewFollower()
351 {
352  if (!mGroupData)
353  return;
354  QString roiUid = mGroupData->getOptions().mCameraStyle.mAutoZoomROI;
355  mViewFollower->setAutoZoomROI(roiUid);
356  mViewFollower->setView(this->getViewport_s());
357  SliceAutoViewportCalculator::ReturnType result = mViewFollower->calculate();
358 
359 // CX_LOG_CHANNEL_DEBUG("CA") << "roi=" << roiUid;
360 // CX_LOG_CHANNEL_DEBUG("CA") << this << " autozoom zoom=" << result.zoom << ", center=" << result.center_shift_s;
361  this->changeZoom(result.zoom);
362  Vector3D newcenter_r = mViewFollower->findCenter_r_fromShift_s(result.center_shift_s);
363  mServices->patient()->setCenter(newcenter_r);
364 }
365 
368 DoubleBoundingBox3D ViewWrapper2D::getViewport() const
369 {
370  QSize size = mView->size();
371  Vector3D p0_d(0, 0, 0);
372  Vector3D p1_d(size.width(), size.height(), 0);
373  DoubleBoundingBox3D BB_vp(p0_d, p1_d);
374  return BB_vp;
375 }
376 
377 void ViewWrapper2D::showSlot()
378 {
379  activeToolChangedSlot();
380  viewportChanged();
381 }
382 
383 void ViewWrapper2D::initializePlane(PLANE_TYPE plane)
384 {
385  double viewHeight = mView->getViewport_s().range()[1];
386  mSliceProxy->initializeFromPlane(plane, false, true, viewHeight, 0.25);
387  mOrientationAnnotationRep->setSliceProxy(mSliceProxy);
388 }
389 
392 ORIENTATION_TYPE ViewWrapper2D::getOrientationType() const
393 {
394  return mSliceProxy->getComputer().getOrientationType();
395 }
396 
398 {
399  return mView;
400 }
401 
404 void ViewWrapper2D::imageAdded(ImagePtr image)
405 {
406  this->updateView();
407 
408  // removed this side effect: unwanted when loading a patient, might also be unwanted to change scene when adding/removing via gui?
409  //Navigation().centerToView(mViewGroup->getImages());
410 }
411 
413 {
414  if (!mGroupData)
415  return ImagePtr();
416 
417  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), this->isAnyplane());
418  ImagePtr image;
419  if (!images.empty())
420  image = images.back(); // always show last in vector
421 
422  return image;
423 }
424 
425 bool ViewWrapper2D::useGPU2DRendering()
426 {
427  return settings()->value("View2D/useGPU2DRendering").toBool();
428 }
429 
430 void ViewWrapper2D::createAndAddSliceRep()
431 {
432  if (!mSliceRep)
433  {
434  mSliceRep = SliceRepSW::New("SliceRep_" + mView->getName());
435  mSliceRep->setSliceProxy(mSliceProxy);
436  mView->addRep(mSliceRep);
437  }
438 }
439 
441 {
442  QString text;
443  if (this->useGPU2DRendering())
444  {
445  text = this->getAllDataNames(DataViewProperties::createSlice2D()).join("\n");
446  }
447  else //software rendering
448  {
449  ImagePtr image = this->getImageToDisplay();
450  if (!image)
451  return "";
452  // list all meshes and one image.
453  QStringList textList;
454  std::vector<MeshPtr> mesh = mGroupData->getMeshes(DataViewProperties::createSlice2D());
455  for (unsigned i = 0; i < mesh.size(); ++i)
456  textList << qstring_cast(mesh[i]->getName());
457  if (image)
458  textList << image->getName();
459  text = textList.join("\n");
460  }
461  return text;
462 }
463 
465 {
466  return qstring_cast(mSliceProxy->getComputer().getPlaneType());
467 }
468 
469 void ViewWrapper2D::updateItemsFromViewGroup()
470 {
471  if (!mGroupData)
472  return;
473 
474  ImagePtr image = this->getImageToDisplay();
475 
476  if (image)
477  {
478  Vector3D c = image->get_rMd().coord(image->boundingBox().center());
479  mSliceProxy->setDefaultCenter(c);
480 
481  if (this->useGPU2DRendering())
482  {
483  this->recreateMultiSlicer();
484  }
485  else //software rendering
486  {
487  this->removeAndResetMultiSliceRep();
488  this->createAndAddSliceRep();
489 
490  mSliceRep->setImage(image);
491  }
492  }
493  else //no images to display in the view
494  {
495  this->removeAndResetSliceRep();
496  this->removeAndResetMultiSliceRep();
497  }
498 }
499 
501 {
502  if (!this->getView())
503  return;
504  this->updateItemsFromViewGroup();
505 
506  this->ViewWrapper::updateView();
507 
508  //UPDATE ORIENTATION ANNOTATION
509  mOrientationAnnotationRep->setVisible(settings()->value("View/showOrientationAnnotation").value<bool>());
510 
511  //UPDATE DATA METRIC ANNOTATION
512  mDataRepContainer->updateSettings();
513 
514  if (mToolRep2D)
515  {
516  bool isOblique = mSliceProxy->getComputer().getOrientationType() == otOBLIQUE;
517  bool useCrosshair = settings()->value("View2D/showToolCrosshair", true).toBool();
518  mToolRep2D->setUseCrosshair(!isOblique && useCrosshair);
519  mToolRep2D->setCrosshairColor(settings()->value("View2D/toolCrossHairColor").value<QColor>());
520  mToolRep2D->setTooltipLineColor(settings()->value("View2D/toolColor").value<QColor>());
521  mToolRep2D->setTooltipPointColor(settings()->value("View/toolTipPointColor").value<QColor>());
522  mToolRep2D->setToolOffsetPointColor(settings()->value("View/toolOffsetPointColor").value<QColor>());
523  mToolRep2D->setToolOffsetLineColor(settings()->value("View/toolOffsetLineColor").value<QColor>());
524  }
525 
526  this->applyViewFollower();
527 }
528 
529 DoubleBoundingBox3D ViewWrapper2D::getViewport_s() const
530 {
531  DoubleBoundingBox3D BB_vp = getViewport();
532  Transform3D vpMs = mView->get_vpMs();
533  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
534  return BB_s;
535 }
536 
538 {
539  DataPtr data = mServices->patient()->getData(uid);
540  DataViewProperties properties = mGroupData->getProperties(uid);
541 
542  if (properties.hasSlice2D())
543  this->dataAdded(data);
544  else
545  this->dataRemoved(uid);
546 }
547 
548 void ViewWrapper2D::dataAdded(DataPtr data)
549 {
550  if (boost::dynamic_pointer_cast<Image>(data))
551  {
552  this->imageAdded(boost::dynamic_pointer_cast<Image>(data));
553  }
554  else
555  {
556  mDataRepContainer->addData(data);
557  }
558  this->updateView();
559 }
560 
561 void ViewWrapper2D::dataRemoved(const QString& uid)
562 {
563  mDataRepContainer->removeData(uid);
564  this->updateView();
565 }
566 
567 void ViewWrapper2D::activeToolChangedSlot()
568 {
569  ToolPtr activeTool = mServices->tracking()->getActiveTool();
570  mSliceProxy->setTool(activeTool);
571 }
572 
577 void ViewWrapper2D::mousePressSlot(int x, int y, Qt::MouseButtons buttons)
578 {
579  if (buttons & Qt::LeftButton)
580  {
581  Vector3D clickPos_vp = qvp2vp(QPoint(x,y));
582  moveManualTool(clickPos_vp, Vector3D(0,0,0));
583  samplePoint(clickPos_vp);
584  }
585 }
586 
591 void ViewWrapper2D::mouseMoveSlot(int x, int y, Qt::MouseButtons buttons)
592 {
593  if (buttons & Qt::LeftButton)
594  {
595  Vector3D clickPos_vp = qvp2vp(QPoint(x,y));
596  moveManualTool(clickPos_vp, clickPos_vp - mLastClickPos_vp);
597  }
598 }
599 
600 void ViewWrapper2D::moveManualTool(Vector3D vp, Vector3D delta_vp)
601 {
602  if (this->getOrientationType() == otORTHOGONAL)
603  setAxisPos(vp);
604  else
605  {
606  this->shiftAxisPos(delta_vp); // signal the maual tool that something is happening (important for playback tool)
607  mLastClickPos_vp = vp;
608  }
609 }
610 
614 void ViewWrapper2D::mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
615 {
616  // scale zoom in log space
617  double val = log10(mZoom2D->getFactor());
618  val += delta / 120.0 / 20.0; // 120 is normal scroll resolution, x is zoom resolution
619  double newZoom = pow(10.0, val);
620 
621  mZoom2D->setFactor(newZoom);
622 
623  Navigation(mServices).centerToTooltip(); // side effect: center on tool
624 }
625 
629 Vector3D ViewWrapper2D::qvp2vp(QPoint pos_qvp)
630 {
631  QSize size = mView->size();
632  Vector3D pos_vp(pos_qvp.x(), size.height()-1 - pos_qvp.y(), 0.0); // convert from left-handed qt space to vtk space display/viewport
633  return pos_vp;
634 }
635 
639 void ViewWrapper2D::shiftAxisPos(Vector3D delta_vp)
640 {
641  delta_vp = -delta_vp;
642  ToolPtr tool = mServices->tracking()->getManualTool();
643 
644  Transform3D sMr = mSliceProxy->get_sMr();
645  Transform3D rMpr = mServices->patient()->get_rMpr();
646  Transform3D prMt = tool->get_prMt();
647  Transform3D vpMs = mView->get_vpMs();
648  Vector3D delta_s = vpMs.inv().vector(delta_vp);
649 
650  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
651 
652  // MD is the actual tool movement in patient space, matrix form
653  Transform3D MD = createTransformTranslate(delta_pr);
654  // set new tool position to old modified by MD:
655  tool->set_prMt(MD * prMt);
656 }
657 
661 void ViewWrapper2D::setAxisPos(Vector3D click_vp)
662 {
663  ToolPtr tool = mServices->tracking()->getManualTool();
664 
665  Transform3D sMr = mSliceProxy->get_sMr();
666  Transform3D rMpr = mServices->patient()->get_rMpr();
667  Transform3D prMt = tool->get_prMt();
668 
669  // find tool position in s
670  Vector3D tool_t(0, 0, tool->getTooltipOffset());
671  Vector3D tool_s = (sMr * rMpr * prMt).coord(tool_t);
672 
673  // find click position in s.
674  Transform3D vpMs = mView->get_vpMs();
675  Vector3D click_s = vpMs.inv().coord(click_vp);
676 
677  // compute the new tool position in slice space as a synthesis of the plane part of click and the z part of original.
678  Vector3D cross_s(click_s[0], click_s[1], tool_s[2]);
679  // compute the position change and transform to patient.
680  Vector3D delta_s = cross_s - tool_s;
681  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
682 
683  // MD is the actual tool movement in patient space, matrix form
684  Transform3D MD = createTransformTranslate(delta_pr);
685  // set new tool position to old modified by MD:
686  tool->set_prMt(MD * prMt);
687 }
688 
690 {
691  mSlicePlanes3DMarker = SlicePlanes3DMarkerIn2DRep::New("uid");
692  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
693  mSlicePlanes3DMarker->setProxy(plane, proxy);
694 
695 // DoubleBoundingBox3D BB_vp = getViewport();
696 // Transform3D vpMs = mView->get_vpMs();
697 // mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, transform(vpMs.inv(), BB_vp));
698  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, this->getViewport_s());
699 
700  mView->addRep(mSlicePlanes3DMarker);
701 }
702 
704 {
705  this->updateView();
706 }
707 
708 void ViewWrapper2D::showManualToolSlot(bool visible)
709 {
710  settings()->setValue("View2D/showManualTool", visible);
711 }
712 
713 //------------------------------------------------------------------------------
714 }
QString qstring_cast(const T &val)
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
static SliceProxyPtr create(PatientModelServicePtr dataManager)
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
virtual void videoSourcesChangedSlot()
virtual QString getViewDescription()
otOBLIQUE
orient planes relative to the tool space
Definition: cxDefinitions.h:32
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual ViewPtr getView()
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
Superclass for ViewWrappers.
Definition: cxViewWrapper.h:89
SharedOpenGLContextPtr mSharedOpenGLContext
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: cxSettings.cpp:66
boost::shared_ptr< class View > ViewPtr
virtual QString getDataDescription()
virtual void setViewGroup(ViewGroupDataPtr group)
static DataViewProperties createSlice2D()
static SlicePlanes3DMarkerIn2DRepPtr New(const QString &uid="")
static OrientationAnnotationSmartRepPtr New(const QString &uid="")
void setValue(const QString &key, const QVariant &value)
Definition: cxSettings.cpp:58
virtual void setViewGroup(ViewGroupDataPtr group)
boost::shared_ptr< class Data > DataPtr
virtual void updateView()
static QString findConfigFolder(QString pathRelativeToConfigRoot, QString alternativeAbsolutePath="")
void settingsChangedSlot(QString key)
void centerToTooltip()
otORTHOGONAL
orient planes relative to the image/reference space.
Definition: cxDefinitions.h:32
ViewGroupDataPtr mGroupData
static Texture3DSlicerRepPtr New(SharedOpenGLContextPtr context, const QString &uid="")
static SliceRepSWPtr New(const QString &uid="")
Transform3D createTransformTranslate(const Vector3D &translation)
virtual void dataViewPropertiesChangedSlot(QString uid)
virtual void initializePlane(PLANE_TYPE plane)
virtual void settingsChangedSlot(QString key)
Settings * settings()
Shortcut for accessing the settings instance.
Definition: cxSettings.cpp:21
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
virtual void setSlicePlanesProxy(SlicePlanesProxyPtr proxy)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
static GeometricRep2DPtr New(const QString &uid="")
virtual void addReps()
VisServicesPtr mServices
void samplePoint(Vector3D click_vp)
QStringList getAllDataNames(DataViewProperties properties) const
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
#define CX_LOG_WARNING
Definition: cxLogger.h:98
RealScalar length() const
virtual void updateView()
static ToolRep2DPtr New(SpaceProviderPtr spaceProvider, const QString &uid="")
Definition: cxToolRep2D.cpp:66
ImagePtr getImageToDisplay()
ptANYPLANE
a plane aligned with the tool base plane
Definition: cxDefinitions.h:38
void connectContextMenu(ViewPtr view)
static ViewFollowerPtr create(PatientModelServicePtr dataManager)
ViewWrapper2D(ViewPtr view, VisServicesPtr backend)
void pointSampled(Vector3D p_r)
bool hasSlice2D() const
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr