Computer Assited Medical Intervention Tool Kit  version 4.1
Frame.h
Go to the documentation of this file.
1 #ifndef FRAME_H
2 #define FRAME_H
3 
4 #include "CamiTKAPI.h"
5 
6 #include "InterfaceFrame.h"
7 #include <QObject>
8 
9 
10 class vtkTransformPolyDataFilter;
11 class vtkAxesActor;
12 
13 namespace camitk {
31 
32 
33 public:
41  Frame(vtkSmartPointer<vtkTransform> transform = nullptr, Frame* parentFrame = nullptr);
42 
44  ~Frame() override;
45 
50  const QString& getFrameName() const override;
52 
54  void setFrameName(QString name) override;
55 
57  InterfaceFrame* getParentFrame() const override;
58 
70  void setParentFrame(InterfaceFrame* parent, bool keepTransform = true) override;
71 
76  const QVector<InterfaceFrame*>& getChildrenFrame() const override;
83  const vtkSmartPointer<vtkTransform> getTransformFromWorld() const override;
85 
87  const vtkSmartPointer<vtkTransform> getTransform() const override;
88 
90  const vtkSmartPointer<vtkTransform> getTransformFromFrame(InterfaceFrame* frame) const override;
91 
96  void setTransform(vtkSmartPointer<vtkTransform> transform) override;
97 
102  void resetTransform() override;
103 
107  void translate(double x, double y, double z) override;
108 
114  void rotate(double aroundX, double aroundY, double aroundZ) override;
115 
120  void rotateVTK(double aroundX, double aroundY, double aroundZ) override;
121 
127  void setTransformTranslation(double x, double y, double z) override;
128 
135  void setTransformTranslationVTK(double x, double y, double z) override;
136 
142  void setTransformRotation(double aroundX, double aroundY, double aroundZ) override;
143 
150  void setTransformRotationVTK(double aroundX, double aroundY, double aroundZ) override;
151 
157  vtkSmartPointer<vtkAxesActor> getFrameAxisActor() override;
158 
162  void setFrameVisibility(Viewer* viewer, bool visible) override;
163 
167  bool getFrameVisibility(Viewer* viewer) const override;
168 
173  void removeFrameChild(InterfaceFrame* frame) override;
174 
177  void initAttributes();
179 
180 protected:
181 
185  QString frameName;
186 
192 
197  vtkSmartPointer<vtkTransform> transformParentToMe;
198 
206  vtkSmartPointer<vtkTransform> transformWorldToMe;
207 
211  vtkSmartPointer<vtkTransformPolyDataFilter> representationTransformFilter;
212 
216  QVector<InterfaceFrame*> childrenFrame;
217 
221  QVector<InterfaceFrame*> computeDescendants(InterfaceFrame*);
222 
223 private:
224 
226  void addFrameChild(InterfaceFrame* frame) override;
227 
229  static int nbTotalFrames;
230 
232  vtkSmartPointer<vtkAxesActor> axes;
233 
235  QMap<Viewer*, bool> frameViewers;
236 
237 };
238 }
239 #endif // FRAME_H
camitk::Frame::getParentFrame
InterfaceFrame * getParentFrame() const override
Get the parent frame.
Definition: Frame.cpp:108
camitk::Frame::initAttributes
void initAttributes()
Definition: Frame.cpp:57
camitk::Frame::translate
void translate(double x, double y, double z) override
Apply a translation relative to the current position.
Definition: Frame.cpp:238
camitk::Frame::nbTotalFrames
static int nbTotalFrames
To be able to give a default unique identifier to each created frame.
Definition: Frame.h:229
camitk::Frame::getChildrenFrame
const QVector< InterfaceFrame * > & getChildrenFrame() const override
Get the Children Frames from the current Frame in the Frame Hierarchy The Frame hierarchy may not be ...
Definition: Frame.cpp:113
camitk::Frame::Frame
Frame(vtkSmartPointer< vtkTransform > transform=nullptr, Frame *parentFrame=nullptr)
Definition: Frame.cpp:34
camitk::InterfaceFrame::removeFrameChild
virtual void removeFrameChild(InterfaceFrame *frame)=0
Remove the input frame as a child of the current frame.
camitk::Frame::setTransform
void setTransform(vtkSmartPointer< vtkTransform > transform) override
Set the current input frame position (according to its parent Frame)
Definition: Frame.cpp:222
camitk::Frame::computeDescendants
QVector< InterfaceFrame * > computeDescendants(InterfaceFrame *)
Compute all the descendants of the input frame.
Definition: Frame.cpp:419
CamiTKAPI.h
camitk::Frame::frameName
QString frameName
Frame unique identifier.
Definition: Frame.h:185
camitk::Frame::removeFrameChild
void removeFrameChild(InterfaceFrame *frame) override
If the parent frame keeps track of its children, when a child is deleted it should warn its parent.
Definition: Frame.cpp:176
camitk::Frame::setParentFrame
void setParentFrame(InterfaceFrame *parent, bool keepTransform=true) override
Set the parent frame to the parameter frame.
Definition: Frame.cpp:118
camitk::Frame::getTransformFromFrame
const vtkSmartPointer< vtkTransform > getTransformFromFrame(InterfaceFrame *frame) const override
Get a COPY of the transformation with respect to another frame.
Definition: Frame.cpp:193
camitk::Frame::transformParentToMe
vtkSmartPointer< vtkTransform > transformParentToMe
Transformation to represent my points (expressed in my frame) in my parent's frame.
Definition: Frame.h:197
camitk::Frame::setFrameVisibility
void setFrameVisibility(Viewer *viewer, bool visible) override
Set the Component Frame visible for a given viewer.
Definition: Frame.cpp:394
camitk::Frame::representationTransformFilter
vtkSmartPointer< vtkTransformPolyDataFilter > representationTransformFilter
Transform Filter to store the transformation for the Frame's 3D representation.
Definition: Frame.h:211
camitk::Frame::axes
vtkSmartPointer< vtkAxesActor > axes
Geometric representation of the frame (vtkAxes)
Definition: Frame.h:232
camitk::InterfaceFrame::getChildrenFrame
virtual const QVector< InterfaceFrame * > & getChildrenFrame() const =0
Get the Children Frames from the current Frame in the Frame Hierarchy The Frame hierarchy may not be ...
camitk::Frame::setFrameName
void setFrameName(QString name) override
Set the Frame Unique identifyer.
Definition: Frame.cpp:103
camitk::Frame::setTransformRotation
void setTransformRotation(double aroundX, double aroundY, double aroundZ) override
Set the rotation part of the 3D space transformation of the current frame.
Definition: Frame.cpp:315
camitk::Frame::setTransformTranslation
void setTransformTranslation(double x, double y, double z) override
Set the translation part of the 3D space transformation of the current frame.
Definition: Frame.cpp:283
camitk::Frame::resetTransform
void resetTransform() override
Set the current frame transform to identity.
Definition: Frame.cpp:230
camitk::InterfaceFrame::getTransformFromWorld
virtual const vtkSmartPointer< vtkTransform > getTransformFromWorld() const =0
Transforms accessors / Modifyers.
camitk::Frame::~Frame
~Frame() override
Default Destructor.
Definition: Frame.cpp:80
camitk::Frame::setTransformTranslationVTK
void setTransformTranslationVTK(double x, double y, double z) override
Set the translation part of the 3D space transformation of the current frame.
Definition: Frame.cpp:299
camitk::InterfaceFrame::addFrameChild
virtual void addFrameChild(InterfaceFrame *frame)=0
Add the input frame as a child of the current frame.
camitk::InterfaceFrame::getFrameName
virtual const QString & getFrameName() const =0
Hierarchy accessors / Modifyers.
camitk::Frame::getTransform
const vtkSmartPointer< vtkTransform > getTransform() const override
Get a the transformation with respect to the parent frame.
Definition: Frame.cpp:188
camitk::axeYTextProp
vtkSmartPointer< vtkTextProperty > axeYTextProp
Definition: RendererWidget.cpp:561
InterfaceFrame.h
camitk::Frame::addFrameChild
void addFrameChild(InterfaceFrame *frame) override
When the current Frame is set to parent, it must update its children list.
Definition: Frame.cpp:170
camitk::Frame::rotate
void rotate(double aroundX, double aroundY, double aroundZ) override
Apply rotations relative to the current position in the alphabetical order (X, Y, Z).
Definition: Frame.cpp:247
camitk::Frame::getFrameVisibility
bool getFrameVisibility(Viewer *viewer) const override
Get the Component Frame visibility for a given viewer.
Definition: Frame.cpp:407
camitk::Frame
Represents a hierarchy of frames.
Definition: Frame.h:30
camitk::axeZTextProp
vtkSmartPointer< vtkTextProperty > axeZTextProp
Definition: RendererWidget.cpp:568
Frame.h
camitk::InterfaceFrame
This class describes what are the methods to implement in order to manage a Component position in spa...
Definition: InterfaceFrame.h:63
camitk::InterfaceFrame::setParentFrame
virtual void setParentFrame(InterfaceFrame *parent, bool keepTransform=true)=0
Set the parent frame and update or not its transform during the parent transition.
camitk::transform
vtkSmartPointer< vtkTransform > transform
Definition: RendererWidget.cpp:593
camitk::Frame::rotateVTK
void rotateVTK(double aroundX, double aroundY, double aroundZ) override
Apply a rotation relative to the current position, using the VTK rotation order (Z,...
Definition: Frame.cpp:265
camitk::Frame::getTransformFromWorld
const vtkSmartPointer< vtkTransform > getTransformFromWorld() const override
Transforms accessors / Modifyers.
Definition: Frame.cpp:183
camitk::axeXTextProp
vtkSmartPointer< vtkTextProperty > axeXTextProp
Definition: RendererWidget.cpp:547
camitk::Viewer
Viewer is an abstract viewer.
Definition: Viewer.h:54
camitk::Frame::childrenFrame
QVector< InterfaceFrame * > childrenFrame
List of children Frames to keep track of Frame hierarchy.
Definition: Frame.h:216
Viewer.h
camitk::Frame::setTransformRotationVTK
void setTransformRotationVTK(double aroundX, double aroundY, double aroundZ) override
Set the rotation part of the 3D space transformation of the current frame.
Definition: Frame.cpp:331
camitk::Frame::frameViewers
QMap< Viewer *, bool > frameViewers
List of Viewers in which the frame is visible.
Definition: Frame.h:235
camitk::Frame::getFrameName
const QString & getFrameName() const override
Hierarchy accessors / Modifyers.
Definition: Frame.cpp:98
camitk::Frame::parentFrame
InterfaceFrame * parentFrame
The Parent Frame.
Definition: Frame.h:191
camitk::Frame::getFrameAxisActor
vtkSmartPointer< vtkAxesActor > getFrameAxisActor() override
Gives the 3D representation of the frame (based on xyd arrows)
Definition: Frame.cpp:349
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:48
camitk
Definition: Action.cpp:36
camitk::Frame::transformWorldToMe
vtkSmartPointer< vtkTransform > transformWorldToMe
Transformation to represent my points (expressed in my frame) in the world's frame.
Definition: Frame.h:206