CustusX  16.12
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 /*
34  * cxViewWrapper2D.cpp
35  *
36  * \date Mar 24, 2010
37  * \author christiana
38  */
39 
40 
41 #include "cxViewWrapper2D.h"
42 #include <vector>
43 #include <vtkCamera.h>
44 #include <vtkRenderer.h>
45 #include <vtkRenderWindow.h>
46 
47 #include <QAction>
48 #include <QActionGroup>
49 #include <QMenu>
50 #include <QMouseEvent>
51 #include <QWheelEvent>
52 
53 #include "cxUtilHelpers.h"
54 #include "cxView.h"
55 #include "cxSliceProxy.h"
56 #include "cxSlicerRepSW.h"
57 #include "cxToolRep2D.h"
60 #include "cxDisplayTextRep.h"
61 
62 #include "cxManualTool.h"
63 #include "cxViewManager.h"
64 #include "cxTrackingService.h"
65 #include "cxViewGroup.h"
66 #include "cxDefinitionStrings.h"
67 #include "cxSlicePlanes3DRep.h"
68 #include "cxDefinitionStrings.h"
69 #include "cxSliceComputer.h"
70 #include "cxGeometricRep2D.h"
71 #include "cxDataLocations.h"
72 #include "cxSettings.h"
73 #include "cxGLHelpers.h"
74 #include "cxData.h"
75 #include "cxMesh.h"
76 #include "cxImage.h"
77 #include "cxTrackedStream.h"
78 #include "cxPointMetricRep2D.h"
79 
80 #include "cxViewFollower.h"
81 #include "cxVisServices.h"
82 #include "cx2DZoomHandler.h"
83 #include "cxNavigation.h"
84 #include "cxDataRepContainer.h"
85 #include "vtkRenderWindowInteractor.h"
86 #include "cxPatientModelService.h"
87 #include "cxLogger.h"
88 #include "cxViewService.h"
90 
91 #ifndef CX_VTK_OPENGL2
92 #include "cxTexture3DSlicerRep.h"
93 #endif
94 
95 namespace cx
96 {
97 
99  ViewWrapper(backend),
100  mOrientationActionGroup(new QActionGroup(view.get()))
101 {
102  qRegisterMetaType<Vector3D>("Vector3D");
103  mView = view;
104  this->connectContextMenu(mView);
105 
106  // disable vtk interactor: this wrapper IS an interactor
107  mView->getRenderWindow()->GetInteractor()->Disable();
108  mView->getRenderer()->GetActiveCamera()->SetParallelProjection(true);
109  double clipDepth = 1.0; // 1mm depth, i.e. all 3D props rendered outside this range is not shown.
110  double length = clipDepth*10;
111  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
112  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
113 
114  // slice proxy
115  mSliceProxy = SliceProxy::create(mServices->patient());
116 
117  mDataRepContainer.reset(new DataRepContainer());
118  mDataRepContainer->setSliceProxy(mSliceProxy);
119  mDataRepContainer->setView(mView);
120 
121  mViewFollower = ViewFollower::create(mServices->patient());
122  mViewFollower->setSliceProxy(mSliceProxy);
123 
124  addReps();
125 
126  mZoom2D.reset(new Zoom2DHandler());
127  connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged()));
128 
129  connect(mServices->tracking().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(activeToolChangedSlot()));
130  connect(mView.get(), SIGNAL(resized(QSize)), this, SLOT(viewportChanged()));
131  connect(mView.get(), SIGNAL(shown()), this, SLOT(showSlot()));
132  connect(mView.get(), SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SLOT(mousePressSlot(int, int, Qt::MouseButtons)));
133  connect(mView.get(), SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SLOT(mouseMoveSlot(int, int, Qt::MouseButtons)));
134  connect(mView.get(), SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SLOT(mouseWheelSlot(int, int, int, int, Qt::MouseButtons)));
135 
137 
138  this->activeToolChangedSlot();
139  this->updateView();
140 }
141 
143 {
144  if (mView)
145  mView->removeReps();
146 }
147 
148 void ViewWrapper2D::changeZoom(double delta)
149 {
150  if (similar(delta, 1.0))
151  return;
152 
153  double zoom = mZoom2D->getFactor();
154 // CX_LOG_CHANNEL_DEBUG("CA") << "changing zoom from " << zoom << " by " << delta;
155  zoom *= delta;
156 // CX_LOG_CHANNEL_DEBUG("CA") << " new zoom:" << zoom;
157  mZoom2D->setFactor(zoom);
158 // CX_LOG_CHANNEL_DEBUG("CA") << " got zoom:" << mZoom2D->getFactor();
159 }
160 
162 {
163  if(!this->isAnyplane())
164  return;
165 
166  Transform3D sMr = mSliceProxy->get_sMr();
167  Transform3D vpMs = mView->get_vpMs();
168 
169  Vector3D p_s = vpMs.inv().coord(click_vp);
170  Vector3D p_r = sMr.inv().coord(p_s);
171 
172  emit pointSampled(p_r);
173 }
174 
175 void ViewWrapper2D::appendToContextMenu(QMenu& contextMenu)
176 {
177  contextMenu.addSeparator();
178  mZoom2D->addActionsToMenu(&contextMenu);
179 }
180 
182 {
184 
185  mZoom2D->setGroupData(group);
186  connect(group.get(), SIGNAL(optionsChanged()), this, SLOT(optionChangedSlot()));
187  this->optionChangedSlot();
188 }
189 
190 void ViewWrapper2D::optionChangedSlot()
191 {
192  ViewGroupData::Options options = mGroupData->getOptions();
193 
194  if (mPickerGlyphRep)
195  {
196  mPickerGlyphRep->setMesh(options.mPickerGlyph);
197  }
198 }
199 
200 void ViewWrapper2D::addReps()
201 {
202  // annotation rep
203  mOrientationAnnotationRep = OrientationAnnotationSmartRep::New();
204  mView->addRep(mOrientationAnnotationRep);
205 
206  this->ViewWrapper::addReps();
207 
208  // tool rep
209  mToolRep2D = ToolRep2D::New(mServices->spaceProvider(), "Tool2D_" + mView->getName());
210  mToolRep2D->setSliceProxy(mSliceProxy);
211  mToolRep2D->setUseCrosshair(true);
212 // mToolRep2D->setUseToolLine(false);
213  mView->addRep(mToolRep2D);
214 
215  mPickerGlyphRep = GeometricRep2D::New("PickerGlyphRep_" + mView->getName());
216  mPickerGlyphRep->setSliceProxy(mSliceProxy);
217  if (mGroupData)
218  {
219  mPickerGlyphRep->setMesh(mGroupData->getOptions().mPickerGlyph);
220  }
221  mView->addRep(mPickerGlyphRep);
222 }
223 
225 {
227 
228  if (key == "useGPU2DRendering")
229  {
230  this->updateView();
231  }
232  if (key == "Navigation/anyplaneViewOffset")
233  {
234  this->updateView();
235  }
236 }
237 
238 void ViewWrapper2D::removeAndResetSliceRep()
239 {
240  if (mSliceRep)
241  {
242  mView->removeRep(mSliceRep);
243  mSliceRep.reset();
244  }
245 }
246 
247 void ViewWrapper2D::removeAndResetMultiSliceRep()
248 {
249 #ifndef CX_VTK_OPENGL2
250  if (mMultiSliceRep)
251  {
252  mView->removeRep(mMultiSliceRep);
253  mMultiSliceRep.reset();
254  }
255 #endif
256 }
257 
258 void ViewWrapper2D::createAndAddMultiSliceRep()
259 {
260 #ifndef CX_VTK_OPENGL2
261  if (mMultiSliceRep)
262  return;
263  mMultiSliceRep = Texture3DSlicerRep::New();
264  mMultiSliceRep->setShaderPath(DataLocations::findConfigFolder("/shaders"));
265  mMultiSliceRep->setSliceProxy(mSliceProxy);
266 
267  mView->addRep(mMultiSliceRep);
268 #endif
269 }
270 
276 void ViewWrapper2D::recreateMultiSlicer()
277 {
278  this->removeAndResetSliceRep();
279 
280  if (!this->useGPU2DRendering())
281  {
282  this->removeAndResetMultiSliceRep();
283  return;
284  }
285 
286  this->createAndAddMultiSliceRep();
287 
288 #ifndef CX_VTK_OPENGL2
289  if (mGroupData)
290  mMultiSliceRep->setImages(this->getImagesToView());
291  else
292  mMultiSliceRep->setImages(std::vector<ImagePtr>());
293 #endif
294 
295  this->viewportChanged();
296 }
297 
298 std::vector<ImagePtr> ViewWrapper2D::getImagesToView()
299 {
300  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D());
301 
302  if(this->isAnyplane())
303  {
304  std::vector<TrackedStreamPtr> streams = mGroupData->getTracked2DStreams(DataViewProperties::createSlice2D());
305  for(int i = 0; i < streams.size(); ++i)
306  images.push_back(streams[i]->getChangingImage());
307  }
308  return images;
309 }
310 
311 bool ViewWrapper2D::isAnyplane()
312 {
313  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
314  return plane == ptANYPLANE;
315 }
316 
320 void ViewWrapper2D::viewportChanged()
321 {
322  if (!mView->getRenderer()->IsActiveCameraCreated())
323  return;
324 
325  mView->setZoomFactor(mZoom2D->getFactor());
326 
327  double viewHeight = mView->getViewport_s().range()[1];
328  mView->getRenderer()->GetActiveCamera()->SetParallelScale(viewHeight / 2);
329 
330  // Heuristic guess for a good clip depth. The point is to show 3D data clipped in 2D
331  // with a suitable thickness projected onto the plane.
332  double clipDepth = 2.0; // i.e. all 3D props rendered outside this range is not shown.
333  double length = clipDepth*10;
334  clipDepth = viewHeight/120 + 1.5;
335  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
336  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
337 
338  mSliceProxy->setToolViewportHeight(viewHeight);
339  double anyplaneViewOffset = settings()->value("Navigation/anyplaneViewOffset").toDouble();
340  mSliceProxy->initializeFromPlane(mSliceProxy->getComputer().getPlaneType(), false, true, viewHeight, anyplaneViewOffset);
341 
342  DoubleBoundingBox3D BB_vp = getViewport();
343  Transform3D vpMs = mView->get_vpMs();
344  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
345  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
346 
347  mToolRep2D->setViewportData(vpMs, BB_vp);
348  if (mSlicePlanes3DMarker)
349  {
350  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, BB_s);
351  }
352 }
353 
354 void ViewWrapper2D::applyViewFollower()
355 {
356  if (!mGroupData)
357  return;
358  QString roiUid = mGroupData->getOptions().mCameraStyle.mAutoZoomROI;
359  mViewFollower->setAutoZoomROI(roiUid);
360  mViewFollower->setView(this->getViewport_s());
361  SliceAutoViewportCalculator::ReturnType result = mViewFollower->calculate();
362 
363 // CX_LOG_CHANNEL_DEBUG("CA") << "roi=" << roiUid;
364 // CX_LOG_CHANNEL_DEBUG("CA") << this << " autozoom zoom=" << result.zoom << ", center=" << result.center_shift_s;
365  this->changeZoom(result.zoom);
366  Vector3D newcenter_r = mViewFollower->findCenter_r_fromShift_s(result.center_shift_s);
367  mServices->patient()->setCenter(newcenter_r);
368 }
369 
372 DoubleBoundingBox3D ViewWrapper2D::getViewport() const
373 {
374  QSize size = mView->size();
375  Vector3D p0_d(0, 0, 0);
376  Vector3D p1_d(size.width(), size.height(), 0);
377  DoubleBoundingBox3D BB_vp(p0_d, p1_d);
378  return BB_vp;
379 }
380 
381 void ViewWrapper2D::showSlot()
382 {
383  activeToolChangedSlot();
384  viewportChanged();
385 }
386 
387 void ViewWrapper2D::initializePlane(PLANE_TYPE plane)
388 {
389  double viewHeight = mView->getViewport_s().range()[1];
390  mSliceProxy->initializeFromPlane(plane, false, true, viewHeight, 0.25);
391  mOrientationAnnotationRep->setSliceProxy(mSliceProxy);
392 }
393 
396 ORIENTATION_TYPE ViewWrapper2D::getOrientationType() const
397 {
398  return mSliceProxy->getComputer().getOrientationType();
399 }
400 
402 {
403  return mView;
404 }
405 
408 void ViewWrapper2D::imageAdded(ImagePtr image)
409 {
410  this->updateView();
411 
412  // removed this side effect: unwanted when loading a patient, might also be unwanted to change scene when adding/removing via gui?
413  //Navigation().centerToView(mViewGroup->getImages());
414 }
415 
417 {
418  if (!mGroupData)
419  return ImagePtr();
420 
421  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), true);
422  ImagePtr image;
423  if (!images.empty())
424  image = images.back(); // always show last in vector
425 
426  return image;
427 }
428 
429 bool ViewWrapper2D::useGPU2DRendering()
430 {
431 #ifdef CX_VTK_OPENGL2
432  return false;
433 #endif //CX_VTK_OPENGL2
434 
435  return settings()->value("useGPU2DRendering").toBool();
436 }
437 
438 void ViewWrapper2D::createAndAddSliceRep()
439 {
440  if (!mSliceRep)
441  {
442  mSliceRep = SliceRepSW::New("SliceRep_" + mView->getName());
443  mSliceRep->setSliceProxy(mSliceProxy);
444  mView->addRep(mSliceRep);
445  }
446 }
447 
449 {
450  QString text;
451  if (this->useGPU2DRendering())
452  {
453  text = this->getAllDataNames(DataViewProperties::createSlice2D()).join("\n");
454  }
455  else //software rendering
456  {
457  ImagePtr image = this->getImageToDisplay();
458  if (!image)
459  return "";
460  // list all meshes and one image.
461  QStringList textList;
462  std::vector<MeshPtr> mesh = mGroupData->getMeshes(DataViewProperties::createSlice2D());
463  for (unsigned i = 0; i < mesh.size(); ++i)
464  textList << qstring_cast(mesh[i]->getName());
465  if (image)
466  textList << image->getName();
467  text = textList.join("\n");
468  }
469  return text;
470 }
471 
473 {
474  return qstring_cast(mSliceProxy->getComputer().getPlaneType());
475 }
476 
477 void ViewWrapper2D::updateItemsFromViewGroup()
478 {
479  if (!mGroupData)
480  return;
481 
482  ImagePtr image = this->getImageToDisplay();
483 
484  if (image)
485  {
486  Vector3D c = image->get_rMd().coord(image->boundingBox().center());
487  mSliceProxy->setDefaultCenter(c);
488 
489  if (this->useGPU2DRendering())
490  {
491  this->recreateMultiSlicer();
492  }
493  else //software rendering
494  {
495  this->removeAndResetMultiSliceRep();
496  this->createAndAddSliceRep();
497 
498  mSliceRep->setImage(image);
499  }
500  }
501  else //no images to display in the view
502  {
503  this->removeAndResetSliceRep();
504  this->removeAndResetMultiSliceRep();
505  }
506 }
507 
509 {
510  if (!this->getView())
511  return;
512  this->updateItemsFromViewGroup();
513 
514  this->ViewWrapper::updateView();
515 
516  //UPDATE ORIENTATION ANNOTATION
517  mOrientationAnnotationRep->setVisible(settings()->value("View/showOrientationAnnotation").value<bool>());
518 
519  //UPDATE DATA METRIC ANNOTATION
520  mDataRepContainer->updateSettings();
521 
522  if (mToolRep2D)
523  {
524  bool isOblique = mSliceProxy->getComputer().getOrientationType() == otOBLIQUE;
525  bool useCrosshair = settings()->value("View/toolCrosshair", true).toBool();
526  mToolRep2D->setUseCrosshair(!isOblique && useCrosshair);
527  }
528 
529  this->applyViewFollower();
530 }
531 
532 DoubleBoundingBox3D ViewWrapper2D::getViewport_s() const
533 {
534  DoubleBoundingBox3D BB_vp = getViewport();
535  Transform3D vpMs = mView->get_vpMs();
536  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
537  return BB_s;
538 }
539 
541 {
542  DataPtr data = mServices->patient()->getData(uid);
543  DataViewProperties properties = mGroupData->getProperties(uid);
544 
545  if (properties.hasSlice2D())
546  this->dataAdded(data);
547  else
548  this->dataRemoved(uid);
549 }
550 
551 void ViewWrapper2D::dataAdded(DataPtr data)
552 {
553  if (boost::dynamic_pointer_cast<Image>(data))
554  {
555  this->imageAdded(boost::dynamic_pointer_cast<Image>(data));
556  }
557  else
558  {
559  mDataRepContainer->addData(data);
560  }
561  this->updateView();
562 }
563 
564 void ViewWrapper2D::dataRemoved(const QString& uid)
565 {
566  mDataRepContainer->removeData(uid);
567  this->updateView();
568 }
569 
570 void ViewWrapper2D::activeToolChangedSlot()
571 {
572  ToolPtr activeTool = mServices->tracking()->getActiveTool();
573  mSliceProxy->setTool(activeTool);
574 }
575 
580 void ViewWrapper2D::mousePressSlot(int x, int y, Qt::MouseButtons buttons)
581 {
582  if (buttons & Qt::LeftButton)
583  {
584  Vector3D clickPos_vp = qvp2vp(QPoint(x,y));
585  moveManualTool(clickPos_vp, Vector3D(0,0,0));
586  samplePoint(clickPos_vp);
587  }
588 }
589 
594 void ViewWrapper2D::mouseMoveSlot(int x, int y, Qt::MouseButtons buttons)
595 {
596  if (buttons & Qt::LeftButton)
597  {
598  Vector3D clickPos_vp = qvp2vp(QPoint(x,y));
599  moveManualTool(clickPos_vp, clickPos_vp - mLastClickPos_vp);
600  }
601 }
602 
603 void ViewWrapper2D::moveManualTool(Vector3D vp, Vector3D delta_vp)
604 {
605  if (this->getOrientationType() == otORTHOGONAL)
606  setAxisPos(vp);
607  else
608  {
609  this->shiftAxisPos(delta_vp); // signal the maual tool that something is happening (important for playback tool)
610  mLastClickPos_vp = vp;
611  }
612 }
613 
617 void ViewWrapper2D::mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
618 {
619  // scale zoom in log space
620  double val = log10(mZoom2D->getFactor());
621  val += delta / 120.0 / 20.0; // 120 is normal scroll resolution, x is zoom resolution
622  double newZoom = pow(10.0, val);
623 
624  mZoom2D->setFactor(newZoom);
625 
626  Navigation(mServices).centerToTooltip(); // side effect: center on tool
627 }
628 
632 Vector3D ViewWrapper2D::qvp2vp(QPoint pos_qvp)
633 {
634  QSize size = mView->size();
635  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
636  return pos_vp;
637 }
638 
642 void ViewWrapper2D::shiftAxisPos(Vector3D delta_vp)
643 {
644  delta_vp = -delta_vp;
645  ToolPtr tool = mServices->tracking()->getManualTool();
646 
647  Transform3D sMr = mSliceProxy->get_sMr();
648  Transform3D rMpr = mServices->patient()->get_rMpr();
649  Transform3D prMt = tool->get_prMt();
650  Transform3D vpMs = mView->get_vpMs();
651  Vector3D delta_s = vpMs.inv().vector(delta_vp);
652 
653  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
654 
655  // MD is the actual tool movement in patient space, matrix form
656  Transform3D MD = createTransformTranslate(delta_pr);
657  // set new tool position to old modified by MD:
658  tool->set_prMt(MD * prMt);
659 }
660 
664 void ViewWrapper2D::setAxisPos(Vector3D click_vp)
665 {
666  ToolPtr tool = mServices->tracking()->getManualTool();
667 
668  Transform3D sMr = mSliceProxy->get_sMr();
669  Transform3D rMpr = mServices->patient()->get_rMpr();
670  Transform3D prMt = tool->get_prMt();
671 
672  // find tool position in s
673  Vector3D tool_t(0, 0, tool->getTooltipOffset());
674  Vector3D tool_s = (sMr * rMpr * prMt).coord(tool_t);
675 
676  // find click position in s.
677  Transform3D vpMs = mView->get_vpMs();
678  Vector3D click_s = vpMs.inv().coord(click_vp);
679 
680  // compute the new tool position in slice space as a synthesis of the plane part of click and the z part of original.
681  Vector3D cross_s(click_s[0], click_s[1], tool_s[2]);
682  // compute the position change and transform to patient.
683  Vector3D delta_s = cross_s - tool_s;
684  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
685 
686  // MD is the actual tool movement in patient space, matrix form
687  Transform3D MD = createTransformTranslate(delta_pr);
688  // set new tool position to old modified by MD:
689  tool->set_prMt(MD * prMt);
690 }
691 
693 {
694  mSlicePlanes3DMarker = SlicePlanes3DMarkerIn2DRep::New("uid");
695  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
696  mSlicePlanes3DMarker->setProxy(plane, proxy);
697 
698 // DoubleBoundingBox3D BB_vp = getViewport();
699 // Transform3D vpMs = mView->get_vpMs();
700 // mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, transform(vpMs.inv(), BB_vp));
701  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, this->getViewport_s());
702 
703  mView->addRep(mSlicePlanes3DMarker);
704 }
705 
707 {
708  this->updateView();
709 }
710 
711 //------------------------------------------------------------------------------
712 }
QString qstring_cast(const T &val)
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50
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:50
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:62
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual ViewPtr getView()
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:48
Superclass for ViewWrappers.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: cxSettings.cpp:87
static Texture3DSlicerRepPtr New(const QString &uid="")
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="")
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)
otORTHOGONAL
orient planes relative to the image/reference space.
Definition: cxDefinitions.h:50
ViewGroupDataPtr mGroupData
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:42
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:63
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)
RealScalar length() const
virtual void updateView()
static ToolRep2DPtr New(SpaceProviderPtr spaceProvider, const QString &uid="")
Definition: cxToolRep2D.cpp:86
ImagePtr getImageToDisplay()
ptANYPLANE
a plane aligned with the tool base plane
Definition: cxDefinitions.h:56
void connectContextMenu(ViewPtr view)
static ViewFollowerPtr create(PatientModelServicePtr dataManager)
ViewWrapper2D(ViewPtr view, VisServicesPtr backend)
void pointSampled(Vector3D p_r)
boost::shared_ptr< class Tool > ToolPtr