My Project
valueattributetranslator.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_valueattributetranslator_hh
22 #define mia_3d_valueattributetranslator_hh
23 
24 #include <mia/core/attributes.hh>
25 #include <mia/3d/vector.hh>
26 #include <mia/3d/defines3d.hh>
27 
29 
34 template <typename T>
36 {
37 public:
38  static bool register_for(const std::string& key);
39 private:
40  PAttribute do_from_string(const std::string& value) const;
41 };
42 
54 template <typename T>
56 {
57 public:
58 
63  C3DValueAttribute(const T3DVector<T>& value);
64 
66  operator T3DVector<T>()const;
67 
72  const char *typedescr() const
73  {
74  return typeid(T3DVector<T>).name();
75  }
76 
77  //
78  int type_id() const
79  {
80  return attribute_type<T3DVector<T>>::value;
81  }
82 private:
83  std::string do_as_string() const;
84  bool do_is_equal(const CAttribute& other) const;
85  bool do_is_less(const CAttribute& other) const;
86  T3DVector<T> m_value;
87 };
88 
94 
100 
106 
112 
114 
115 #endif
C3DValueAttribute::typedescr
const char * typedescr() const
Definition: valueattributetranslator.hh:72
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
attribute_type
Definition: attributetype.hh:64
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
CAttrTranslator
A class to translate an attribute from a string.
Definition: attributes.hh:415
C3DIntAttribute
C3DValueAttribute< int > C3DIntAttribute
a 3D integer vector
Definition: valueattributetranslator.hh:105
C3DValueAttributeTranslator
a translater for 3D vectors to and from a std::string
Definition: valueattributetranslator.hh:35
CVoxelAttributeTranslator
C3DValueAttributeTranslator< float > CVoxelAttributeTranslator
attribute translator for a 3D floating point vector used for the voxel size
Definition: valueattributetranslator.hh:99
defines3d.hh
CVoxelAttribute
C3DValueAttribute< float > CVoxelAttribute
a 3D floating point vector used for the voxel size attribute
Definition: valueattributetranslator.hh:93
attributes.hh
EXPORT_3D
#define EXPORT_3D
Definition: defines3d.hh:45
C3DIntAttributeTranslator
C3DValueAttributeTranslator< int > C3DIntAttributeTranslator
attribute translator for a 3D integer vector
Definition: valueattributetranslator.hh:111
PAttribute
std::shared_ptr< CAttribute > PAttribute
define the shared pointer wrapped attribute pointer
Definition: attributes.hh:102
C3DValueAttribute
a 3D vector value used in attributes
Definition: valueattributetranslator.hh:55
CAttribute
The class of all attributes of data that is considered to ve meta-data.
Definition: attributes.hh:51
C3DValueAttribute::type_id
int type_id() const
Definition: valueattributetranslator.hh:78
T3DVector
A simple 3D vector type.
Definition: 3d/vector.hh:48
vector.hh