Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxVBcameraPath.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 #ifndef CXVBCAMERAPATH_H
13 #define CXVBCAMERAPATH_H
14 
15 #include <QObject>
16 #include <QElapsedTimer>
17 
18 #include "cxForwardDeclarations.h"
19 #include "cxVector3D.h"
20 #include "cxTransform3D.h"
21 #include "org_custusx_virtualbronchoscopy_Export.h"
22 
23 typedef vtkSmartPointer<class vtkCardinalSpline> vtkCardinalSplinePtr;
24 typedef vtkSmartPointer<class vtkParametricSpline> vtkParametricSplinePtr;
25 
26 namespace cx {
27 
39 class CXVBcameraPath : public QObject
40 {
41  Q_OBJECT
42 
43 private:
44  vtkParametricSplinePtr mSpline;
45  TrackingServicePtr mTrackingService;
46  PatientModelServicePtr mPatientModelService;
47  ViewServicePtr mViewService;
48  ToolPtr mManualTool;
49 
50  int mNumberOfInputPoints;
51  int mNumberOfControlPoints;
52  Vector3D mLastCameraPos_r;
53  Vector3D mLastCameraFocus_r;
54  Vector3D mLastStoredViewVector;
55  double mLastCameraViewAngle;
56  double mLastCameraRotAngle;
57  double mPositionPercentage;
58  bool mAutomaticRotation;
59  bool mWritePositionsToFile;
60  QString mPositionsFilePath;
61  QElapsedTimer mTimeSinceStartRecording;
62 
63  std::vector< Eigen::Vector3d > mRoutePositions;
64  std::vector< double > mCameraRotations;
65  std::vector< double > mCameraRotationsSmoothed;
66  std::vector< int > mBranchingIndex;
67 
68  void updateManualToolPosition();
69  void generateSplineCurve(MeshPtr mesh);
70  void generateSplineCurve(std::vector< Eigen::Vector3d > routePositions);
71  std::vector< double > smoothCameraRotations(std::vector< double > cameraRotations);
72  void writePositionToFile(Transform3D prMt);
73 
74 public:
75  CXVBcameraPath(TrackingServicePtr tracker, PatientModelServicePtr patientModel, ViewServicePtr visualization);
76 
77  void setRoutePositions(std::vector< Eigen::Vector3d > routePositions);
78  void setCameraRotations(std::vector< double > cameraRotations);
79  void setBranchingIndexAlongRoute(std::vector< int > branchingIndex);
80  void setAutomaticRotation(bool automaticRotation);
81  void setWritePositionsToFile(bool write);
82  void setWritePositionsFilePath(QString path);
83 
84 signals:
85  void rotationChanged(int value);
86 
87 public slots:
88  void cameraRawPointsSlot(MeshPtr mesh);
89  void cameraPathPositionSlot(int positionPermillage);
90  void cameraViewAngleSlot(int angle);
91  void cameraRotateAngleSlot(int angle);
92 
93 };
94 
95  double org_custusx_virtualbronchoscopy_EXPORT positionPercentageAdjusted(double positionPercentage);
96 
97 } /* namespace cx */
98 
99 #endif // CXVBCAMERAPATH_H
void setWritePositionsFilePath(QString path)
void rotationChanged(int value)
vtkSmartPointer< class vtkCardinalSpline > vtkCardinalSplinePtr
void setAutomaticRotation(bool automaticRotation)
void cameraRawPointsSlot(MeshPtr mesh)
void cameraPathPositionSlot(int positionPermillage)
double positionPercentageAdjusted(double positionPercentage)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class TrackingService > TrackingServicePtr
void setCameraRotations(std::vector< double > cameraRotations)
vtkSmartPointer< class vtkParametricSpline > vtkParametricSplinePtr
boost::shared_ptr< class ViewService > ViewServicePtr
void cameraRotateAngleSlot(int angle)
void setBranchingIndexAlongRoute(std::vector< int > branchingIndex)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void cameraViewAngleSlot(int angle)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
void setRoutePositions(std::vector< Eigen::Vector3d > routePositions)
boost::shared_ptr< class Mesh > MeshPtr
CXVBcameraPath(TrackingServicePtr tracker, PatientModelServicePtr patientModel, ViewServicePtr visualization)
void setWritePositionsToFile(bool write)
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr