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 public:
37  static bool register_for(const std::string& key);
38 private:
39  PAttribute do_from_string(const std::string& value) const;
40 };
41 
53 template <typename T>
55 public:
56 
61  C3DValueAttribute(const T3DVector<T>& value);
62 
64  operator T3DVector<T>()const;
65 
70  const char *typedescr() const {
71  return typeid(T3DVector<T>).name();
72  }
73 
74  //
75  int type_id() const {
76  return attribute_type<T3DVector<T>>::value;
77  }
78 private:
79  std::string do_as_string() const;
80  bool do_is_equal(const CAttribute& other) const;
81  bool do_is_less(const CAttribute& other) const;
82  T3DVector<T> m_value;
83 };
84 
90 
96 
102 
108 
110 
111 #endif
const char * typedescr() const
The class of all attributes of data that is considered to ve meta-data.
Definition: attributes.hh:51
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
C3DValueAttributeTranslator< float > CVoxelAttributeTranslator
attribute translator for a 3D floating point vector used for the voxel size
#define EXPORT_3D
Definition: defines3d.hh:44
C3DValueAttribute< int > C3DIntAttribute
a 3D integer vector
std::shared_ptr< CAttribute > PAttribute
define the shared pointer wrapped attribute pointer
Definition: attributes.hh:100
a translater for 3D vectors to and from a std::string
A class to translate an attribute from a string.
Definition: attributes.hh:409
C3DValueAttribute< float > CVoxelAttribute
a 3D floating point vector used for the voxel size attribute
C3DValueAttributeTranslator< int > C3DIntAttributeTranslator
attribute translator for a 3D integer vector
A simple 3D vector type.
Definition: 3d/vector.hh:48
a 3D vector value used in attributes
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36