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 212 213 214 215 216 217 218 219 220
|
/*============================================================================
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"
#if !defined(_MSC_VER) || (_MSC_VER > 1500) // do not include this file for Visual Studio 2008
# include <cstdint>
#endif
#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
constexpr size_t METAIO_MAX_WORD_SIZE=80;
typedef char MET_ASCII_CHAR_TYPE;
typedef int8_t MET_CHAR_TYPE;
typedef uint8_t MET_UCHAR_TYPE;
typedef int16_t MET_SHORT_TYPE;
typedef uint16_t MET_USHORT_TYPE;
typedef int32_t MET_INT_TYPE;
typedef uint32_t MET_UINT_TYPE;
typedef int32_t MET_LONG_TYPE;
typedef uint32_t MET_ULONG_TYPE;
typedef int64_t MET_LONG_LONG_TYPE;
typedef uint64_t MET_ULONG_LONG_TYPE;
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
constexpr size_t MET_NUM_VALUE_TYPES = 29;
typedef enum
{
MET_NONE = 0,
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;
constexpr 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 };
static_assert((MET_OTHER + 1) == MET_NUM_VALUE_TYPES, "ERROR: Number of types defined is incorrect.");
constexpr 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', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }
};
constexpr size_t 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;
static_assert((MET_ORIENTATION_UNKNOWN + 1) == MET_NUM_ORIENTATION_TYPES, "ERROR: Incorrect number of items.");
constexpr 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' } };
constexpr size_t 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;
static_assert((MET_DISTANCE_UNITS_CM + 1) == MET_NUM_DISTANCE_UNITS_TYPES, "ERROR: Structure mismatch in size.");
constexpr char MET_DistanceUnitsTypeName[MET_NUM_DISTANCE_UNITS_TYPES][3] = { { '?', '\0', '\0' },
{ 'u', 'm', '\0' },
{ 'm', 'm', '\0' },
{ 'c', 'm', '\0' } };
constexpr size_t MET_NUM_INTERPOLATION_TYPES = 4;
typedef enum
{
MET_NO_INTERPOLATION,
MET_EXPLICIT_INTERPOLATION,
MET_BEZIER_INTERPOLATION,
MET_LINEAR_INTERPOLATION
} MET_InterpolationEnumType;
static_assert((MET_LINEAR_INTERPOLATION + 1) == MET_NUM_INTERPOLATION_TYPES, "ERROR: Structure mismatch in size.");
constexpr 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', ' ', ' ', ' ', ' ', ' ', ' ' }
};
constexpr size_t MET_MAX_NUMBER_OF_FIELD_VALUES = 4096;
constexpr size_t MET_MAX_NAME_SIZE = 255;
// Structure used to define a field
// (variable = value definition) in a MetaFile
typedef struct
{
char name[MET_MAX_NAME_SIZE]; // 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[MET_MAX_NUMBER_OF_FIELD_VALUES];
// 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
|