CustusX  18.04-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 "cxDefinitionStrings.h"
45 #include "cxSlicePlanes3DRep.h"
46 #include "cxDefinitionStrings.h"
47 #include "cxSliceComputer.h"
48 #include "cxGeometricRep2D.h"
49 #include "cxDataLocations.h"
50 #include "cxSettings.h"
51 #include "cxGLHelpers.h"
52 #include "cxData.h"
53 #include "cxMesh.h"
54 #include "cxImage.h"
55 #include "cxTrackedStream.h"
56 #include "cxPointMetricRep2D.h"
57 
58 #include "cxViewFollower.h"
59 #include "cxVisServices.h"
60 #include "cx2DZoomHandler.h"
61 #include "cxNavigation.h"
62 #include "cxDataRepContainer.h"
63 #include "vtkRenderWindowInteractor.h"
64 #include "cxPatientModelService.h"
65 #include "cxLogger.h"
66 #include "cxViewService.h"
68 
69 #include "cxTexture3DSlicerRep.h"
70 
71 namespace cx
72 {
73 
75  ViewWrapper(backend),
76  mOrientationActionGroup(new QActionGroup(view.get()))
77 {
78  qRegisterMetaType<Vector3D>("Vector3D");
79  mView = view;
80  this->connectContextMenu(mView);
81 
82  // disable vtk interactor: this wrapper IS an interactor
83  mView->getRenderWindow()->GetInteractor()->Disable();
84  mView->getRenderer()->GetActiveCamera()->SetParallelProjection(true);
85  double clipDepth = 1.0; // 1mm depth, i.e. all 3D props rendered outside this range is not shown.
86  double length = clipDepth*10;
87  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
88  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
89 
90  // slice proxy
91  mSliceProxy = SliceProxy::create(mServices->patient());
92 
93  mDataRepContainer.reset(new DataRepContainer());
94  mDataRepContainer->setSliceProxy(mSliceProxy);
95  mDataRepContainer->setView(mView);
96 
97  mViewFollower = ViewFollower::create(mServices->patient());
98  mViewFollower->setSliceProxy(mSliceProxy);
99 
100  addReps();
101 
102  mZoom2D.reset(new Zoom2DHandler());
103  connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged()));
104 
105  connect(mServices->tracking().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(activeToolChangedSlot()));
106  connect(mView.get(), SIGNAL(resized(QSize)), this, SLOT(viewportChanged()));
107  connect(mView.get(), SIGNAL(shown()), this, SLOT(showSlot()));
108  connect(mView.get(), SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SLOT(mousePressSlot(int, int, Qt::MouseButtons)));
109  connect(mView.get(), SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SLOT(mouseMoveSlot(int, int, Qt::MouseButtons)));
110  connect(mView.get(), SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SLOT(mouseWheelSlot(int, int, int, int, Qt::MouseButtons)));
111 
113 
114  this->activeToolChangedSlot();
115  this->updateView();
116 }
117 
119 {
120  if (mView)
121  mView->removeReps();
122 }
123 
124 void ViewWrapper2D::changeZoom(double delta)
125 {
126  if (similar(delta, 1.0))
127  return;
128 
129  double zoom = mZoom2D->getFactor();
130 // CX_LOG_CHANNEL_DEBUG("CA") << "changing zoom from " << zoom << " by " << delta;
131  zoom *= delta;
132 // CX_LOG_CHANNEL_DEBUG("CA") << " new zoom:" << zoom;
133  mZoom2D->setFactor(zoom);
134 // CX_LOG_CHANNEL_DEBUG("CA") << " got zoom:" << mZoom2D->getFactor();
135 }
136 
138 {
139  if(!this->isAnyplane())
140  return;
141 
142  Transform3D sMr = mSliceProxy->get_sMr();
143  Transform3D vpMs = mView->get_vpMs();
144 
145  Vector3D p_s = vpMs.inv().coord(click_vp);
146  Vector3D p_r = sMr.inv().coord(p_s);
147 
148  emit pointSampled(p_r);
149 }
150 
151 void ViewWrapper2D::appendToContextMenu(QMenu& contextMenu)
152 {
153  contextMenu.addSeparator();
154  mZoom2D->addActionsToMenu(&contextMenu);
155 
156  contextMenu.addSeparator();
157  QAction* showManualTool = new QAction("Show Manual Tool 2D", &contextMenu);
158  showManualTool->setCheckable(true);
159  showManualTool->setChecked(settings()->value("View2D/showManualTool").toBool());
160  connect(showManualTool, SIGNAL(triggered(bool)), this, SLOT(showManualToolSlot(bool)));
161  contextMenu.addAction(showManualTool);
162 }
163 
165 {
167 
168  mZoom2D->setGroupData(group);
169  connect(group.get(), SIGNAL(optionsChanged()), this, SLOT(optionChangedSlot()));
170  this->optionChangedSlot();
171 }
172 
173 void ViewWrapper2D::optionChangedSlot()
174 {
175  ViewGroupData::Options options = mGroupData->getOptions();
176 
177  if (mPickerGlyphRep)
178  {
179  mPickerGlyphRep->setMesh(options.mPickerGlyph);
180  }
181 }
182 
183 void ViewWrapper2D::addReps()
184 {
185  // annotation rep
186  mOrientationAnnotationRep = OrientationAnnotationSmartRep::New();
187  mView->addRep(mOrientationAnnotationRep);
188 
189  this->ViewWrapper::addReps();
190 
191  // tool rep
192  mToolRep2D = ToolRep2D::New(mServices->spaceProvider(), "Tool2D_" + mView->getName());
193  mToolRep2D->setSliceProxy(mSliceProxy);
194  mToolRep2D->setUseCrosshair(true);
195  this->toggleShowManualTool();
196 
197  mPickerGlyphRep = GeometricRep2D::New("PickerGlyphRep_" + mView->getName());
198  mPickerGlyphRep->setSliceProxy(mSliceProxy);
199  if (mGroupData)
200  {
201  mPickerGlyphRep->setMesh(mGroupData->getOptions().mPickerGlyph);
202  }
203  mView->addRep(mPickerGlyphRep);
204 }
205 
207 {
209 
210  if (key == "View2D/useGPU2DRendering")
211  {
212  this->updateView();
213  }
214  if (key == "View2D/useLinearInterpolationIn2DRendering")
215  {
216  this->updateView();
217  }
218  if (key == "Navigation/anyplaneViewOffset")
219  {
220  this->updateView();
221  }
222  if (key == "View2D/showManualTool")
223  {
224  this->toggleShowManualTool();
225  }
226 }
227 
228 void ViewWrapper2D::toggleShowManualTool()
229 {
230  if (settings()->value("View2D/showManualTool").toBool())
231  mView->addRep(mToolRep2D);
232  else
233  mView->removeRep(mToolRep2D);
234 }
235 
236 void ViewWrapper2D::removeAndResetSliceRep()
237 {
238  if (mSliceRep)
239  {
240  mView->removeRep(mSliceRep);
241  mSliceRep.reset();
242  }
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(), true);
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::createAndAddSliceRep()
433 {
434  if (!mSliceRep)
435  {
436  mSliceRep = SliceRepSW::New("SliceRep_" + mView->getName());
437  mSliceRep->setSliceProxy(mSliceProxy);
438  mView->addRep(mSliceRep);
439  }
440 }
441 
443 {
444  QString text;
445  if (this->useGPU2DRendering())
446  {
447  text = this->getAllDataNames(DataViewProperties::createSlice2D()).join("\n");
448  }
449  else //software rendering
450  {
451  ImagePtr image = this->getImageToDisplay();
452  if (!image)
453  return "";
454  // list all meshes and one image.
455  QStringList textList;
456  std::vector<MeshPtr> mesh = mGroupData->getMeshes(DataViewProperties::createSlice2D());
457  for (unsigned i = 0; i < mesh.size(); ++i)
458  textList << qstring_cast(mesh[i]->getName());
459  if (image)
460  textList << image->getName();
461  text = textList.join("\n");
462  }
463  return text;
464 }
465 
467 {
468  return qstring_cast(mSliceProxy->getComputer().getPlaneType());
469 }
470 
471 void ViewWrapper2D::updateItemsFromViewGroup()
472 {
473  if (!mGroupData)
474  return;
475 
476  ImagePtr image = this->getImageToDisplay();
477 
478  if (image)
479  {
480  Vector3D c = image->get_rMd().coord(image->boundingBox().center());
481  mSliceProxy->setDefaultCenter(c);
482 
483  if (this->useGPU2DRendering())
484  {
485  this->recreateMultiSlicer();
486  }
487  else //software rendering
488  {
489  this->removeAndResetMultiSliceRep();
490  this->createAndAddSliceRep();
491 
492  mSliceRep->setImage(image);
493  }
494  }
495  else //no images to display in the view
496  {
497  this->removeAndResetSliceRep();
498  this->removeAndResetMultiSliceRep();
499  }
500 }
501 
503 {
504  if (!this->getView())
505  return;
506  this->updateItemsFromViewGroup();
507 
508  this->ViewWrapper::updateView();
509 
510  //UPDATE ORIENTATION ANNOTATION
511  mOrientationAnnotationRep->setVisible(settings()->value("View/showOrientationAnnotation").value<bool>());
512 
513  //UPDATE DATA METRIC ANNOTATION
514  mDataRepContainer->updateSettings();
515 
516  if (mToolRep2D)
517  {
518  bool isOblique = mSliceProxy->getComputer().getOrientationType() == otOBLIQUE;
519  bool useCrosshair = settings()->value("View2D/showToolCrosshair", true).toBool();
520  mToolRep2D->setUseCrosshair(!isOblique && useCrosshair);
521  mToolRep2D->setCrosshairColor(settings()->value("View2D/toolCrossHairColor").value<QColor>());
522  mToolRep2D->setTooltipLineColor(settings()->value("View2D/toolColor").value<QColor>());
523  mToolRep2D->setTooltipPointColor(settings()->value("View/toolTipPointColor").value<QColor>());
524  mToolRep2D->setToolOffsetPointColor(settings()->value("View/toolOffsetPointColor").value<QColor>());
525  mToolRep2D->setToolOffsetLineColor(settings()->value("View/toolOffsetLineColor").value<QColor>());
526  }
527 
528  this->applyViewFollower();
529 }
530 
531 DoubleBoundingBox3D ViewWrapper2D::getViewport_s() const
532 {
533  DoubleBoundingBox3D BB_vp = getViewport();
534  Transform3D vpMs = mView->get_vpMs();
535  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
536  return BB_s;
537 }
538 
540 {
541  DataPtr data = mServices->patient()->getData(uid);
542  DataViewProperties properties = mGroupData->getProperties(uid);
543 
544  if (properties.hasSlice2D())
545  this->dataAdded(data);
546  else
547  this->dataRemoved(uid);
548 }
549 
550 void ViewWrapper2D::dataAdded(DataPtr data)
551 {
552  if (boost::dynamic_pointer_cast<Image>(data))
553  {
554  this->imageAdded(boost::dynamic_pointer_cast<Image>(data));
555  }
556  else
557  {
558  mDataRepContainer->addData(data);
559  }
560  this->updateView();
561 }
562 
563 void ViewWrapper2D::dataRemoved(const QString& uid)
564 {
565  mDataRepContainer->removeData(uid);
566  this->updateView();
567 }
568 
569 void ViewWrapper2D::activeToolChangedSlot()
570 {
571  ToolPtr activeTool = mServices->tracking()->getActiveTool();
572  mSliceProxy->setTool(activeTool);
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)
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