Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
Transformation.h
Go to the documentation of this file.
1/*****************************************************************************
2 * $CAMITK_LICENCE_BEGIN$
3 *
4 * CamiTK - Computer Assisted Medical Intervention ToolKit
5 * (c) 2001-2025 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
26#ifndef CAMITK_TRANSFORMATION_H
27#define CAMITK_TRANSFORMATION_H
28
29// -- Core stuff
30#include "CamiTKAPI.h"
32
33// -- Qt stuff
34#include <QString>
35#include <QUuid>
36
37// -- VTK stuff
38#include <vtkMatrix4x4.h>
39#include <vtkAbstractTransform.h>
40#include <vtkTransform.h>
41#include <vtkSmartPointer.h>
42
43#include <memory>
44
45namespace camitk {
46
47class TransformationManager;
48class FrameOfReference;
49
84
85private:
88
92 Transformation(const std::shared_ptr<FrameOfReference>& from, const std::shared_ptr<FrameOfReference>& to, QUuid id = QUuid::createUuid());
93
97 Transformation(const std::shared_ptr<FrameOfReference>& from, const std::shared_ptr<FrameOfReference>& to, vtkSmartPointer<vtkTransform> tr, QUuid id = QUuid::createUuid());
98
104 void setMatrix(vtkSmartPointer<vtkMatrix4x4> m);
105
106public:
107
120 vtkSmartPointer<vtkTransform> getTransform() const;
121
134 vtkMatrix4x4* getMatrix() const;
135
139 QString getName() const;
140
144 void setName(QString n);
145
150 QString getDescription() const;
151
156 void setDescription(QString desc);
157
161 const FrameOfReference* getFrom() const;
162
166 const FrameOfReference* getTo() const;
167
170
173 QVariant toVariant() const override;
174
178 void fromVariant(const QVariant& v) override;
179
183 QUuid getUuid() const override;
184
190 bool setUuid(QUuid id) override;
191
193
194private:
195
202 Transformation* getInverse();
203
210 void setTransform(vtkSmartPointer<vtkTransform> tr);
211
215 void setTo(const std::shared_ptr<FrameOfReference>& f);
216
220 void setFrom(const std::shared_ptr<FrameOfReference>& f);
221
222private:
223
225 QUuid uuid;
226
228 QString name;
229
231 QString description;
232
234 bool inversible;
235
237 vtkSmartPointer<vtkTransform> transform;
238
240 std::shared_ptr<FrameOfReference> from;
241
243 std::shared_ptr<FrameOfReference> to;
244};
245
246// -------------------- getTransform --------------------
247inline vtkSmartPointer<vtkTransform> Transformation::getTransform() const {
248 return transform;
249}
250
251// -------------------- setName --------------------
252inline void Transformation::setName(QString n) {
253 name = n;
254}
255
256// -------------------- getDescription --------------------
257inline QString Transformation::getDescription() const {
258 return description;
259}
260
261// -------------------- setDescription --------------------
262inline void Transformation::setDescription(QString desc) {
263 description = desc;
264}
265
266// -------------------- getUuid --------------------
267inline QUuid Transformation::getUuid() const {
268 return uuid;
269};
270
271// -------------------- getFrom --------------------
273 return from.get();
274}
275
276// -------------------- setFrom --------------------
277inline void Transformation::setFrom(const std::shared_ptr<FrameOfReference>& f) {
278 from = f;
279}
280
281// -------------------- getTo --------------------
283 return to.get();
284}
285
286// -------------------- setTo --------------------
287inline void Transformation::setTo(const std::shared_ptr<FrameOfReference>& f) {
288 to = f;
289}
290
291
292} // namespace camitk
293
294#endif // CAMITK_TRANSFORMATION_H
#define CAMITK_API
Definition CamiTKAPI.h:66
const char * description
Definition applications/cepgenerator/main.cpp:38
FrameOfReference is only a label for an abstract coordinate system.
Definition FrameOfReference.h:71
Interface for all objects that should be serialized by the PersistenceManager.
Definition InterfacePersistence.h:38
TransformationManager manages frames of reference and transformations for a CamiTK Application.
Definition TransformationManager.h:235
Transformation represents a geometrical transformation between two FrameOfReferences.
Definition Transformation.h:83
void setName(QString n)
Set the name of the Transformation.
Definition Transformation.h:252
QString getDescription() const
Get the description of the Transformation Description is used to provide more information than the na...
Definition Transformation.h:257
const FrameOfReference * getFrom() const
Get the FrameOfReference the Transformation starts from (origin)
Definition Transformation.h:272
QUuid getUuid() const override
Get the unique identifier of this Transformation.
Definition Transformation.h:267
vtkSmartPointer< vtkTransform > getTransform() const
Get the internal vtkTransform (linear transformation) or a nullptr.
Definition Transformation.h:247
void setDescription(QString desc)
Set the description of the Transformation Description is used to provide more information than the na...
Definition Transformation.h:262
const FrameOfReference * getTo() const
Get the FrameOfReference that the Transformation goes to (destination)
Definition Transformation.h:282
Definition Action.cpp:40