NorMIT-nav  22.09
An IGT application
cxPickerRep.h
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 #ifndef CXPICKERREP_H_
14 #define CXPICKERREP_H_
15 
16 #include "cxResourceVisualizationExport.h"
17 
18 #include "cxRepImpl.h"
19 #include "cxTransform3D.h"
20 #include "vtkForwardDeclarations.h"
21 
22 #include "cxGraphicalPrimitives.h"
23 #include "cxViewportListener.h"
24 #include "cxForwardDeclarations.h"
25 
26 class vtkCommand;
27 typedef vtkSmartPointer<class vtkCallbackCommand> vtkCallbackCommandPtr;
28 
29 namespace cx
30 {
31 typedef boost::shared_ptr<class PickerRep> PickerRepPtr;
32 typedef boost::shared_ptr<class Image> ImagePtr;
33 typedef boost::shared_ptr<class Tool> ToolPtr;
34 
49 class cxResourceVisualization_EXPORT PickerRep: public RepImpl
50 {
51 Q_OBJECT
52 
53 public:
54  static PickerRepPtr New(PatientModelServicePtr dataManager, const QString& uid="");
55  virtual ~PickerRep();
56 
57  virtual QString getType() const;
58 
59  void setTool(ToolPtr tool);
60 
61  void setEnabled(bool on);
62  void setGlyph(MeshPtr glyph);
63 
64  void pickLandmark(const Vector3D& clickPosition, vtkRendererPtr renderer);
65  Vector3D getPosition() const;
66  void setSphereRadius(double radius);
67 
68 signals:
69  void pointPicked(Vector3D p_r);
70  void dataPicked(QString uid);
71 
72 public slots:
73  void pickLandmarkSlot(vtkObject* renderWindowInteractor);
74 
75 protected:
76  PickerRep(PatientModelServicePtr dataManager);
77  virtual void addRepActorsToViewRenderer(ViewPtr view);
78  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
79  void connectInteractor();
80  void disconnectInteractor();
81  void scaleSphere();
82  virtual void onModifiedStartRender();
83  void toolHasChanged();
84  static void ProcessEvents(vtkObject* object,
85  unsigned long event,
86  void* clientdata,
87  void* calldata);
88  void OnLeftButtonDown();
89  void OnLeftButtonUp();
90  void OnMouseMove();
91  Vector3D getDisplacement();
92  Vector3D ComputeDisplayToWorld(Vector3D p_d);
93  Vector3D ComputeWorldToDisplay(Vector3D p_w);
94  void setGlyphCenter(Vector3D pos);
95 
96  bool mEnabled;
97  bool mConnected;
105 
107 
112 };
113 
114 typedef boost::shared_ptr<PickerRep> PickerRepPtr;
115 
116 }//namespace
117 #endif /* CXPICKERREP_H_ */
cx::PickerRep::mCallbackCommand
vtkCallbackCommandPtr mCallbackCommand
Definition: cxPickerRep.h:110
cx::GraphicalPoint3DPtr
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
Definition: cxForwardDeclarations.h:74
cx::PickerRep::mSnapToSurface
bool mSnapToSurface
if set, clicking on a Data surface will pick that point
Definition: cxPickerRep.h:106
cx::PickerRep::mGlyph
MeshPtr mGlyph
Definition: cxPickerRep.h:101
cxRepImpl.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
vtkCallbackCommandPtr
vtkSmartPointer< class vtkCallbackCommand > vtkCallbackCommandPtr
Definition: vtkForwardDeclarations.h:38
cx::PickerRep::mDataManager
PatientModelServicePtr mDataManager
Definition: cxPickerRep.h:111
cxGraphicalPrimitives.h
cx::PickerRep::mTool
ToolPtr mTool
the connected tool
Definition: cxPickerRep.h:98
cx::PickerRep::mEnabled
bool mEnabled
Definition: cxPickerRep.h:96
cx::ViewportListenerPtr
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
Definition: cxForwardDeclarations.h:170
cx::PickerRep::mSphereRadius
double mSphereRadius
Definition: cxPickerRep.h:100
cx::PickerRep::mGraphicalPoint
GraphicalPoint3DPtr mGraphicalPoint
Definition: cxPickerRep.h:108
cx::MeshPtr
boost::shared_ptr< class Mesh > MeshPtr
Definition: cxForwardDeclarations.h:48
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cxViewportListener.h
vtkForwardDeclarations.h
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::PickerRep::mViewportListener
ViewportListenerPtr mViewportListener
Definition: cxPickerRep.h:109
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::RepImpl
Default implementation of Rep.
Definition: cxRepImpl.h:42
cx::PickerRepPtr
boost::shared_ptr< class PickerRep > PickerRepPtr
Definition: cxForwardDeclarations.h:83
cx::PickerRep::mClickedPoint
Vector3D mClickedPoint
Definition: cxPickerRep.h:103
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cx::PickerRep::mConnected
bool mConnected
Interactor connected.
Definition: cxPickerRep.h:97
cx::PickerRep::mGlyphRep
GeometricRepPtr mGlyphRep
Definition: cxPickerRep.h:102
cx::PickerRep
Picking of points in an image.
Definition: cxPickerRep.h:49
vtkCallbackCommandPtr
vtkSmartPointer< class vtkCallbackCommand > vtkCallbackCommandPtr
Definition: cxPickerRep.h:26
cx::PickerRep::mIsDragging
bool mIsDragging
Definition: cxPickerRep.h:104
cxTransform3D.h
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
vtkRendererPtr
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
Definition: vtkForwardDeclarations.h:122
cx::PickerRep::mPickedPoint
Vector3D mPickedPoint
the last point that was successfully sampled from intersection with an image
Definition: cxPickerRep.h:99
cx::GeometricRepPtr
boost::shared_ptr< class GeometricRep > GeometricRepPtr
Definition: cxICPRegistrationBaseWidget.h:29