core/shape.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 
22 #ifndef mia_core_shape_hh
23 #define mia_core_shape_hh
24 
25 #include <set>
26 
27 #include <mia/core/product_base.hh>
28 #include <mia/core/type_traits.hh>
29 #include <mia/core/utils.hh>
30 
31 #ifndef EXPORT_SHAPE
32 # ifdef WIN32
33 # define EXPORT_SHAPE __declspec(dllimport)
34 # else
35 # define EXPORT_SHAPE
36 # endif
37 #endif
38 
40 
41 
43  static const char * type_descr;
44 };
45 
46 
47 
62 template <template <typename> class T, typename M>
64 public:
67 
69  typedef typename M::Super plugin_data;
70 
74  typedef std::set< T<int>, less_then<T<int> > > Flat;
75 
77  typedef T<int> value_type;
78 
80  typedef typename Flat::const_iterator const_iterator;
81 
83  typedef M Mask;
84 
86  typedef T<unsigned int> Size;
87 
89  TShape();
90 
92  const_iterator begin() const;
93 
95  const_iterator end() const;
96 
98  Mask get_mask()const;
99 
101  Size get_size()const;
102 
104  typename Flat::size_type size() const;
105 
109  void insert(const T<int>& p);
110 
116  bool has_location(const T<int>& p) const;
117 private:
118  Flat m_shape;
119  T<int> m_size;
120 };
121 
123 
124 #endif
T< int > value_type
the actual value type of the mask coordinates
Definition: core/shape.hh:77
Flat::const_iterator const_iterator
iterator over the mask coordinate set
Definition: core/shape.hh:80
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
M Mask
the mask image type
Definition: core/shape.hh:83
#define EXPORT_SHAPE
Definition: core/shape.hh:35
a generic class for morphological shapes
Definition: core/shape.hh:63
T< unsigned int > Size
the size type for the mask image
Definition: core/shape.hh:86
static const char * type_descr
Definition: core/shape.hh:43
shape_type plugin_type
helper type for use of the class in TFactory
Definition: core/shape.hh:66
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
The base class for all plug-in created object.
Definition: product_base.hh:40
M::Super plugin_data
Obtain the data type that is used for the mask image from the template parameters.
Definition: core/shape.hh:69
std::set< T< int >, less_then< T< int > > > Flat
Definition: core/shape.hh:74
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36