Computer Assisted Medical Intervention Tool Kit  version 5.2
Frame.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 #ifndef FRAME_H
26 #define FRAME_H
27 
28 #include "CamiTKAPI.h"
29 
30 #include "InterfaceFrame.h"
31 
32 class vtkTransformPolyDataFilter;
33 class vtkAxesActor;
34 
35 namespace camitk {
53 public:
60  Frame(vtkSmartPointer<vtkTransform> transform = nullptr, Frame* parentFrame = nullptr);
61 
63  ~Frame() override;
64 
70  const QString& getFrameName() const override final;
71 
73  void setFrameName(QString name) override;
74 
76  InterfaceFrame* getParentFrame() const override;
77 
89  void setParentFrame(InterfaceFrame* parent, bool keepTransform = true) override final;
90 
95  const QVector<InterfaceFrame*>& getChildrenFrame() const override;
103  const vtkSmartPointer<vtkTransform> getTransformFromWorld() const override;
104 
106  const vtkSmartPointer<vtkTransform> getTransform() const override;
107 
109  const vtkSmartPointer<vtkTransform> getTransformFromFrame(InterfaceFrame* frame) const override;
110 
115  void setTransform(vtkSmartPointer<vtkTransform> transform) override final;
116 
121  void resetTransform() override;
122 
126  void translate(double x, double y, double z) override;
127 
133  void rotate(double aroundX, double aroundY, double aroundZ) override;
134 
139  void rotateVTK(double aroundX, double aroundY, double aroundZ) override;
140 
146  void setTransformTranslation(double x, double y, double z) override;
147 
154  void setTransformTranslationVTK(double x, double y, double z) override;
155 
161  void setTransformRotation(double aroundX, double aroundY, double aroundZ) override;
162 
169  void setTransformRotationVTK(double aroundX, double aroundY, double aroundZ) override;
170 
176  vtkSmartPointer<vtkAxesActor> getFrameAxisActor() override;
177 
179 
189  CAMITK_API_DEPRECATED("Please use Frame::setFrameVisibility(QString viewerName, bool) instead") void setFrameVisibility(Viewer*, bool) override;
190 
194  CAMITK_API_DEPRECATED("Please use Frame::getFrameVisibility(QString viewerName, bool) instead") bool getFrameVisibility(Viewer*) const override;
196 
200  void setFrameVisibility(QString, bool) override;
201 
205  bool getFrameVisibility(QString) const override;
206 
211  void removeFrameChild(InterfaceFrame* frame) override final;
212 
215  void initAttributes();
217 
218 protected:
219 
223  QString frameName;
224 
230 
235  vtkSmartPointer<vtkTransform> transformParentToMe;
236 
244  vtkSmartPointer<vtkTransform> transformWorldToMe;
245 
249  vtkSmartPointer<vtkTransformPolyDataFilter> representationTransformFilter;
250 
254  QVector<InterfaceFrame*> childrenFrame;
255 
259  QVector<InterfaceFrame*> computeDescendants(InterfaceFrame*);
260 
261 private:
262 
264  void addFrameChild(InterfaceFrame* frame) override;
265 
267  static int nbTotalFrames;
268 
270  vtkSmartPointer<vtkAxesActor> axes;
271 
273  QMap<Viewer*, bool> frameViewers;
274 
275 };
276 }
277 #endif // FRAME_H
#define CAMITK_API_DEPRECATED(X)
Definition: CamiTKAPI.h:94
#define CAMITK_API
Definition: CamiTKAPI.h:49
Represents a hierarchy of frames.
Definition: Frame.h:52
vtkSmartPointer< vtkTransformPolyDataFilter > representationTransformFilter
Transform Filter to store the transformation for the Frame's 3D representation.
Definition: Frame.h:249
vtkSmartPointer< vtkTransform > transformWorldToMe
Transformation to represent my points (expressed in my frame) in the world's frame.
Definition: Frame.h:244
InterfaceFrame * parentFrame
The Parent Frame.
Definition: Frame.h:229
vtkSmartPointer< vtkTransform > transformParentToMe
Transformation to represent my points (expressed in my frame) in my parent's frame.
Definition: Frame.h:235
QString frameName
Frame unique identifier.
Definition: Frame.h:223
QVector< InterfaceFrame * > childrenFrame
List of children Frames to keep track of Frame hierarchy.
Definition: Frame.h:254
This class describes what are the methods to implement in order to manage a Component position in spa...
Definition: InterfaceFrame.h:64
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:181
Definition: Action.cpp:36
vtkSmartPointer< vtkTransform > transform
Definition: RendererWidget.cpp:416
axes
axes actor
Definition: RendererWidget.cpp:364