/usr/include/mia-2.2/mia/3d/valueattributetranslator.hh is in libmia-2.2-dev 2.2.2-1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | /* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_3d_valueattributetranslator_hh
#define mia_3d_valueattributetranslator_hh
#include <mia/core/attributes.hh>
#include <mia/3d/vector.hh>
#include <mia/3d/defines3d.hh>
NS_MIA_BEGIN
/**
@ingroup basic
@brief a translater for 3D vectors to and from a std::string
*/
template <typename T>
class EXPORT_3D C3DValueAttributeTranslator: public CAttrTranslator {
public:
static bool register_for(const std::string& key);
private:
PAttribute do_from_string(const std::string& value) const;
};
/**
This class is a hack to work around the vista voxel size stringyfied value.
Normaly one would write "x,y,z" but in vista it is "x y z", which means a different
translator is needed as compared to a T3DVector.
For everything else the T3DVector interpretation is used (based on type_id);
@ingroup basic
@brief a 3D vector value used in attributes
@tparam T the data type of the vector elements
*/
template <typename T>
class EXPORT_3D C3DValueAttribute : public CAttribute {
public:
/**
Constructor to initialize the attribute by using a 3D Vector value
@param value
*/
C3DValueAttribute(const T3DVector<T>& value);
/// \returns the value of the attribute as 3D vector
operator T3DVector<T>()const;
/**
Obtain a run-time unique type description of the value type
@returns the typeid of the T3DVector<T>
*/
const char *typedescr() const {
return typeid(T3DVector<T>).name();
}
//
int type_id() const {
return attribute_type<T3DVector<T>>::value;
}
private:
std::string do_as_string() const;
bool do_is_equal(const CAttribute& other) const;
bool do_is_less(const CAttribute& other) const;
T3DVector<T> m_value;
};
/**
@ingroup basic
@brief a 3D floating point vector used for the voxel size attribute
*/
typedef C3DValueAttribute<float> CVoxelAttribute;
/**
@ingroup basic
@brief attribute translator for a 3D floating point vector used for the voxel size
*/
typedef C3DValueAttributeTranslator<float> CVoxelAttributeTranslator;
/**
@ingroup basic
@brief a 3D integer vector
*/
typedef C3DValueAttribute<int> C3DIntAttribute;
/**
@ingroup basic
@brief attribute translator for a 3D integer vector
*/
typedef C3DValueAttributeTranslator<int> C3DIntAttributeTranslator;
NS_MIA_END
#endif
|