OpenWalnut  1.5.0dev
WDataHandlerEnums.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WDATAHANDLERENUMS_H
26 #define WDATAHANDLERENUMS_H
27 
28 #include <stdint.h>
29 
30 /**
31  * Data types and number values taken from the nifti1.h, at this point it's unknown if it makes sense
32  * to keep the bit coding, but it doesn't hurt either
33  * \ingroup dataHandler
34  */
36 {
37  W_DT_NONE = 0,
38  W_DT_UNKNOWN = 0, /* what it says, dude */
39  W_DT_BINARY = 1, /* binary (1 bit/voxel) */
40  W_DT_UNSIGNED_CHAR = 2, /* unsigned char (8 bits/voxel) */
41  W_DT_SIGNED_SHORT = 4, /* signed short (16 bits/voxel) */
42  W_DT_SIGNED_INT = 8, /* signed int (32 bits/voxel) */
43  W_DT_FLOAT = 16, /* float (32 bits/voxel) */
44  W_DT_COMPLEX = 32, /* complex (64 bits/voxel) */
45  W_DT_DOUBLE = 64, /* double (64 bits/voxel) */
46  W_DT_RGB = 128, /* RGB triple (24 bits/voxel) */
47  W_DT_ALL = 255, /* not very useful (?) */
48  W_DT_INT8 = 256, /* signed char (8 bits) */
49  W_DT_UINT16 = 512, /* unsigned short (16 bits) */
50  W_DT_UINT8 = 2, /* alias for unsigned char (8 bits/voxel) */
51  W_DT_INT16 = 4, /* unsigned short (16 bits) alias name for W_DT_SIGNED_SHORT */
52  W_DT_UINT32 = 768, /* unsigned int (32 bits) */
53  W_DT_INT64 = 1024, /* long long (64 bits) */
54  W_DT_UINT64 = 1280, /* unsigned long long (64 bits) */
55  W_DT_FLOAT128 = 1536, /* long double (128 bits) */
56  W_DT_COMPLEX128 = 1792, /* double pair (128 bits) */
57  W_DT_COMPLEX256 = 2048, /* long double pair (256 bits) */
58  W_DT_RGBA32 = 2304 /* 4 byte RGBA (32 bits/voxel) */
59 };
60 
61 /**
62  * An object that knows an appropriate dataType flag for the typename T.
63  */
64 template< typename T >
65 struct DataType
66 {
67 };
68 
69 /**
70  * Convert a runtime type to a C++ type
71  *
72  * \tparam rtType the runtime type
73  */
74 template< int rtType >
75 struct DataTypeRT
76 {
77 };
78 
79 /**
80  * Specialization for a specific datatype.
81  */
82 template<>
83 struct DataType< int8_t >
84 {
85  //! the dataType flag
86  static dataType const type = W_DT_INT8;
87 };
88 
89 /**
90  * Specialization for a specific type
91  */
92 template<>
93 struct DataTypeRT< W_DT_INT8 >
94 {
95  //! correct C++ type for this runtime type
96  typedef int8_t type;
97 };
98 
99 /**
100  * Specialization for a specific datatype.
101  */
102 template<>
103 struct DataType< uint8_t >
104 {
105  //! the dataType flag
106  static dataType const type = W_DT_UINT8;
107 };
108 
109 /**
110  * Specialization for a specific type
111  */
112 template<>
113 struct DataTypeRT< W_DT_UINT8 >
114 {
115  //! correct C++ type for this runtime type
116  typedef uint8_t type;
117 };
118 
119 /**
120  * Specialization for a specific datatype.
121  */
122 template<>
123 struct DataType< int16_t >
124 {
125  //! the dataType flag
126  static dataType const type = W_DT_INT16;
127 };
128 
129 /**
130  * Specialization for a specific type
131  */
132 template<>
133 struct DataTypeRT< W_DT_INT16 >
134 {
135  //! correct C++ type for this runtime type
136  typedef int16_t type;
137 };
138 
139 /**
140  * Specialization for a specific datatype.
141  */
142 template<>
143 struct DataType< uint16_t >
144 {
145  //! the dataType flag
146  static dataType const type = W_DT_UINT16;
147 };
148 
149 /**
150  * Specialization for a specific type
151  */
152 template<>
153 struct DataTypeRT< W_DT_UINT16 >
154 {
155  //! correct C++ type for this runtime type
156  typedef uint16_t type;
157 };
158 
159 /**
160  * Specialization for a specific datatype.
161  */
162 template<>
163 struct DataType< int32_t >
164 {
165  //! the dataType flag
166  static dataType const type = W_DT_SIGNED_INT;
167 };
168 
169 /**
170  * Specialization for a specific type
171  */
172 template<>
173 struct DataTypeRT< W_DT_SIGNED_INT >
174 {
175  //! correct C++ type for this runtime type
176  typedef int32_t type;
177 };
178 
179 /**
180  * Specialization for a specific datatype.
181  */
182 template<>
183 struct DataType< uint32_t >
184 {
185  //! the dataType flag
186  static dataType const type = W_DT_UINT32;
187 };
188 
189 /**
190  * Specialization for a specific type
191  */
192 template<>
193 struct DataTypeRT< W_DT_UINT32 >
194 {
195  //! correct C++ type for this runtime type
196  typedef uint32_t type;
197 };
198 
199 /**
200  * Specialization for a specific datatype.
201  */
202 template<>
203 struct DataType< int64_t >
204 {
205  //! the dataType flag
206  static dataType const type = W_DT_INT64;
207 };
208 
209 /**
210  * Specialization for a specific type
211  */
212 template<>
213 struct DataTypeRT< W_DT_INT64 >
214 {
215  //! correct C++ type for this runtime type
216  typedef int64_t type;
217 };
218 
219 /**
220  * Specialization for a specific datatype.
221  */
222 template<>
223 struct DataType< uint64_t >
224 {
225  //! the dataType flag
226  static dataType const type = W_DT_UINT64;
227 };
228 
229 /**
230  * Specialization for a specific type
231  */
232 template<>
233 struct DataTypeRT< W_DT_UINT64 >
234 {
235  //! correct C++ type for this runtime type
236  typedef uint64_t type;
237 };
238 
239 /**
240  * Specialization for a specific datatype.
241  */
242 template<>
243 struct DataType< float >
244 {
245  //! the dataType flag
246  static dataType const type = W_DT_FLOAT;
247 };
248 
249 /**
250  * Specialization for a specific type
251  */
252 template<>
253 struct DataTypeRT< W_DT_FLOAT >
254 {
255  //! correct C++ type for this runtime type
256  typedef float type;
257 };
258 
259 /**
260  * Specialization for a specific datatype.
261  */
262 template<>
263 struct DataType< double >
264 {
265  //! the dataType flag
266  static dataType const type = W_DT_DOUBLE;
267 };
268 
269 /**
270  * Specialization for a specific type
271  */
272 template<>
273 struct DataTypeRT< W_DT_DOUBLE >
274 {
275  //! correct C++ type for this runtime type
276  typedef double type;
277 };
278 
279 /**
280  * Specialization for a specific datatype.
281  */
282 template<>
283 struct DataType< long double >
284 {
285  //! the dataType flag
286  static dataType const type = W_DT_FLOAT128;
287 };
288 
289 /**
290  * Specialization for a specific type
291  */
292 template<>
293 struct DataTypeRT< W_DT_FLOAT128 >
294 {
295  //! correct C++ type for this runtime type
296  typedef long double type;
297 };
298 
299 enum qformOrientation
300 {
301  Left_to_Right,
302  Posterior_to_Anterior,
303  Inferior_to_Superior
304 };
305 
306 /**
307  * Data set types. Not complete! Only those used for distinctions so far.
308  * \ingroup dataHandler
309  */
311 {
312  W_DATASET_NONE = 0,
313  W_DATASET_SINGLE = 1,
314  W_DATASET_SPHERICALHARMONICS = 2
315 };
316 
317 /**
318  * \defgroup dataHandler Data Handler
319  *
320  * \brief
321  * This library implements the data storage facility of OpenWalnut.
322  */
323 #endif // WDATAHANDLERENUMS_H
dataType
Data types and number values taken from the nifti1.h, at this point it's unknown if it makes sense to...
DataSetType
Data set types.
double type
correct C++ type for this runtime type
long double type
correct C++ type for this runtime type
float type
correct C++ type for this runtime type
int16_t type
correct C++ type for this runtime type
int64_t type
correct C++ type for this runtime type
int8_t type
correct C++ type for this runtime type
int32_t type
correct C++ type for this runtime type
uint16_t type
correct C++ type for this runtime type
uint32_t type
correct C++ type for this runtime type
uint64_t type
correct C++ type for this runtime type
uint8_t type
correct C++ type for this runtime type
Convert a runtime type to a C++ type.
An object that knows an appropriate dataType flag for the typename T.