CustusX  22.04-rc5
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  showManualTool->setToolTip("Turn on/off visualization of the vire cross in 2D");
159  connect(showManualTool, SIGNAL(triggered(bool)), this, SLOT(showManualToolSlot(bool)));
160  contextMenu.addAction(showManualTool);
161 }
162 
164 {
166 
167  mZoom2D->setGroupData(group);
168  connect(group.get(), SIGNAL(optionsChanged()), this, SLOT(optionChangedSlot()));
169  this->optionChangedSlot();
170 }
171 
172 void ViewWrapper2D::optionChangedSlot()
173 {
174  ViewGroupData::Options options = mGroupData->getOptions();
175 
176  if (mPickerGlyphRep)
177  {
178  mPickerGlyphRep->setMesh(options.mPickerGlyph);
179  }
180 }
181 
182 void ViewWrapper2D::addReps()
183 {
184  // annotation rep
185  mOrientationAnnotationRep = OrientationAnnotationSmartRep::New();
186  mView->addRep(mOrientationAnnotationRep);
187 
188  this->ViewWrapper::addReps();
189 
190  // tool rep
191  mToolRep2D = ToolRep2D::New(mServices->spaceProvider(), "Tool2D_" + mView->getName());
192  mToolRep2D->setSliceProxy(mSliceProxy);
193  mToolRep2D->setUseCrosshair(true);
194  this->toggleShowManualTool();
195 
196  mPickerGlyphRep = GeometricRep2D::New("PickerGlyphRep_" + mView->getName());
197  mPickerGlyphRep->setSliceProxy(mSliceProxy);
198  if (mGroupData)
199  {
200  mPickerGlyphRep->setMesh(mGroupData->getOptions().mPickerGlyph);
201  }
202  mView->addRep(mPickerGlyphRep);
203 }
204 
206 {
208 
209  if (key == "View2D/useGPU2DRendering")
210  {
211  this->updateView();
212  }
213  if (key == "View2D/useLinearInterpolationIn2DRendering")
214  {
215  this->updateView();
216  }
217  if (key == "Navigation/anyplaneViewOffset")
218  {
219  this->updateView();
220  }
221  if (key == "View2D/showManualTool")
222  {
223  this->toggleShowManualTool();
224  }
225 }
226 
227 void ViewWrapper2D::toggleShowManualTool()
228 {
229  if (settings()->value("View2D/showManualTool").toBool())
230  mView->addRep(mToolRep2D);
231  else
232  mView->removeRep(mToolRep2D);
233 }
234 
235 void ViewWrapper2D::removeAndResetSliceRep()
236 {
237  if (mSliceRep)
238  {
239  mView->removeRep(mSliceRep);
240  mSliceRep.reset();
241  }
242 }
243 
244 void ViewWrapper2D::removeAndResetMultiSliceRep()
245 {
246  if (mMultiSliceRep)
247  {
248  mView->removeRep(mMultiSliceRep);
249  mMultiSliceRep.reset();
250  }
251 }
252 
253 bool ViewWrapper2D::createAndAddMultiSliceRep()
254 {
256  {
257  CX_LOG_WARNING() << "ViewWrapper2D::createAndAddMultiSliceRep(): Got no mSharedOpenGLContext";
258  return false;
259  }
260  if (mMultiSliceRep)
261  return true;
262 
264  mMultiSliceRep->setShaderPath(DataLocations::findConfigFolder("/shaders"));
265  mMultiSliceRep->setSliceProxy(mSliceProxy);
266  mMultiSliceRep->setRenderWindow(mView->getRenderWindow());
267 
268  mView->addRep(mMultiSliceRep);
269 
270  return true;
271 }
272 
278 void ViewWrapper2D::recreateMultiSlicer()
279 {
280  this->removeAndResetSliceRep();
281 
282  if (!this->useGPU2DRendering())
283  {
284  this->removeAndResetMultiSliceRep();
285  return;
286  }
287 
288  if(!this->createAndAddMultiSliceRep())
289  {
290  return;
291  }
292 
293  if (mGroupData)
294  mMultiSliceRep->setImages(this->getImagesToView());
295  else
296  mMultiSliceRep->setImages(std::vector<ImagePtr>());
297 
298  this->viewportChanged();
299 }
300 
301 std::vector<ImagePtr> ViewWrapper2D::getImagesToView()
302 {
303  bool include2D = this->isAnyplane();
304  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), include2D);
305  return images;
306 }
307 
308 bool ViewWrapper2D::isAnyplane()
309 {
310  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
311  return plane == ptANYPLANE;
312 }
313 
317 void ViewWrapper2D::viewportChanged()
318 {
319  if (!mView->getRenderer()->IsActiveCameraCreated())
320  return;
321 
322  mView->setZoomFactor(mZoom2D->getFactor());
323 
324  double viewHeight = mView->getViewport_s().range()[1];
325  mView->getRenderer()->GetActiveCamera()->SetParallelScale(viewHeight / 2);
326 
327  // Heuristic guess for a good clip depth. The point is to show 3D data clipped in 2D
328  // with a suitable thickness projected onto the plane.
329  double clipDepth = 2.0; // i.e. all 3D props rendered outside this range is not shown.
330  double length = clipDepth*10;
331  clipDepth = viewHeight/120 + 1.5;
332  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
333  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
334 
335  mSliceProxy->setToolViewportHeight(viewHeight);
336  double anyplaneViewOffset = settings()->value("Navigation/anyplaneViewOffset").toDouble();
337  mSliceProxy->initializeFromPlane(mSliceProxy->getComputer().getPlaneType(), false, true, viewHeight, anyplaneViewOffset);
338 
339  DoubleBoundingBox3D BB_vp = getViewport();
340  Transform3D vpMs = mView->get_vpMs();
341  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
342  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
343 
344  mToolRep2D->setViewportData(vpMs, BB_vp);
345  if (mSlicePlanes3DMarker)
346  {
347  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, BB_s);
348  }
349 }
350 
351 void ViewWrapper2D::applyViewFollower()
352 {
353  if (!mGroupData)
354  return;
355  QString roiUid = mGroupData->getOptions().mCameraStyle.mAutoZoomROI;
356  mViewFollower->setAutoZoomROI(roiUid);
357  mViewFollower->setView(this->getViewport_s());
358  SliceAutoViewportCalculator::ReturnType result = mViewFollower->calculate();
359 
360 // CX_LOG_CHANNEL_DEBUG("CA") << "roi=" << roiUid;
361 // CX_LOG_CHANNEL_DEBUG("CA") << this << " autozoom zoom=" << result.zoom << ", center=" << result.center_shift_s;
362  this->changeZoom(result.zoom);
363  Vector3D newcenter_r = mViewFollower->findCenter_r_fromShift_s(result.center_shift_s);
364  mServices->patient()->setCenter(newcenter_r);
365 }
366 
369 DoubleBoundingBox3D ViewWrapper2D::getViewport() const
370 {
371  QSize size = mView->size();
372  Vector3D p0_d(0, 0, 0);
373  Vector3D p1_d(size.width(), size.height(), 0);
374  DoubleBoundingBox3D BB_vp(p0_d, p1_d);
375  return BB_vp;
376 }
377 
378 void ViewWrapper2D::showSlot()
379 {
380  activeToolChangedSlot();
381  viewportChanged();
382 }
383 
384 void ViewWrapper2D::initializePlane(PLANE_TYPE plane)
385 {
386  double viewHeight = mView->getViewport_s().range()[1];
387  mSliceProxy->initializeFromPlane(plane, false, true, viewHeight, 0.25);
388  mOrientationAnnotationRep->setSliceProxy(mSliceProxy);
389 }
390 
393 ORIENTATION_TYPE ViewWrapper2D::getOrientationType() const
394 {
395  return mSliceProxy->getComputer().getOrientationType();
396 }
397 
399 {
400  return mView;
401 }
402 
405 void ViewWrapper2D::imageAdded(ImagePtr image)
406 {
407  this->updateView();
408 
409  // removed this side effect: unwanted when loading a patient, might also be unwanted to change scene when adding/removing via gui?
410  //Navigation().centerToView(mViewGroup->getImages());
411 }
412 
414 {
415  if (!mGroupData)
416  return ImagePtr();
417 
418  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), this->isAnyplane());
419  ImagePtr image;
420  if (!images.empty())
421  image = images.back(); // always show last in vector
422 
423  return image;
424 }
425 
426 bool ViewWrapper2D::useGPU2DRendering()
427 {
428  return settings()->value("View2D/useGPU2DRendering").toBool();
429 }
430 
431 void ViewWrapper2D::createAndAddSliceRep()
432 {
433  if (!mSliceRep)
434  {
435  mSliceRep = SliceRepSW::New("SliceRep_" + mView->getName());
436  mSliceRep->setSliceProxy(mSliceProxy);
437  mView->addRep(mSliceRep);
438  }
439 }
440 
442 {
443  QString text;
444  if (this->useGPU2DRendering())
445  {
446  text = this->getAllDataNames(DataViewProperties::createSlice2D()).join("\n");
447  }
448  else //software rendering
449  {
450  ImagePtr image = this->getImageToDisplay();
451  if (!image)
452  return "";
453  // list all meshes and one image.
454  QStringList textList;
455  std::vector<MeshPtr> mesh = mGroupData->getMeshes(DataViewProperties::createSlice2D());
456  for (unsigned i = 0; i < mesh.size(); ++i)
457  textList << qstring_cast(mesh[i]->getName());
458  if (image)
459  textList << image->getName();
460  text = textList.join("\n");
461  }
462  return text;
463 }
464 
466 {
467  return qstring_cast(mSliceProxy->getComputer().getPlaneType());
468 }
469 
470 void ViewWrapper2D::updateItemsFromViewGroup()
471 {
472  if (!mGroupData)
473  return;
474 
475  ImagePtr image = this->getImageToDisplay();
476 
477  if (image)
478  {
479  Vector3D c = image->get_rMd().coord(image->boundingBox().center());
480  mSliceProxy->setDefaultCenter(c);
481 
482  if (this->useGPU2DRendering())
483  {
484  this->recreateMultiSlicer();
485  }
486  else //software rendering
487  {
488  this->removeAndResetMultiSliceRep();
489  this->createAndAddSliceRep();
490 
491  mSliceRep->setImage(image);
492  }
493  }
494  else //no images to display in the view
495  {
496  this->removeAndResetSliceRep();
497  this->removeAndResetMultiSliceRep();
498  }
499 }
500 
502 {
503  if (!this->getView())
504  return;
505  this->updateItemsFromViewGroup();
506 
507  this->ViewWrapper::updateView();
508 
509  //UPDATE ORIENTATION ANNOTATION
510  mOrientationAnnotationRep->setVisible(settings()->value("View/showOrientationAnnotation").value<bool>());
511 
512  //UPDATE DATA METRIC ANNOTATION
513  mDataRepContainer->updateSettings();
514 
515  if (mToolRep2D)
516  {
517  bool isOblique = mSliceProxy->getComputer().getOrientationType() == otOBLIQUE;
518  bool useCrosshair = settings()->value("View2D/showToolCrosshair", true).toBool();
519  mToolRep2D->setUseCrosshair(!isOblique && useCrosshair);
520  mToolRep2D->setCrosshairColor(settings()->value("View2D/toolCrossHairColor").value<QColor>());
521  mToolRep2D->setTooltipLineColor(settings()->value("View2D/toolColor").value<QColor>());
522  mToolRep2D->setTooltipPointColor(settings()->value("View/toolTipPointColor").value<QColor>());
523  mToolRep2D->setToolOffsetPointColor(settings()->value("View/toolOffsetPointColor").value<QColor>());
524  mToolRep2D->setToolOffsetLineColor(settings()->value("View/toolOffsetLineColor").value<QColor>());
525  }
526 
527  this->applyViewFollower();
528 }
529 
530 DoubleBoundingBox3D ViewWrapper2D::getViewport_s() const
531 {
532  DoubleBoundingBox3D BB_vp = getViewport();
533  Transform3D vpMs = mView->get_vpMs();
534  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
535  return BB_s;
536 }
537 
539 {
540  DataPtr data = mServices->patient()->getData(uid);
541  DataViewProperties properties = mGroupData->getProperties(uid);
542 
543  if (properties.hasSlice2D())
544  this->dataAdded(data);
545  else
546  this->dataRemoved(uid);
547 }
548 
549 void ViewWrapper2D::dataAdded(DataPtr data)
550 {
551  if (boost::dynamic_pointer_cast<Image>(data))
552  {
553  this->imageAdded(boost::dynamic_pointer_cast<Image>(data));
554  }
555  else
556  {
557  mDataRepContainer->addData(data);
558  }
559  this->updateView();
560 }
561 
562 void ViewWrapper2D::dataRemoved(const QString& uid)
563 {
564  mDataRepContainer->removeData(uid);
565  this->updateView();
566 }
567 
568 void ViewWrapper2D::activeToolChangedSlot()
569 {
570  ToolPtr controllingTool = this->getControllingTool();
571  //CX_LOG_DEBUG() << "ViewWrapper2D::activeToolChangedSlot - controllingTool: " << controllingTool->getName();
572  mSliceProxy->setTool(controllingTool);
573 }
574 
579 void ViewWrapper2D::mousePressSlot(int x, int y, Qt::MouseButtons buttons)
580 {
581  if (buttons & Qt::LeftButton)
582  {
583  Vector3D clickPos_vp = qvp2vp(QPoint(x,y));
584  moveManualTool(clickPos_vp, Vector3D(0,0,0));
585  samplePoint(clickPos_vp);
586  }
587 }
588 
593 void ViewWrapper2D::mouseMoveSlot(int x, int y, Qt::MouseButtons buttons)
594 {
595  if (buttons & Qt::LeftButton)
596  {
597  Vector3D clickPos_vp = qvp2vp(QPoint(x,y));
598  moveManualTool(clickPos_vp, clickPos_vp - mLastClickPos_vp);
599  }
600 }
601 
602 void ViewWrapper2D::moveManualTool(Vector3D vp, Vector3D delta_vp)
603 {
604  if (this->getOrientationType() == otORTHOGONAL)
605  setAxisPos(vp);
606  else
607  {
608  this->shiftAxisPos(delta_vp); // signal the maual tool that something is happening (important for playback tool)
609  mLastClickPos_vp = vp;
610  }
611 }
612 
616 void ViewWrapper2D::mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
617 {
618  // scale zoom in log space
619  double val = log10(mZoom2D->getFactor());
620  val += delta / 120.0 / 20.0; // 120 is normal scroll resolution, x is zoom resolution
621  double newZoom = pow(10.0, val);
622 
623  mZoom2D->setFactor(newZoom);
624 
625  Navigation(mServices).centerToTooltip(); // side effect: center on tool
626 }
627 
631 Vector3D ViewWrapper2D::qvp2vp(QPoint pos_qvp)
632 {
633  QSize size = mView->size();
634  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
635  return pos_vp;
636 }
637 
641 void ViewWrapper2D::shiftAxisPos(Vector3D delta_vp)
642 {
643  delta_vp = -delta_vp;
644  ToolPtr tool = mServices->tracking()->getManualTool();
645 
646  Transform3D sMr = mSliceProxy->get_sMr();
647  Transform3D rMpr = mServices->patient()->get_rMpr();
648  Transform3D prMt = tool->get_prMt();
649  Transform3D vpMs = mView->get_vpMs();
650  Vector3D delta_s = vpMs.inv().vector(delta_vp);
651 
652  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
653 
654  // MD is the actual tool movement in patient space, matrix form
655  Transform3D MD = createTransformTranslate(delta_pr);
656  // set new tool position to old modified by MD:
657  tool->set_prMt(MD * prMt);
658 }
659 
663 void ViewWrapper2D::setAxisPos(Vector3D click_vp)
664 {
665  ToolPtr tool = mServices->tracking()->getManualTool();
666 
667  Transform3D sMr = mSliceProxy->get_sMr();
668  Transform3D rMpr = mServices->patient()->get_rMpr();
669  Transform3D prMt = tool->get_prMt();
670 
671  // find tool position in s
672  Vector3D tool_t(0, 0, tool->getTooltipOffset());
673  Vector3D tool_s = (sMr * rMpr * prMt).coord(tool_t);
674 
675  // find click position in s.
676  Transform3D vpMs = mView->get_vpMs();
677  Vector3D click_s = vpMs.inv().coord(click_vp);
678 
679  // compute the new tool position in slice space as a synthesis of the plane part of click and the z part of original.
680  Vector3D cross_s(click_s[0], click_s[1], tool_s[2]);
681  // compute the position change and transform to patient.
682  Vector3D delta_s = cross_s - tool_s;
683  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
684 
685  // MD is the actual tool movement in patient space, matrix form
686  Transform3D MD = createTransformTranslate(delta_pr);
687  // set new tool position to old modified by MD:
688  tool->set_prMt(MD * prMt);
689 }
690 
692 {
693  mSlicePlanes3DMarker = SlicePlanes3DMarkerIn2DRep::New("uid");
694  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
695  mSlicePlanes3DMarker->setProxy(plane, proxy);
696 
697 // DoubleBoundingBox3D BB_vp = getViewport();
698 // Transform3D vpMs = mView->get_vpMs();
699 // mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, transform(vpMs.inv(), BB_vp));
700  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, this->getViewport_s());
701 
702  mView->addRep(mSlicePlanes3DMarker);
703 }
704 
706 {
707  this->updateView();
708 }
709 
710 void ViewWrapper2D::showManualToolSlot(bool visible)
711 {
712  settings()->setValue("View2D/showManualTool", visible);
713 }
714 
715 //------------------------------------------------------------------------------
716 }
QString qstring_cast(const T &val)
ToolPtr getControllingTool()
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:33
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:33
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:39
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