My Project
rot.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef mia_3d_rot_hh
22 #define mia_3d_rot_hh
23 
24 #include <mia/core/attributes.hh>
25 #include <mia/3d/quaternion.hh>
26 #include <mia/3d/matrix.hh>
27 
29 
31 {
32 public:
33  C3DRotation();
34  ~C3DRotation();
35 
36  C3DRotation(const C3DRotation& other);
37  C3DRotation& operator = (const C3DRotation& other);
38 
39  C3DRotation(const C3DDMatrix& m);
40  C3DRotation(const Quaternion& q);
41  C3DRotation(const std::string& s);
42 
43  C3DDMatrix as_matrix_3x3() const;
44  Quaternion as_quaternion() const;
45  std::string as_string() const;
46 
47  static const C3DRotation _1;
48 
49 private:
50  class C3DRotationImpl *impl;
51 };
52 
53 
54 
55 
56 template <>
58  static const int value = 0x4000;
59 };
60 
61 template <>
62 struct dispatch_attr_string<C3DRotation> {
63  static std::string val2string(const C3DRotation& value)
64  {
65  return value.as_string();
66  }
67  static C3DRotation string2val(const std::string& str)
68  {
69  return C3DRotation(str);
70  }
71 };
72 
73 
74 EXPORT_3D bool operator == (const C3DRotation& lhs, const C3DRotation& rhs);
75 EXPORT_3D bool operator < (const C3DRotation& lhs, const C3DRotation& rhs);
76 
79 
81 #endif
C3DRotation::as_string
std::string as_string() const
C3DRotationAttributeTranslate
TTranslator< C3DRotation > C3DRotationAttributeTranslate
Definition: rot.hh:78
T3DMatrix
a simple 3x3 matrix
Definition: 3d/matrix.hh:45
C3DRotationAttribute
TAttribute< C3DRotation > C3DRotationAttribute
Definition: rot.hh:77
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
dispatch_attr_string< C3DRotation >::val2string
static std::string val2string(const C3DRotation &value)
Definition: rot.hh:63
attribute_type
Definition: attributetype.hh:64
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
C3DRotation::_1
static const C3DRotation _1
Definition: rot.hh:47
quaternion.hh
TAttribute
Class of an attribute that holds data of type T.
Definition: attributes.hh:118
dispatch_attr_string< C3DRotation >::string2val
static C3DRotation string2val(const std::string &str)
Definition: rot.hh:67
attributes.hh
EXPORT_3D
#define EXPORT_3D
Definition: defines3d.hh:45
matrix.hh
Quaternion
a class to implement a quaternion
Definition: quaternion.hh:43
operator==
EXPORT_3D bool operator==(const C3DRotation &lhs, const C3DRotation &rhs)
operator<
EXPORT_3D bool operator<(const C3DRotation &lhs, const C3DRotation &rhs)
C3DRotation
Definition: rot.hh:30
TTranslator
Generic string vs. attribute translator singleton.
Definition: attributes.hh:517
attribute_type::value
static const int value
Definition: attributetype.hh:65