forked from InsightSoftwareConsortium/ITK
-
Notifications
You must be signed in to change notification settings - Fork 19
/
itkIOCommon.cxx
133 lines (130 loc) · 4.24 KB
/
itkIOCommon.cxx
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
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#include "itkIOCommon.h"
namespace itk
{
const char *const ITK_OnDiskStorageTypeName = "ITK_OnDiskStorageTypeName";
const char *const ITK_ImageFileBaseName = "ITK_ImageFileBaseName";
const char *const ITK_VoxelUnits = "ITK_VoxelUnits";
const char *const ITK_OnDiskBitPerPixel = "ITK_OnDiskBitPerPixel";
const char *const SPM_ROI_SCALE = "SPM_ROI_SCALE";
const char *const ITK_FileNotes = "ITK_FileNotes";
const char *const ITK_Origin = "ITK_Origin";
const char *const ITK_Spacing = "ITK_Spacing";
const char *const ITK_ZDirection = "ITK_ZDirection";
const char *const ITK_FileOriginator = "ITK_FileOriginator";
const char *const ITK_OriginationDate = "ITK_OriginationDate";
const char *const ITK_PatientID = "ITK_PatientID";
const char *const ITK_ExperimentDate = "ITK_ExperimentDate";
const char *const ITK_ExperimentTime = "ITK_ExperimentTime";
const char *const ITK_InputFilterName = "ITK_InputFilterName";
const char *const ITK_NumberOfDimensions = "ITK_NumberOfDimensions";
const char *const ITK_PatientName = "ITK_PatientName";
const char *const ITK_ScanID = "ITK_ScanID";
const char *const ITK_ImageType = "ITK_ImageType";
const char *const ROI_NAME = "ROI_NAME";
const char *const ROI_X_SIZE = "ROI_X_SIZE";
const char *const ROI_X_RESOLUTION = "ROI_X_RESOLUTION";
const char *const ROI_Y_SIZE = "ROI_Y_SIZE";
const char *const ROI_Y_RESOLUTION = "ROI_Y_RESOLUTION";
const char *const ROI_Z_SIZE = "ROI_Z_SIZE";
const char *const ROI_Z_RESOLUTION = "ROI_Z_RESOLUTION";
const char *const ROI_NUM_SEGMENTS = "ROI_NUM_SEGMENTS";
const char *const ROI_PLANE = "ROI_PLANE";
const char *const ROI_SCAN_ID = "ROI_SCAN_ID";
std::string IOCommon
::AtomicPixelTypeToString(const AtomicPixelType pixelType)
{
switch ( pixelType )
{
case ITK_UCHAR:
return "unsigned char";
break;
case ITK_CHAR:
return "char";
break;
case ITK_USHORT:
return "unsigned short";
break;
case ITK_SHORT:
return "short";
break;
case ITK_UINT:
return "unsigned int";
break;
case ITK_INT:
return "int";
break;
case ITK_ULONG:
return "unsigned long";
break;
case ITK_LONG:
return "long";
break;
case ITK_FLOAT:
return "float";
break;
case ITK_DOUBLE:
return "double";
break;
default:
return "unknown";
break;
}
}
unsigned int IOCommon
::ComputeSizeOfAtomicPixelType(const AtomicPixelType pixelType)
{
switch ( pixelType )
{
case ITK_CHAR:
return static_cast< unsigned int >( sizeof( char ) );
break;
case ITK_UCHAR:
return static_cast< unsigned int >( sizeof( unsigned char ) );
break;
case ITK_SHORT:
return static_cast< unsigned int >( sizeof( short ) );
break;
case ITK_USHORT:
return static_cast< unsigned int >( sizeof( unsigned short ) );
break;
case ITK_INT:
return static_cast< unsigned int >( sizeof( int ) );
break;
case ITK_UINT:
return static_cast< unsigned int >( sizeof( unsigned int ) );
break;
case ITK_LONG:
return static_cast< unsigned int >( sizeof( long ) );
break;
case ITK_ULONG:
return static_cast< unsigned int >( sizeof( unsigned long ) );
break;
case ITK_FLOAT:
return static_cast< unsigned int >( sizeof( float ) );
break;
case ITK_DOUBLE:
return static_cast< unsigned int >( sizeof( double ) );
break;
default:
return static_cast< unsigned int >( sizeof( char ) );
break;
}
}
} // namespace itk