Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxLandmarkRep.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 CXLANDMARKREP_H_
13 #define CXLANDMARKREP_H_
14 
15 #include "cxResourceVisualizationExport.h"
16 
17 #include "cxRepImpl.h"
18 
19 #include <map>
20 #include <QColor>
21 #include "cxImage.h"
22 #include "vtkForwardDeclarations.h"
23 #include "cxGraphicalPrimitives.h"
24 #include "cxLandmark.h"
25 
26 namespace cx
27 {
28 class View;
29 }
30 
31 namespace cx
32 {
33 class Reporter;
34 typedef boost::shared_ptr<class LandmarkRep> LandmarkRepPtr;
35 
41 class cxResourceVisualization_EXPORT LandmarksSource: public QObject
42 {
43 Q_OBJECT
44 public:
45  virtual ~LandmarksSource() {}
46  virtual LandmarkMap getLandmarks() const = 0;
47  virtual Transform3D get_rMl() const = 0;
48  virtual Vector3D getTextPos(Vector3D p_l) const = 0;signals:
49  void changed();
50 };
51 typedef boost::shared_ptr<LandmarksSource> LandmarksSourcePtr;
52 
53 typedef boost::shared_ptr<class PatientLandmarksSource> PatientLandmarksSourcePtr;
54 
55 class cxResourceVisualization_EXPORT PatientLandmarksSource: public LandmarksSource
56 {
57 public:
58  static PatientLandmarksSourcePtr New(PatientModelServicePtr dataManager) { return PatientLandmarksSourcePtr(new PatientLandmarksSource(dataManager)); }
61  virtual LandmarkMap getLandmarks() const;
62  virtual Transform3D get_rMl() const;
63  virtual Vector3D getTextPos(Vector3D p_l) const;
64 private:
65  PatientModelServicePtr mDataManager;
66 };
67 
68 typedef boost::shared_ptr<class ImageLandmarksSource> ImageLandmarksSourcePtr;
69 
70 class cxResourceVisualization_EXPORT ImageLandmarksSource: public LandmarksSource
71 {
72 public:
73  static ImageLandmarksSourcePtr New()
74  {
76  }
78  virtual ~ImageLandmarksSource() {}
79  virtual LandmarkMap getLandmarks() const;
80  virtual Transform3D get_rMl() const;
81  virtual Vector3D getTextPos(Vector3D p_l) const;
82 
83  void setData(DataPtr image);
84  DataPtr getData();
85 private:
86  DataPtr mData;
87 };
88 
98 class cxResourceVisualization_EXPORT LandmarkRep: public RepImpl
99 {
100 Q_OBJECT
101 public:
102  static LandmarkRepPtr New(PatientModelServicePtr dataManager, const QString& uid = "");
103  virtual ~LandmarkRep();
104 
105  void setColor(QColor color);
106  void setSecondaryColor(QColor color);
107  void showLandmarks(bool on);
108  void setGraphicsSize(double size);
109  void setLabelSize(double size);
110  virtual QString getType() const { return "LandmarkRep"; }
111 
112  void setPrimarySource(LandmarksSourcePtr primary);
113  void setSecondarySource(LandmarksSourcePtr secondary);
114 
115 protected:
116  LandmarkRep(PatientModelServicePtr dataManager);
117  virtual void addRepActorsToViewRenderer(ViewPtr view);
118  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
119  void clearAll();
120  void addAll();
121  void addLandmark(QString uid);
122 
123 protected slots:
124  void internalUpdate();
125 
126 protected:
127  QColor mInactiveColor;
128  QColor mColor;
132  double mLabelSize;
133 
135  {
140  };
141  typedef std::map<QString, LandmarkGraphics> LandmarkGraphicsMapType;
142  LandmarkGraphicsMapType mGraphics;
144  void rescale();
145 
146  LandmarksSourcePtr mPrimary;
147  LandmarksSourcePtr mSecondary;
148 
150 
151 private:
152  LandmarkRep();
153 };
154 
158 } //namespace cx
159 
160 #endif /* CXLANDMARKREP_H_ */
bool mShowLandmarks
whether or not the actors should be showed in (all) views
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
static ImageLandmarksSourcePtr New()
Definition: cxLandmarkRep.h:73
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
LandmarksSourcePtr mSecondary
virtual ~LandmarksSource()
Definition: cxLandmarkRep.h:45
virtual QString getType() const
boost::shared_ptr< class View > ViewPtr
std::map< QString, LandmarkGraphics > LandmarkGraphicsMapType
ViewportListenerPtr mViewportListener
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class PatientLandmarksSource > PatientLandmarksSourcePtr
Definition: cxLandmarkRep.h:53
QColor mSecondaryColor
color used on the secondary coordinate
QColor mInactiveColor
color given to inactive landmarks
LandmarksSourcePtr mPrimary
static PatientLandmarksSourcePtr New(PatientModelServicePtr dataManager)
Definition: cxLandmarkRep.h:58
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
GraphicalLine3DPtr mLine
line between primary and secondary point
Default implementation of Rep.
Definition: cxRepImpl.h:42
GraphicalPoint3DPtr mPrimaryPoint
the primary coordinate of the landmark
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
FollowerText3DPtr mText
name of landmark, attached to primary point
boost::shared_ptr< FollowerText3D > FollowerText3DPtr
boost::shared_ptr< LandmarksSource > LandmarksSourcePtr
Definition: cxLandmarkRep.h:51
std::map< QString, class Landmark > LandmarkMap
QColor mColor
the color of the landmark actors
LandmarkGraphicsMapType mGraphics
boost::shared_ptr< class GraphicalLine3D > GraphicalLine3DPtr
GraphicalPoint3DPtr mSecondaryPoint
secondary landmark coordinate, accosiated with the primary point
PatientModelServicePtr mDataManager
boost::shared_ptr< class LandmarkRep > LandmarkRepPtr
boost::shared_ptr< class ImageLandmarksSource > ImageLandmarksSourcePtr
Namespace for all CustusX production code.