NorMIT-nav  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
cx::CXVBcameraPath::cameraRotateAngleSlot
void cameraRotateAngleSlot(int angle)
Definition: cxVBcameraPath.cpp:258
cx::CXVBcameraPath
Definition: cxVBcameraPath.h:39
cx::CXVBcameraPath::rotationChanged
void rotationChanged(int value)
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::CXVBcameraPath::CXVBcameraPath
CXVBcameraPath(TrackingServicePtr tracker, PatientModelServicePtr patientModel, ViewServicePtr visualization)
Definition: cxVBcameraPath.cpp:33
cxForwardDeclarations.h
cx::CXVBcameraPath::setWritePositionsToFile
void setWritePositionsToFile(bool write)
Definition: cxVBcameraPath.cpp:174
cx::CXVBcameraPath::setRoutePositions
void setRoutePositions(std::vector< Eigen::Vector3d > routePositions)
Definition: cxVBcameraPath.cpp:264
vtkCardinalSplinePtr
vtkSmartPointer< class vtkCardinalSpline > vtkCardinalSplinePtr
Definition: cxVBcameraPath.h:23
vtkParametricSplinePtr
vtkSmartPointer< class vtkParametricSpline > vtkParametricSplinePtr
Definition: cxVBcameraPath.h:24
cxVector3D.h
cx::positionPercentageAdjusted
double positionPercentageAdjusted(double positionPercentage)
Definition: cxVBcameraPath.cpp:285
cx::MeshPtr
boost::shared_ptr< class Mesh > MeshPtr
Definition: cxForwardDeclarations.h:48
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::TrackingServicePtr
boost::shared_ptr< class TrackingService > TrackingServicePtr
Definition: cxToolFilterWidget.h:27
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cx::ViewServicePtr
boost::shared_ptr< class ViewService > ViewServicePtr
Definition: cxLogicManager.h:28
cx::CXVBcameraPath::setCameraRotations
void setCameraRotations(std::vector< double > cameraRotations)
Definition: cxVBcameraPath.cpp:269
cx::CXVBcameraPath::setAutomaticRotation
void setAutomaticRotation(bool automaticRotation)
Definition: cxVBcameraPath.cpp:280
cx::CXVBcameraPath::setBranchingIndexAlongRoute
void setBranchingIndexAlongRoute(std::vector< int > branchingIndex)
Definition: cxVBcameraPath.cpp:275
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cx::CXVBcameraPath::cameraRawPointsSlot
void cameraRawPointsSlot(MeshPtr mesh)
Definition: cxVBcameraPath.cpp:48
cxTransform3D.h
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
cx::CXVBcameraPath::setWritePositionsFilePath
void setWritePositionsFilePath(QString path)
Definition: cxVBcameraPath.cpp:181
cx::CXVBcameraPath::cameraPathPositionSlot
void cameraPathPositionSlot(int positionPermillage)
Definition: cxVBcameraPath.cpp:100
cx::CXVBcameraPath::cameraViewAngleSlot
void cameraViewAngleSlot(int angle)
Definition: cxVBcameraPath.cpp:252