CustusX  2023.01.05-dev+develop.0da12
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  for(int i = 0; i < mSliceReps.size(); ++i)
238  {
239  mView->removeRep(mSliceReps[i]);
240  mSliceReps[i].reset();
241  }
242  mSliceReps.clear();
243 }
244 
245 void ViewWrapper2D::removeAndResetMultiSliceRep()
246 {
247  if (mMultiSliceRep)
248  {
249  mView->removeRep(mMultiSliceRep);
250  mMultiSliceRep.reset();
251  }
252 }
253 
254 bool ViewWrapper2D::createAndAddMultiSliceRep()
255 {
257  {
258  CX_LOG_WARNING() << "ViewWrapper2D::createAndAddMultiSliceRep(): Got no mSharedOpenGLContext";
259  return false;
260  }
261  if (mMultiSliceRep)
262  return true;
263 
265  mMultiSliceRep->setShaderPath(DataLocations::findConfigFolder("/shaders"));
266  mMultiSliceRep->setSliceProxy(mSliceProxy);
267  mMultiSliceRep->setRenderWindow(mView->getRenderWindow());
268 
269  mView->addRep(mMultiSliceRep);
270 
271  return true;
272 }
273 
279 void ViewWrapper2D::recreateMultiSlicer()
280 {
281  this->removeAndResetSliceRep();
282 
283  if (!this->useGPU2DRendering())
284  {
285  this->removeAndResetMultiSliceRep();
286  return;
287  }
288 
289  if(!this->createAndAddMultiSliceRep())
290  {
291  return;
292  }
293 
294  if (mGroupData)
295  mMultiSliceRep->setImages(this->getImagesToView());
296  else
297  mMultiSliceRep->setImages(std::vector<ImagePtr>());
298 
299  this->viewportChanged();
300 }
301 
302 std::vector<ImagePtr> ViewWrapper2D::getImagesToView()
303 {
304  bool include2D = this->isAnyplane();
305  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), include2D);
306  return images;
307 }
308 
309 bool ViewWrapper2D::isAnyplane()
310 {
311  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
312  return plane == ptANYPLANE;
313 }
314 
318 void ViewWrapper2D::viewportChanged()
319 {
320  if (!mView->getRenderer()->IsActiveCameraCreated())
321  return;
322 
323  mView->setZoomFactor(mZoom2D->getFactor());
324 
325  double viewHeight = mView->getViewport_s().range()[1];
326  mView->getRenderer()->GetActiveCamera()->SetParallelScale(viewHeight / 2);
327 
328  // Heuristic guess for a good clip depth. The point is to show 3D data clipped in 2D
329  // with a suitable thickness projected onto the plane.
330  double clipDepth = 2.0; // i.e. all 3D props rendered outside this range is not shown.
331  double length = clipDepth*10;
332  clipDepth = viewHeight/120 + 1.5;
333  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
334  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
335 
336  mSliceProxy->setToolViewportHeight(viewHeight);
337  double anyplaneViewOffset = settings()->value("Navigation/anyplaneViewOffset").toDouble();
338  mSliceProxy->initializeFromPlane(mSliceProxy->getComputer().getPlaneType(), false, true, viewHeight, anyplaneViewOffset);
339 
340  DoubleBoundingBox3D BB_vp = getViewport();
341  Transform3D vpMs = mView->get_vpMs();
342  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
343  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
344 
345  mToolRep2D->setViewportData(vpMs, BB_vp);
346  if (mSlicePlanes3DMarker)
347  {
348  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, BB_s);
349  }
350 }
351 
352 void ViewWrapper2D::applyViewFollower()
353 {
354  if (!mGroupData)
355  return;
356  QString roiUid = mGroupData->getOptions().mCameraStyle.mAutoZoomROI;
357  mViewFollower->setAutoZoomROI(roiUid);
358  mViewFollower->setView(this->getViewport_s());
359  SliceAutoViewportCalculator::ReturnType result = mViewFollower->calculate();
360 
361 // CX_LOG_CHANNEL_DEBUG("CA") << "roi=" << roiUid;
362 // CX_LOG_CHANNEL_DEBUG("CA") << this << " autozoom zoom=" << result.zoom << ", center=" << result.center_shift_s;
363  this->changeZoom(result.zoom);
364  Vector3D newcenter_r = mViewFollower->findCenter_r_fromShift_s(result.center_shift_s);
365  mServices->patient()->setCenter(newcenter_r);
366 }
367 
370 DoubleBoundingBox3D ViewWrapper2D::getViewport() const
371 {
372  QSize size = mView->size();
373  Vector3D p0_d(0, 0, 0);
374  Vector3D p1_d(size.width(), size.height(), 0);
375  DoubleBoundingBox3D BB_vp(p0_d, p1_d);
376  return BB_vp;
377 }
378 
379 void ViewWrapper2D::showSlot()
380 {
381  activeToolChangedSlot();
382  viewportChanged();
383 }
384 
385 void ViewWrapper2D::initializePlane(PLANE_TYPE plane)
386 {
387  double viewHeight = mView->getViewport_s().range()[1];
388  mSliceProxy->initializeFromPlane(plane, false, true, viewHeight, 0.25);
389  mOrientationAnnotationRep->setSliceProxy(mSliceProxy);
390 }
391 
394 ORIENTATION_TYPE ViewWrapper2D::getOrientationType() const
395 {
396  return mSliceProxy->getComputer().getOrientationType();
397 }
398 
400 {
401  return mView;
402 }
403 
406 void ViewWrapper2D::imageAdded(ImagePtr image)
407 {
408  this->updateView();
409 
410  // removed this side effect: unwanted when loading a patient, might also be unwanted to change scene when adding/removing via gui?
411  //Navigation().centerToView(mViewGroup->getImages());
412 }
413 
415 {
416  if (!mGroupData)
417  return ImagePtr();
418 
419  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), this->isAnyplane());
420  ImagePtr image;
421  if (!images.empty())
422  image = images.back(); // always show last in vector
423 
424  return image;
425 }
426 
427 bool ViewWrapper2D::useGPU2DRendering()
428 {
429  return settings()->value("View2D/useGPU2DRendering").toBool();
430 }
431 
432 void ViewWrapper2D::createAndAddSliceReps(int numberOfSlices)
433 {
434  this->removeAndResetSliceRep();
435  for(int i = 0; i < numberOfSlices; ++i)
436  {
437  SliceRepSWPtr sliceRep = SliceRepSW::New("SliceRep_" + mView->getName() + "_" + i);
438  sliceRep->setSliceProxy(mSliceProxy);
439  mView->addRep(sliceRep);
440  mSliceReps.push_back(sliceRep);
441  }
442 }
443 
445 {
446  QString text;
447  text = this->getAllDataNames(DataViewProperties::createSlice2D()).join("\n");
448  return text;
449 }
450 
452 {
453  return qstring_cast(mSliceProxy->getComputer().getPlaneType());
454 }
455 
456 void ViewWrapper2D::updateItemsFromViewGroup()
457 {
458  if (!mGroupData)
459  return;
460 
461  ImagePtr image = this->getImageToDisplay();
462 
463  if (image)
464  {
465  Vector3D c = image->get_rMd().coord(image->boundingBox().center());
466  mSliceProxy->setDefaultCenter(c);
467 
468  if (this->useGPU2DRendering())
469  {
470  this->recreateMultiSlicer();
471  }
472  else //software rendering
473  {
474  this->removeAndResetMultiSliceRep();
475  setImagesSWRendering();
476  }
477  }
478  else //no images to display in the view
479  {
480  this->removeAndResetSliceRep();
481  this->removeAndResetMultiSliceRep();
482  }
483 }
484 
485 void ViewWrapper2D::setImagesSWRendering()
486 {
487  std::vector<ImagePtr> images = this->getImagesToView();
488  this->createAndAddSliceReps(images.size());
489 
490  if(mSliceReps.size() < images.size())
491  {
492  CX_LOG_ERROR() << "ViewWrapper2D::setImagesSW: mSliceReps.size() < images.size()";
493  return;
494  }
495  for(int i = 0; i < images.size(); ++i)
496  {
497  mSliceReps[i]->setImage(images[i]);
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="")
boost::shared_ptr< class SliceRepSW > SliceRepSWPtr
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()
#define CX_LOG_ERROR
Definition: cxLogger.h:99
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