SimpleITK
SimpleITK
Code
Common
include
sitkPixelIDValues.h
Go to the documentation of this file.
1
/*=========================================================================
2
*
3
* Copyright NumFOCUS
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 sitkPixelIDValues_h
19
#define sitkPixelIDValues_h
20
21
#include "
sitkCommon.h
"
22
#include "
sitkPixelIDTypeLists.h
"
23
24
#include <string>
25
#include <ostream>
26
27
namespace
itk::simple
28
{
29
30
using
PixelIDValueType
= int;
31
32
template
<
typename
TPixelID>
33
struct
PixelIDToPixelIDValue
34
{
35
enum
36
{
37
Result
= typelist2::index_of<InstantiatedPixelIDTypeList, TPixelID>::value
38
};
39
static
constexpr
int
value
= typelist2::index_of<InstantiatedPixelIDTypeList, TPixelID>::value;
40
};
41
42
template
<
typename
TImageType>
43
struct
ImageTypeToPixelIDValue
44
{
45
enum
46
{
47
Result
=
PixelIDToPixelIDValue<typename ImageTypeToPixelID<TImageType>::PixelIDType
>
::value
48
};
49
static
constexpr
int
value
=
PixelIDToPixelIDValue<typename ImageTypeToPixelID<TImageType>::PixelIDType
>
::value
;
50
};
51
52
53
template
<
unsigned
int
VImageDimension>
54
struct
ImageTypeToPixelIDValue
<
itk
::
ImageBase
<VImageDimension>>
55
{
56
enum
57
{
58
Result
= -1
59
};
60
static
constexpr
int
value
= -1;
61
};
62
63
100
enum
PixelIDValueEnum
101
{
102
sitkUnknown
= -1,
103
sitkUInt8 =
PixelIDToPixelIDValue<BasicPixelID<uint8_t>
>::value,
104
sitkInt8 =
PixelIDToPixelIDValue<BasicPixelID<int8_t>
>::value,
105
sitkUInt16 =
PixelIDToPixelIDValue<BasicPixelID<uint16_t>
>::value,
106
sitkInt16 =
PixelIDToPixelIDValue<BasicPixelID<int16_t>
>::value,
107
sitkUInt32 =
PixelIDToPixelIDValue<BasicPixelID<uint32_t>
>::value,
108
sitkInt32 =
PixelIDToPixelIDValue<BasicPixelID<int32_t>
>::value,
109
sitkUInt64 =
PixelIDToPixelIDValue<BasicPixelID<uint64_t>
>::value,
110
sitkInt64 =
PixelIDToPixelIDValue<BasicPixelID<int64_t>
>::value,
111
sitkFloat32 =
PixelIDToPixelIDValue<BasicPixelID<float>
>::value,
112
sitkFloat64 =
PixelIDToPixelIDValue<BasicPixelID<double>
>::value,
113
sitkComplexFloat32 =
114
PixelIDToPixelIDValue<BasicPixelID<std::complex<float>
>>::value,
115
sitkComplexFloat64 =
116
PixelIDToPixelIDValue<BasicPixelID<std::complex<double>
>>::value,
117
sitkVectorUInt8 =
PixelIDToPixelIDValue<VectorPixelID<uint8_t>
>::value,
118
sitkVectorInt8 =
PixelIDToPixelIDValue<VectorPixelID<int8_t>
>::value,
119
sitkVectorUInt16 =
120
PixelIDToPixelIDValue<VectorPixelID<uint16_t>
>::value,
121
sitkVectorInt16 =
PixelIDToPixelIDValue<VectorPixelID<int16_t>
>::value,
122
sitkVectorUInt32 =
123
PixelIDToPixelIDValue<VectorPixelID<uint32_t>
>::value,
124
sitkVectorInt32 =
PixelIDToPixelIDValue<VectorPixelID<int32_t>
>::value,
125
sitkVectorUInt64 =
126
PixelIDToPixelIDValue<VectorPixelID<uint64_t>
>::value,
127
sitkVectorInt64 =
PixelIDToPixelIDValue<VectorPixelID<int64_t>
>::value,
128
sitkVectorFloat32 =
PixelIDToPixelIDValue<VectorPixelID<float>
>::value,
129
sitkVectorFloat64 =
PixelIDToPixelIDValue<VectorPixelID<double>
>::value,
130
sitkLabelUInt8 =
PixelIDToPixelIDValue<LabelPixelID<uint8_t>
>::value,
131
sitkLabelUInt16 =
PixelIDToPixelIDValue<LabelPixelID<uint16_t>
>::value,
132
sitkLabelUInt32 =
PixelIDToPixelIDValue<LabelPixelID<uint32_t>
>::value,
133
sitkLabelUInt64 =
PixelIDToPixelIDValue<LabelPixelID<uint64_t>
>::value,
134
};
135
136
const
std::string
SITKCommon_EXPORT
137
GetPixelIDValueAsString
(
PixelIDValueType
type);
138
const
std::string
SITKCommon_EXPORT
139
GetPixelIDValueAsString
(
PixelIDValueEnum
type);
140
155
PixelIDValueType
SITKCommon_EXPORT
156
GetPixelIDValueFromString
(
const
std::string & enumString);
157
158
#ifndef SWIG
159
160
namespace
detail
161
{
162
template
<
typename
PixelIDTypeList>
163
struct
TypeListHasPixelIDValue
;
164
template
<
typename
... Ts>
165
struct
TypeListHasPixelIDValue
<typelist2::typelist<Ts...>>
166
{
167
static
bool
168
op
(
PixelIDValueEnum
match)
169
{
170
if
(match ==
sitkUnknown
)
171
return
false
;
172
173
return
((
PixelIDToPixelIDValue<Ts>::value
== match) || ...);
174
}
175
};
176
}
// namespace detail
177
178
181
template
<
typename
TPixelIDTypeList = InstantiatedPixelIDTypeList>
182
bool
183
TypeListHasPixelIDValue
(
PixelIDValueEnum
match)
184
{
185
return
detail::TypeListHasPixelIDValue<TPixelIDTypeList>::op
(match);
186
}
187
188
SITKCommon_EXPORT
std::ostream &
189
operator<<
(std::ostream & os,
const
PixelIDValueEnum
id
);
190
#endif
191
192
193
}
// namespace itk::simple
194
#endif // sitkPixelIDValues_h
itk::simple::operator<<
SITKCommon_EXPORT std::ostream & operator<<(std::ostream &os, const EventEnum k)
itk::ImageBase
Definition:
sitkPixelIDTypes.h:26
sitkCommon.h
itk::simple::ImageTypeToPixelIDValue::Result
@ Result
Definition:
sitkPixelIDValues.h:47
itk::simple::PixelIDValueEnum
PixelIDValueEnum
Enumerated values of pixelIDs.
Definition:
sitkPixelIDValues.h:100
itk::simple::PixelIDToPixelIDValue
Definition:
sitkPixelIDValues.h:33
itk::simple::TypeListHasPixelIDValue
bool TypeListHasPixelIDValue(PixelIDValueEnum match)
Check if the runtime PixelID is contained in a template parameter typelist.
Definition:
sitkPixelIDValues.h:183
itk::simple::GetPixelIDValueAsString
const std::string SITKCommon_EXPORT GetPixelIDValueAsString(PixelIDValueType type)
itk::simple::ImageTypeToPixelIDValue
Definition:
sitkPixelIDValues.h:43
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition:
sitkCommon.h:41
itk::simple::detail::TypeListHasPixelIDValue
Definition:
sitkPixelIDValues.h:163
itk::simple::PixelIDToPixelIDValue::value
static constexpr int value
Definition:
sitkPixelIDValues.h:39
itk::simple::ImageTypeToPixelIDValue::value
static constexpr int value
Definition:
sitkPixelIDValues.h:49
itk::simple::detail::TypeListHasPixelIDValue< typelist2::typelist< Ts... > >::op
static bool op(PixelIDValueEnum match)
Definition:
sitkPixelIDValues.h:168
sitkPixelIDTypeLists.h
itk::simple::GetPixelIDValueFromString
PixelIDValueType SITKCommon_EXPORT GetPixelIDValueFromString(const std::string &enumString)
Function mapping enumeration names in std::string to values.
itk
itk::simple
Definition:
sitkAdditionalProcedures.h:28
itk::simple::sitkUnknown
@ sitkUnknown
Definition:
sitkPixelIDValues.h:102
itk::simple::PixelIDToPixelIDValue::Result
@ Result
Definition:
sitkPixelIDValues.h:37
itk::simple::PixelIDValueType
int PixelIDValueType
Definition:
sitkPixelIDValues.h:30
Generated on
unknown
for SimpleITK by
1.8.17 |
Privacy Policy