Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
FrameOfReference.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 FRAMEOFREFERENCE_H
27#define FRAMEOFREFERENCE_H
28
29// -- Core stuff
30#include "CamiTKAPI.h"
33
34#include <QString>
35#include <QUuid>
36#include <QColor>
37#include <QPair>
38
39namespace camitk {
40
41class TransformationManager;
42
49using Unit = QString;
50
72
73private:
74
77
86
91 explicit FrameOfReference(QString name, QString description = "");
92
97 FrameOfReference(QUuid uuid, QString name, QString description, int numberOfDimensions, const AnatomicalOrientation& ao, std::vector<Unit>& units);
98
100 explicit FrameOfReference(const FrameOfReference&);
101
107 bool resetUuid(QUuid newId);
108
109public:
113 const AnatomicalOrientation& getAnatomicalOrientation() const;
114
118 AnatomicalOrientation& getAnatomicalOrientation();
119
123 void setAnatomicalOrientation(const AnatomicalOrientation& anatomicalOrientation);
124
132 void setAnatomicalOrientation(QString threeLetterCode);
133
137 int getNumberOfDimensions() const;
138
146 void setNumberOfDimensions(int numberOfDimensions);
147
149 Unit getUnit(int dimension);
150
155 void setUnit(int dimension, Unit u);
156
160 QString getName() const;
161
167 void setName(QString name);
168
173 QString getDescription() const;
174
179 void setDescription(QString desc);
180
185 const QColor& getColor();
186
190 void setColor(const QColor& color);
191
198 QString getAnatomicalOrientationLabel(int axis, bool minDirection) const;
199
204 bool operator==(const FrameOfReference& b) const;
205
210 bool operator!=(const FrameOfReference& b) const;
211
214
217 QVariant toVariant() const override;
218
222 void fromVariant(const QVariant& variant) override;
223
228 bool setUuid(QUuid newId) override;
229
233 QUuid getUuid() const override;
235
240 int getIndex();
241
242
243private:
245 AnatomicalOrientation anatomicalOrientation;
246
248 std::vector<Unit> units = {"mm", "mm", "mm", "s", ""};
249
251 int numberOfDimensions = 3;
252
254 QUuid uuid;
255
258 int index;
259
261 QString name;
262
264 QString description;
265
270 QColor color;
271
272 // init color and index (only when required, i.e. in getIndex()/getColor() and not during initialization)
273 void init();
274
276 static QPair<QColor, int> getNextColorAndIndex();
277};
278
279// -------------------- getAnatomicalOrientation --------------------
281 return anatomicalOrientation;
282};
283
285 return anatomicalOrientation;
286};
287
288// -------------------- setAnatomicalOrientation --------------------
289inline void FrameOfReference::setAnatomicalOrientation(const AnatomicalOrientation& anatomicalOrientation) {
290 this->anatomicalOrientation = anatomicalOrientation;
291}
292
293// -------------------- setAnatomicalOrientation --------------------
294inline void FrameOfReference::setAnatomicalOrientation(QString threeLetterCode) {
295 anatomicalOrientation.setOrientation(threeLetterCode);
296}
297
298// -------------------- getNumberOfDimensions --------------------
300 return numberOfDimensions;
301}
302
303// -------------------- getName --------------------
304inline QString FrameOfReference::getName() const {
305 return name;
306}
307
308// -------------------- setName --------------------
309inline void FrameOfReference::setName(QString name) {
310 this->name = name;
311}
312
313// -------------------- getDescription --------------------
314inline QString FrameOfReference::getDescription() const {
315 return description;
316}
317
318// -------------------- setDescription --------------------
319inline void FrameOfReference::setDescription(QString desc) {
320 description = desc;
321}
322
323// -------------------- getAnatomicalOrientationLabel --------------------
324inline QString FrameOfReference::getAnatomicalOrientationLabel(int axis, bool minDirection) const {
325 return anatomicalOrientation.getLabel(axis, minDirection);
326}
327
328// -------------------- operator== --------------------
330 return this->getUuid() == b.getUuid();
331}
332
333// -------------------- operator!= --------------------
335 return this->getUuid() != b.getUuid();
336}
337
338// -------------------- getUuid --------------------
339inline QUuid FrameOfReference::getUuid() const {
340 return uuid;
341}
342
343}
344
345#endif // FRAMEOFREFERENCE_H
#define CAMITK_API
Definition CamiTKAPI.h:66
const char * description
Definition applications/cepgenerator/main.cpp:38
Class that defines the unit of the Load.
Definition Unit.h:46
AnatomicalOrientation describes the relationship between 3D axes of a FrameOfReference and medical im...
Definition AnatomicalOrientation.h:83
QString getLabel(int axis, bool minDirection) const
Returns the label of the corresponding axis/direction (or empty string if there is no label)
Definition AnatomicalOrientation.h:291
void setOrientation(QString threeLetterCode)
Sets the orientation using the standard 3-letter code.
Definition AnatomicalOrientation.h:129
FrameOfReference is only a label for an abstract coordinate system.
Definition FrameOfReference.h:71
void setDescription(QString desc)
Set the description of the FrameOfReference.
Definition FrameOfReference.h:319
bool operator==(const FrameOfReference &b) const
Equality operator.
Definition FrameOfReference.h:329
void setAnatomicalOrientation(const AnatomicalOrientation &anatomicalOrientation)
Set anatomical orientation information.
Definition FrameOfReference.h:289
QString getName() const
Get the FrameOfReference name.
Definition FrameOfReference.h:304
bool operator!=(const FrameOfReference &b) const
Difference operator.
Definition FrameOfReference.h:334
void setName(QString name)
Set the name of the FrameOfReference Should be a short string, use setDescription if you want to stor...
Definition FrameOfReference.h:309
QUuid getUuid() const override
Get the unique identifier of the Frame.
Definition FrameOfReference.h:339
QString getAnatomicalOrientationLabel(int axis, bool minDirection) const
Get the Anatomical orientation label of the corresponding axis/direction (or empty string if there is...
Definition FrameOfReference.h:324
int getNumberOfDimensions() const
Get the number of dimensions of this FrameOfReference.
Definition FrameOfReference.h:299
QString getDescription() const
Get the description of the FrameOfReference.
Definition FrameOfReference.h:314
const AnatomicalOrientation & getAnatomicalOrientation() const
Get the anatomical information of the Frame.
Definition FrameOfReference.h:280
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
Definition Action.cpp:40