CustusX  2023.01.05-dev+develop.0da12
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;
98  ToolPtr mTool;
105 
107 
112 };
113 
114 typedef boost::shared_ptr<PickerRep> PickerRepPtr;
115 
116 }//namespace
117 #endif /* CXPICKERREP_H_ */
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
bool mConnected
Interactor connected.
Definition: cxPickerRep.h:97
double mSphereRadius
Definition: cxPickerRep.h:100
boost::shared_ptr< class View > ViewPtr
vtkSmartPointer< class vtkCallbackCommand > vtkCallbackCommandPtr
vtkSmartPointer< class vtkCallbackCommand > vtkCallbackCommandPtr
Definition: cxPickerRep.h:26
boost::shared_ptr< class PickerRep > PickerRepPtr
Picking of points in an image.
Definition: cxPickerRep.h:49
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
MeshPtr mGlyph
Definition: cxPickerRep.h:101
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Default implementation of Rep.
Definition: cxRepImpl.h:42
bool mSnapToSurface
if set, clicking on a Data surface will pick that point
Definition: cxPickerRep.h:106
Vector3D mClickedPoint
Definition: cxPickerRep.h:103
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
GraphicalPoint3DPtr mGraphicalPoint
Definition: cxPickerRep.h:108
ViewportListenerPtr mViewportListener
Definition: cxPickerRep.h:109
PatientModelServicePtr mDataManager
Definition: cxPickerRep.h:111
GeometricRepPtr mGlyphRep
Definition: cxPickerRep.h:102
ToolPtr mTool
the connected tool
Definition: cxPickerRep.h:98
boost::shared_ptr< class Mesh > MeshPtr
Vector3D mPickedPoint
the last point that was successfully sampled from intersection with an image
Definition: cxPickerRep.h:99
vtkCallbackCommandPtr mCallbackCommand
Definition: cxPickerRep.h:110
boost::shared_ptr< class GeometricRep > GeometricRepPtr
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr