Fraxinus  16.5.0-fx-rc7
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"
89 
90 #ifndef CX_VTK_OPENGL2
91 #include "cxTexture3DSlicerRep.h"
92 #endif
93 
94 namespace cx
95 {
96 
98  ViewWrapper(backend),
99  mOrientationActionGroup(new QActionGroup(view.get()))
100 {
101  qRegisterMetaType<Vector3D>("Vector3D");
102  mView = view;
103  this->connectContextMenu(mView);
104 
105  // disable vtk interactor: this wrapper IS an interactor
106  mView->getRenderWindow()->GetInteractor()->Disable();
107  mView->getRenderer()->GetActiveCamera()->SetParallelProjection(true);
108  double clipDepth = 1.0; // 1mm depth, i.e. all 3D props rendered outside this range is not shown.
109  double length = clipDepth*10;
110  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
111  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
112  connect(settings(), SIGNAL(valueChangedFor(QString)), this, SLOT(settingsChangedSlot(QString)));
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 
149 {
150  if(!this->isAnyplane())
151  return;
152 
153  Transform3D sMr = mSliceProxy->get_sMr();
154  Transform3D vpMs = mView->get_vpMs();
155 
156  Vector3D p_s = vpMs.inv().coord(click_vp);
157  Vector3D p_r = sMr.inv().coord(p_s);
158 
159  emit pointSampled(p_r);
160 }
161 
162 void ViewWrapper2D::appendToContextMenu(QMenu& contextMenu)
163 {
164  contextMenu.addSeparator();
165  mZoom2D->addActionsToMenu(&contextMenu);
166 }
167 
169 {
171 
172  mZoom2D->setGroupData(group);
173  connect(group.get(), SIGNAL(optionsChanged()), this, SLOT(optionChangedSlot()));
174  this->optionChangedSlot();
175 }
176 
177 void ViewWrapper2D::optionChangedSlot()
178 {
179  ViewGroupData::Options options = mGroupData->getOptions();
180 
181  if (mPickerGlyphRep)
182  {
183  mPickerGlyphRep->setMesh(options.mPickerGlyph);
184  }
185 }
186 
187 void ViewWrapper2D::addReps()
188 {
189  // annotation rep
190  mOrientationAnnotationRep = OrientationAnnotationSmartRep::New();
191  mView->addRep(mOrientationAnnotationRep);
192 
193  // plane type text rep
194  mPlaneTypeText = DisplayTextRep::New();
195  mPlaneTypeText->addText(QColor(Qt::green), "not initialized", Vector3D(0.98, 0.02, 0.0));
196  mView->addRep(mPlaneTypeText);
197 
198  //data name text rep
199  mDataNameText = DisplayTextRep::New();
200  mDataNameText->addText(QColor(Qt::green), "not initialized", Vector3D(0.02, 0.02, 0.0));
201  mView->addRep(mDataNameText);
202 
203  // tool rep
204  mToolRep2D = ToolRep2D::New(mServices->spaceProvider(), "Tool2D_" + mView->getName());
205  mToolRep2D->setSliceProxy(mSliceProxy);
206  mToolRep2D->setUseCrosshair(true);
207 // mToolRep2D->setUseToolLine(false);
208  mView->addRep(mToolRep2D);
209 
210  mPickerGlyphRep = GeometricRep2D::New("PickerGlyphRep_" + mView->getName());
211  mPickerGlyphRep->setSliceProxy(mSliceProxy);
212  if (mGroupData)
213  {
214  mPickerGlyphRep->setMesh(mGroupData->getOptions().mPickerGlyph);
215  }
216  mView->addRep(mPickerGlyphRep);
217 }
218 
219 void ViewWrapper2D::settingsChangedSlot(QString key)
220 {
221  if (key == "View/showDataText")
222  {
223  this->updateView();
224  }
225  if (key == "View/showOrientationAnnotation")
226  {
227  this->updateView();
228  }
229  if (key == "useGPU2DRendering")
230  {
231  this->updateView();
232  }
233  if (key == "Navigation/anyplaneViewOffset")
234  {
235  this->updateView();
236  }
237 }
238 
239 
240 void ViewWrapper2D::removeAndResetSliceRep()
241 {
242  if (mSliceRep)
243  {
244  mView->removeRep(mSliceRep);
245  mSliceRep.reset();
246  }
247 }
248 
249 void ViewWrapper2D::removeAndResetMultiSliceRep()
250 {
251 #ifndef CX_VTK_OPENGL2
252  if (mMultiSliceRep)
253  {
254  mView->removeRep(mMultiSliceRep);
255  mMultiSliceRep.reset();
256  }
257 #endif
258 }
259 
260 void ViewWrapper2D::createAndAddMultiSliceRep()
261 {
262 #ifndef CX_VTK_OPENGL2
263  mMultiSliceRep = Texture3DSlicerRep::New();
264  mMultiSliceRep->setShaderPath(DataLocations::findConfigFolder("/shaders"));
265  mMultiSliceRep->setSliceProxy(mSliceProxy);
266 
267  mView->addRep(mMultiSliceRep);
268 #endif
269 }
270 
275 void ViewWrapper2D::recreateMultiSlicer()
276 {
277  this->removeAndResetSliceRep();
278  this->removeAndResetMultiSliceRep();
279 
280  if (!this->useGPU2DRendering())
281  return;
282 
283  this->createAndAddMultiSliceRep();
284 
285 #ifndef CX_VTK_OPENGL2
286  if (mGroupData)
287  mMultiSliceRep->setImages(this->getImagesToView());
288 #endif
289 
290  this->viewportChanged();
291 }
292 
293 std::vector<ImagePtr> ViewWrapper2D::getImagesToView()
294 {
295  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D());
296 
297  if(this->isAnyplane())
298  {
299  std::vector<TrackedStreamPtr> streams = mGroupData->getTracked2DStreams(DataViewProperties::createSlice2D());
300  for(int i = 0; i < streams.size(); ++i)
301  images.push_back(streams[i]->getChangingImage());
302  }
303  return images;
304 }
305 
306 bool ViewWrapper2D::isAnyplane()
307 {
308  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
309  return plane == ptANYPLANE;
310 }
311 
315 void ViewWrapper2D::viewportChanged()
316 {
317  if (!mView->getRenderer()->IsActiveCameraCreated())
318  return;
319 
320  mView->setZoomFactor(mZoom2D->getFactor());
321 
322  double viewHeight = mView->getViewport_s().range()[1];
323  mView->getRenderer()->GetActiveCamera()->SetParallelScale(viewHeight / 2);
324 
325  // Heuristic guess for a good clip depth. The point is to show 3D data clipped in 2D
326  // with a suitable thickness projected onto the plane.
327  double clipDepth = 2.0; // i.e. all 3D props rendered outside this range is not shown.
328  double length = clipDepth*10;
329  clipDepth = viewHeight/120 + 1.5;
330  mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
331  mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
332 
333  mSliceProxy->setToolViewportHeight(viewHeight);
334  double anyplaneViewOffset = settings()->value("Navigation/anyplaneViewOffset").toDouble();
335  mSliceProxy->initializeFromPlane(mSliceProxy->getComputer().getPlaneType(), false, Vector3D(0, 0, 1), true, viewHeight, anyplaneViewOffset, true);
336 
337  DoubleBoundingBox3D BB_vp = getViewport();
338  Transform3D vpMs = mView->get_vpMs();
339  DoubleBoundingBox3D BB_s = transform(vpMs.inv(), BB_vp);
340  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
341 
342  mToolRep2D->setViewportData(vpMs, BB_vp);
343  if (mSlicePlanes3DMarker)
344  {
345  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, BB_s);
346  }
347 
348  mViewFollower->setView(BB_s);
349 }
350 
353 DoubleBoundingBox3D ViewWrapper2D::getViewport() const
354 {
355  QSize size = mView->size();
356  Vector3D p0_d(0, 0, 0);
357  Vector3D p1_d(size.width(), size.height(), 0);
358  DoubleBoundingBox3D BB_vp(p0_d, p1_d);
359  return BB_vp;
360 }
361 
362 void ViewWrapper2D::showSlot()
363 {
364  activeToolChangedSlot();
365  viewportChanged();
366 }
367 
368 void ViewWrapper2D::initializePlane(PLANE_TYPE plane)
369 {
370 // mOrientationAnnotationRep->setPlaneType(plane);
371  mPlaneTypeText->setText(0, qstring_cast(plane));
372 // double viewHeight = mView->heightMM() / mZoom2D->getFactor();
373  double viewHeight = mView->getViewport_s().range()[1];
374  mSliceProxy->initializeFromPlane(plane, false, Vector3D(0, 0, 1), true, viewHeight, 0.25);
375 // double anyplaneViewOffset = settings()->value("Navigation/anyplaneViewOffset").toDouble();
376 // mSliceProxy->initializeFromPlane(plane, false, Vector3D(0, 0, 1), true, 1, 0);
377  mOrientationAnnotationRep->setSliceProxy(mSliceProxy);
378 
379  bool isOblique = mSliceProxy->getComputer().getOrientationType() == otOBLIQUE;
380  mToolRep2D->setUseCrosshair(!isOblique);
381 // mToolRep2D->setUseToolLine(!isOblique);
382 
383 }
384 
387 ORIENTATION_TYPE ViewWrapper2D::getOrientationType() const
388 {
389  return mSliceProxy->getComputer().getOrientationType();
390 }
391 
393 {
394  return mView;
395 }
396 
399 void ViewWrapper2D::imageAdded(ImagePtr image)
400 {
401  this->updateView();
402 
403  // removed this side effect: unwanted when loading a patient, might also be unwanted to change scene when adding/removing via gui?
404  //Navigation().centerToView(mViewGroup->getImages());
405 }
406 
408 {
409  std::vector<ImagePtr> images = mGroupData->getImagesAndChangingImagesFromTrackedStreams(DataViewProperties::createSlice2D(), true);
410  ImagePtr image;
411  if (!images.empty())
412  image = images.back(); // always show last in vector
413 
414  return image;
415 }
416 
417 bool ViewWrapper2D::useGPU2DRendering()
418 {
419 #ifdef CX_VTK_OPENGL2
420  return false;
421 #endif //CX_VTK_OPENGL2
422 
423  return settings()->value("useGPU2DRendering").toBool();
424 }
425 
426 void ViewWrapper2D::createAndAddSliceRep()
427 {
428  if (!mSliceRep)
429  {
430  mSliceRep = SliceRepSW::New("SliceRep_" + mView->getName());
431  mSliceRep->setSliceProxy(mSliceProxy);
432  mView->addRep(mSliceRep);
433  }
434 }
435 
436 void ViewWrapper2D::updateItemsFromViewGroup(QString &text)
437 {
438  ImagePtr image = this->getImageToDisplay();
439 
440  if (image)
441  {
442  Vector3D c = image->get_rMd().coord(image->boundingBox().center());
443  mSliceProxy->setDefaultCenter(c);
444 
445  if (this->useGPU2DRendering())
446  {
447  this->recreateMultiSlicer();
448  text = this->getAllDataNames(DataViewProperties::createSlice2D()).join("\n");
449  }
450  else //software rendering
451  {
452  this->removeAndResetMultiSliceRep();
453  this->createAndAddSliceRep();
454 
455  mSliceRep->setImage(image);
456 
457  // list all meshes and one image.
458  QStringList textList;
459  std::vector<MeshPtr> mesh = mGroupData->getMeshes(DataViewProperties::createSlice2D());
460  for (unsigned i = 0; i < mesh.size(); ++i)
461  textList << qstring_cast(mesh[i]->getName());
462  if (image)
463  textList << image->getName();
464  text = textList.join("\n");
465  }
466  }
467  else //no images to display in the view
468  {
469  this->removeAndResetSliceRep();
470  this->removeAndResetMultiSliceRep();
471  }
472 }
473 
479 void ViewWrapper2D::setDataNameText(QString &text)
480 {
481  mDataNameText->setText(0, text);
482  mDataNameText->setFontSize(std::max(12, 22 - 2 * text.size()));
483 }
484 
489 void ViewWrapper2D::updateDataNameText(QString &text)
490 {
491  bool show = settings()->value("View/showDataText").value<bool>();
492  if (!show)
493  text = QString();
494 
495  this->setDataNameText(text);
496 }
497 
499 {
500  QString annotationTextForLowerLeftCorner;
501  if (mGroupData) //the view is a part of a viewgroup
502  {
503  this->updateItemsFromViewGroup(annotationTextForLowerLeftCorner);
504  }
505 
506  //UPDATE VIEWS DATA LIST ANNOTATION
507  this->updateDataNameText(annotationTextForLowerLeftCorner);
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 
516 
517 //DELETE - NOT USED...
518 //void ViewWrapper2D::imageRemoved(const QString& uid)
519 //{
520 // CX_LOG_DEBUG() << "imageRemoved uid: " << uid;
521 // updateView();
522 //}
523 
525 {
526  DataPtr data = mServices->patient()->getData(uid);
527  DataViewProperties properties = mGroupData->getProperties(uid);
528 
529  if (properties.hasSlice2D())
530  this->dataAdded(data);
531  else
532  this->dataRemoved(uid);
533 
534 }
535 
536 void ViewWrapper2D::dataAdded(DataPtr data)
537 {
538  if (boost::dynamic_pointer_cast<Image>(data))
539  {
540  this->imageAdded(boost::dynamic_pointer_cast<Image>(data));
541  }
542  else
543  {
544  mDataRepContainer->addData(data);
545  }
546  this->updateView();
547 }
548 
549 void ViewWrapper2D::dataRemoved(const QString& uid)
550 {
551  mDataRepContainer->removeData(uid);
552  this->updateView();
553 }
554 
555 void ViewWrapper2D::activeToolChangedSlot()
556 {
557  ToolPtr activeTool = mServices->tracking()->getActiveTool();
558  mSliceProxy->setTool(activeTool);
559 }
560 
565 void ViewWrapper2D::mousePressSlot(int x, int y, Qt::MouseButtons buttons)
566 {
567  if (buttons & Qt::LeftButton)
568  {
569  Vector3D clickPos_vp = qvp2vp(QPoint(x,y));
570  moveManualTool(clickPos_vp, Vector3D(0,0,0));
571  samplePoint(clickPos_vp);
572  }
573 }
574 
579 void ViewWrapper2D::mouseMoveSlot(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, clickPos_vp - mLastClickPos_vp);
585  }
586 }
587 
588 void ViewWrapper2D::moveManualTool(Vector3D vp, Vector3D delta_vp)
589 {
590  if (this->getOrientationType() == otORTHOGONAL)
591  setAxisPos(vp);
592  else
593  {
594  this->shiftAxisPos(delta_vp); // signal the maual tool that something is happening (important for playback tool)
595  mLastClickPos_vp = vp;
596  }
597 }
598 
602 void ViewWrapper2D::mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons)
603 {
604  // scale zoom in log space
605  double val = log10(mZoom2D->getFactor());
606  val += delta / 120.0 / 20.0; // 120 is normal scroll resolution, x is zoom resolution
607  double newZoom = pow(10.0, val);
608 
609  mZoom2D->setFactor(newZoom);
610 
611  Navigation(mServices).centerToTooltip(); // side effect: center on tool
612 }
613 
617 Vector3D ViewWrapper2D::qvp2vp(QPoint pos_qvp)
618 {
619  QSize size = mView->size();
620  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
621  return pos_vp;
622 }
623 
627 void ViewWrapper2D::shiftAxisPos(Vector3D delta_vp)
628 {
629  delta_vp = -delta_vp;
630  ToolPtr tool = mServices->tracking()->getManualTool();
631 
632  Transform3D sMr = mSliceProxy->get_sMr();
633  Transform3D rMpr = mServices->patient()->get_rMpr();
634  Transform3D prMt = tool->get_prMt();
635  Transform3D vpMs = mView->get_vpMs();
636  Vector3D delta_s = vpMs.inv().vector(delta_vp);
637 
638  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
639 
640  // MD is the actual tool movement in patient space, matrix form
641  Transform3D MD = createTransformTranslate(delta_pr);
642  // set new tool position to old modified by MD:
643  tool->set_prMt(MD * prMt);
644 }
645 
649 void ViewWrapper2D::setAxisPos(Vector3D click_vp)
650 {
651  ToolPtr tool = mServices->tracking()->getManualTool();
652 
653  Transform3D sMr = mSliceProxy->get_sMr();
654  Transform3D rMpr = mServices->patient()->get_rMpr();
655  Transform3D prMt = tool->get_prMt();
656 
657  // find tool position in s
658  Vector3D tool_t(0, 0, tool->getTooltipOffset());
659  Vector3D tool_s = (sMr * rMpr * prMt).coord(tool_t);
660 
661  // find click position in s.
662  Transform3D vpMs = mView->get_vpMs();
663  Vector3D click_s = vpMs.inv().coord(click_vp);
664 
665  // compute the new tool position in slice space as a synthesis of the plane part of click and the z part of original.
666  Vector3D cross_s(click_s[0], click_s[1], tool_s[2]);
667  // compute the position change and transform to patient.
668  Vector3D delta_s = cross_s - tool_s;
669  Vector3D delta_pr = (rMpr.inv() * sMr.inv()).vector(delta_s);
670 
671  // MD is the actual tool movement in patient space, matrix form
672  Transform3D MD = createTransformTranslate(delta_pr);
673  // set new tool position to old modified by MD:
674  tool->set_prMt(MD * prMt);
675 }
676 
678 {
679  mSlicePlanes3DMarker = SlicePlanes3DMarkerIn2DRep::New("uid");
680  PLANE_TYPE plane = mSliceProxy->getComputer().getPlaneType();
681  mSlicePlanes3DMarker->setProxy(plane, proxy);
682 
683  DoubleBoundingBox3D BB_vp = getViewport();
684  Transform3D vpMs = mView->get_vpMs();
685  mSlicePlanes3DMarker->getProxy()->setViewportData(plane, mSliceProxy, transform(vpMs.inv(), BB_vp));
686 
687  mView->addRep(mSlicePlanes3DMarker);
688 }
689 
691 {
692  this->updateView();
693 }
694 
695 //------------------------------------------------------------------------------
696 }
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()
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.
Definition: cxViewWrapper.h:93
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 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="")
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)
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="")
VisServicesPtr mServices
void samplePoint(Vector3D click_vp)
QStringList getAllDataNames(DataViewProperties properties) const
RealScalar length() const
static DisplayTextRepPtr New(const QString &uid="")
static ToolRep2DPtr New(SpaceProviderPtr spaceProvider, const QString &uid="")
Definition: cxToolRep2D.cpp:79
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)
bool hasSlice2D() const
boost::shared_ptr< class Tool > ToolPtr