go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxPixelType.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef elxPixelType_h
19#define elxPixelType_h
20
21#include <typeinfo>
22#include "itkMacro.h"
23
24namespace elastix
25{
26// PixelType traits for writing types as strings to parameter files
27
28// Default implementation
29template< typename T >
30struct PixelType
31{
32 static const char * ToString()
33 {
34 itkGenericExceptionMacro(<< "Pixel type \"" << typeid( T ).name() << "\" is not supported." );
35 }
36
37
38};
39
40template< >
41struct PixelType< char >
42{
43 static const char * ToString()
44 {
45 return "char";
46 }
47
48
49};
50
51template< >
52struct PixelType< unsigned char >
53{
54 static const char * ToString()
55 {
56 return "unsigned char";
57 }
58
59
60};
61
62template< >
63struct PixelType< short >
64{
65 static const char * ToString()
66 {
67 return "short";
68 }
69
70
71};
72
73template< >
74struct PixelType< unsigned short >
75{
76 static const char * ToString()
77 {
78 return "unsigned short";
79 }
80
81
82};
83
84template< >
85struct PixelType< int >
86{
87 static const char * ToString()
88 {
89 return "int";
90 }
91
92
93};
94
95template< >
96struct PixelType< unsigned int >
97{
98 static const char * ToString()
99 {
100 return "unsigned int";
101 }
102
103
104};
105
106template< >
107struct PixelType< long >
108{
109 static const char * ToString()
110 {
111 return "long";
112 }
113
114
115};
116
117template< >
118struct PixelType< unsigned long >
119{
120 static const char * ToString()
121 {
122 return "unsigned long";
123 }
124
125
126};
127
128template< >
129struct PixelType< float >
130{
131 static const char * ToString()
132 {
133 return "float";
134 }
135
136
137};
138
139template< >
140struct PixelType< double >
141{
142 static const char * ToString()
143 {
144 return "double";
145 }
146
147
148};
149
150}
151
152#endif // elxPixelType_h


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo