CustusX  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXLANDMARKREP_H_
34 #define CXLANDMARKREP_H_
35 
36 #include "cxResourceVisualizationExport.h"
37 
38 #include "cxRepImpl.h"
39 
40 #include <map>
41 #include <QColor>
42 #include "cxImage.h"
43 #include "vtkForwardDeclarations.h"
44 #include "cxGraphicalPrimitives.h"
45 #include "cxLandmark.h"
46 
47 namespace cx
48 {
49 class View;
50 }
51 
52 namespace cx
53 {
54 class Reporter;
55 typedef boost::shared_ptr<class LandmarkRep> LandmarkRepPtr;
56 
62 class cxResourceVisualization_EXPORT LandmarksSource: public QObject
63 {
64 Q_OBJECT
65 public:
66  virtual ~LandmarksSource() {}
67  virtual LandmarkMap getLandmarks() const = 0;
68  virtual Transform3D get_rMl() const = 0;
69  virtual Vector3D getTextPos(Vector3D p_l) const = 0;signals:
70  void changed();
71 };
72 typedef boost::shared_ptr<LandmarksSource> LandmarksSourcePtr;
73 
74 typedef boost::shared_ptr<class PatientLandmarksSource> PatientLandmarksSourcePtr;
75 
76 class cxResourceVisualization_EXPORT PatientLandmarksSource: public LandmarksSource
77 {
78 public:
82  virtual LandmarkMap getLandmarks() const;
83  virtual Transform3D get_rMl() const;
84  virtual Vector3D getTextPos(Vector3D p_l) const;
85 private:
86  PatientModelServicePtr mDataManager;
87 };
88 
89 typedef boost::shared_ptr<class ImageLandmarksSource> ImageLandmarksSourcePtr;
90 
91 class cxResourceVisualization_EXPORT ImageLandmarksSource: public LandmarksSource
92 {
93 public:
95  {
97  }
99  virtual ~ImageLandmarksSource() {}
100  virtual LandmarkMap getLandmarks() const;
101  virtual Transform3D get_rMl() const;
102  virtual Vector3D getTextPos(Vector3D p_l) const;
103 
104  void setData(DataPtr image);
105  DataPtr getData();
106 private:
107  DataPtr mData;
108 };
109 
119 class cxResourceVisualization_EXPORT LandmarkRep: public RepImpl
120 {
121 Q_OBJECT
122 public:
123  static LandmarkRepPtr New(PatientModelServicePtr dataManager, const QString& uid = "");
124  virtual ~LandmarkRep();
125 
126  void setColor(QColor color);
127  void setSecondaryColor(QColor color);
128  void showLandmarks(bool on);
129  void setGraphicsSize(double size);
130  void setLabelSize(double size);
131  virtual QString getType() const { return "LandmarkRep"; }
132 
133  void setPrimarySource(LandmarksSourcePtr primary);
134  void setSecondarySource(LandmarksSourcePtr secondary);
135 
136 protected:
137  LandmarkRep(PatientModelServicePtr dataManager);
138  virtual void addRepActorsToViewRenderer(ViewPtr view);
139  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
140  void clearAll();
141  void addAll();
142  void addLandmark(QString uid);
143 
144 protected slots:
145  void internalUpdate();
146 
147 protected:
148  QColor mInactiveColor;
149  QColor mColor;
153  double mLabelSize;
154 
156  {
161  };
162  typedef std::map<QString, LandmarkGraphics> LandmarkGraphicsMapType;
165  void rescale();
166 
169 
171 
172 private:
173  LandmarkRep();
174 };
175 
179 } //namespace cx
180 
181 #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:94
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
LandmarksSourcePtr mSecondary
virtual ~LandmarksSource()
Definition: cxLandmarkRep.h:66
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:74
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:79
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
GraphicalLine3DPtr mLine
line between primary and secondary point
Default implementation of Rep.
Definition: cxRepImpl.h:63
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:63
FollowerText3DPtr mText
name of landmark, attached to primary point
boost::shared_ptr< FollowerText3D > FollowerText3DPtr
boost::shared_ptr< LandmarksSource > LandmarksSourcePtr
Definition: cxLandmarkRep.h:72
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