File: metaTypes.h

package info (click to toggle)
insighttoolkit 3.20.1%2Bgit20120521-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 80,652 kB
  • sloc: cpp: 458,133; ansic: 196,223; fortran: 28,000; python: 3,839; tcl: 1,811; sh: 1,184; java: 583; makefile: 430; csh: 220; perl: 193; xml: 20
file content (211 lines) | stat: -rw-r--r-- 8,122 bytes parent folder | download | duplicates (2)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*============================================================================
  MetaIO
  Copyright 2000-2010 Insight Software Consortium

  Distributed under the OSI-approved BSD License (the "License");
  see accompanying file Copyright.txt for details.

  This software is distributed WITHOUT ANY WARRANTY; without even the
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the License for more information.
============================================================================*/
#include "localMetaConfiguration.h"

#ifndef ITKMetaIO_METATYPES_H
#define ITKMetaIO_METATYPES_H

/*!
 * File:
 *   MetaTypes (.h and .cpp)
 *
 * Description:
 *    This file provides the definition of the enumerated types used by
 *    metaObjects as well as the record structured used to describe the
 *    fields to be read and written by MetaObjects.
 *
 *
 * \author Stephen R. Aylward
 * \date August 29, 1999
 * 
 */
#if (METAIO_USE_NAMESPACE)
namespace METAIO_NAMESPACE {
#endif

typedef char                MET_ASCII_CHAR_TYPE;
typedef char                MET_CHAR_TYPE;
typedef unsigned char       MET_UCHAR_TYPE;
typedef short               MET_SHORT_TYPE;
typedef unsigned short      MET_USHORT_TYPE;
typedef int                 MET_INT_TYPE;
typedef unsigned int        MET_UINT_TYPE;
typedef int                 MET_LONG_TYPE;
typedef unsigned long       MET_ULONG_TYPE;
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MING_W32__)
typedef __int64             MET_LONG_LONG_TYPE;
typedef unsigned __int64    MET_ULONG_LONG_TYPE;
#else
typedef long long           MET_LONG_LONG_TYPE;
typedef unsigned long long  MET_ULONG_LONG_TYPE;
#endif
typedef float               MET_FLOAT_TYPE;
typedef double              MET_DOUBLE_TYPE;
typedef char *              MET_STRING_TYPE;


// Value types for the variables in a metaFile
// Format for variables defined in a metaFile is
//    <variable> = <value>
//       where <variable> is a designated fieldname/keyword (e.g., NDims)
//          and value is an instance of that fieldname's associated valueType
#define MET_NUM_VALUE_TYPES 29

typedef enum
   {
   MET_NONE,
   MET_ASCII_CHAR, 
   MET_CHAR, 
   MET_UCHAR, 
   MET_SHORT,
   MET_USHORT,
   MET_INT, 
   MET_UINT,
   MET_LONG,
   MET_ULONG,
   MET_LONG_LONG,
   MET_ULONG_LONG,
   MET_FLOAT, 
   MET_DOUBLE,
   MET_STRING, 
   MET_CHAR_ARRAY, 
   MET_UCHAR_ARRAY, 
   MET_SHORT_ARRAY,
   MET_USHORT_ARRAY,
   MET_INT_ARRAY, 
   MET_UINT_ARRAY,
   MET_LONG_ARRAY,
   MET_ULONG_ARRAY,
   MET_LONG_LONG_ARRAY,
   MET_ULONG_LONG_ARRAY,
   MET_FLOAT_ARRAY, 
   MET_DOUBLE_ARRAY,
   MET_FLOAT_MATRIX,
   MET_OTHER
   } MET_ValueEnumType;

const unsigned char MET_ValueTypeSize[MET_NUM_VALUE_TYPES] = {
   0, 1, 1, 1, 2, 2, 4, 4, 4, 4, 8, 8, 4, 8, 1, 1, 1, 2, 2, 4, 4, 4, 4, 8, 8, 4, 8, 4, 0 };

const char MET_ValueTypeName[MET_NUM_VALUE_TYPES][21] = {
   {'M','E','T','_','N','O','N','E','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','A','S','C','I','I','_','C','H','A','R','\0',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','C','H','A','R','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','C','H','A','R','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','S','H','O','R','T','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','S','H','O','R','T','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','I','N','T','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','I','N','T','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','L','O','N','G','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','L','O','N','G','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','L','O','N','G','_','L','O','N','G','\0',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','L','O','N','G','_','L','O','N','G','\0',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','F','L','O','A','T','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','D','O','U','B','L','E','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','S','T','R','I','N','G','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','C','H','A','R','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','C','H','A','R','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' '},
   {'M','E','T','_','S','H','O','R','T','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','S','H','O','R','T','_','A','R','R','A','Y','\0',' ',' ',' ',' '},
   {'M','E','T','_','I','N','T','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','I','N','T','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','L','O','N','G','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','U','L','O','N','G','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' '},
   {'M','E','T','_','L','O','N','G','_','L','O','N','G','_','A','R','R','A','Y','\0',' '},
   {'M','E','T','_','U','L','O','N','G','_','L','O','N','G','_','A','R','R','A','Y','\0'},
   {'M','E','T','_','F','L','O','A','T','_','A','R','R','A','Y','\0',' ',' ',' ',' ',' '},
   {'M','E','T','_','D','O','U','B','L','E','_','A','R','R','A','Y','\0',' ',' ',' ',' '},
   {'M','E','T','_','F','L','O','A','T','_','M','A','T','R','I','X','\0',' ',' ',' ',' '},
   {'M','E','T','_','O','T','H','E','R','\0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}};


//
//
//
#define MET_NUM_ORIENTATION_TYPES 7

typedef enum { MET_ORIENTATION_RL,
               MET_ORIENTATION_LR,
               MET_ORIENTATION_AP,
               MET_ORIENTATION_PA,
               MET_ORIENTATION_SI,
               MET_ORIENTATION_IS,
               MET_ORIENTATION_UNKNOWN } MET_OrientationEnumType;

const char MET_OrientationTypeName[MET_NUM_ORIENTATION_TYPES][3] = {
   {'R','L','\0'},
   {'L','R','\0'},
   {'A','P','\0'},
   {'P','A','\0'},
   {'S','I','\0'},
   {'I','S','\0'},
   {'?','?','\0'}};
   
//
//
//
#define MET_NUM_DISTANCE_UNITS_TYPES 4

typedef enum { MET_DISTANCE_UNITS_UNKNOWN,
               MET_DISTANCE_UNITS_UM,
               MET_DISTANCE_UNITS_MM,
               MET_DISTANCE_UNITS_CM } MET_DistanceUnitsEnumType;

const char MET_DistanceUnitsTypeName[MET_NUM_DISTANCE_UNITS_TYPES][3] = {
    {'?', '\0', '\0'},
    {'u', 'm', '\0'},
    {'m', 'm', '\0'},
    {'c', 'm', '\0'}};

//
//
//
#define MET_NUM_INTERPOLATION_TYPES 4

typedef enum { MET_NO_INTERPOLATION,
               MET_EXPLICIT_INTERPOLATION,
               MET_BEZIER_INTERPOLATION,
               MET_LINEAR_INTERPOLATION } MET_InterpolationEnumType;

const char MET_InterpolationTypeName[MET_NUM_INTERPOLATION_TYPES][17] = {
   {'M','E','T','_','N','O','N','E','\0',' ',' ',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','E','X','P','L','I','C','I','T','\0',' ',' ',' ',' '},
   {'M','E','T','_','B','E','Z','I','E','R','\0',' ',' ',' ',' ',' ',' '},
   {'M','E','T','_','L','I','N','E','A','R','\0',' ',' ',' ',' ',' ',' '}};


//
//
// Structure used to define a field 
// (variable = value definition) in a MetaFile
typedef struct
   {
   char           name[255];  // Fieldname / keyword to designate a variable
   MET_ValueEnumType  type;   // Expected value type of the field
   bool           required;   // Is this field a required field in a metaFile
   int            dependsOn;  // If value type is an array, the size of this 
                              //    array can be defined by a different field
                              //    (e.g., DimSize array depends on NDims)
   bool           defined;    // Has this field already been defined in the
                              //    MetaFile being parsed
   int            length;     // Actual/expect length of an array
   double         value[4096]; // Memory and pointers for the field's value(s).
   bool           terminateRead;  // Set to true if field indicates end of 
                                  //   meta data
   } MET_FieldRecordType;

#if (METAIO_USE_NAMESPACE)
};
#endif


#endif