Loading [MathJax]/extensions/tex2jax.js
SimpleITK  2.5.0.dev
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"
23
24#include <string>
25#include <ostream>
26
27namespace itk::simple
28{
29
30using PixelIDValueType = int;
31
32template <typename TPixelID>
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
42template <typename TImageType>
51
52
53template <unsigned int VImageDimension>
54struct ImageTypeToPixelIDValue<itk::ImageBase<VImageDimension>>
55{
56 enum
57 {
58 Result = -1
59 };
60 static constexpr int value = -1;
61};
62
63
101{
111 sitkFloat32 = PixelIDToPixelIDValue<BasicPixelID<float>>::value,
112 sitkFloat64 = PixelIDToPixelIDValue<BasicPixelID<double>>::value,
113 sitkComplexFloat32 =
115 sitkComplexFloat64 =
117 sitkVectorUInt8 = PixelIDToPixelIDValue<VectorPixelID<uint8_t>>::value,
118 sitkVectorInt8 = PixelIDToPixelIDValue<VectorPixelID<int8_t>>::value,
119 sitkVectorUInt16 =
121 sitkVectorInt16 = PixelIDToPixelIDValue<VectorPixelID<int16_t>>::value,
122 sitkVectorUInt32 =
124 sitkVectorInt32 = PixelIDToPixelIDValue<VectorPixelID<int32_t>>::value,
125 sitkVectorUInt64 =
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
136const std::string SITKCommon_EXPORT
138const std::string SITKCommon_EXPORT
140
156GetPixelIDValueFromString(const std::string & enumString);
157
158#ifndef SWIG
159
160namespace detail
161{
162template <typename PixelIDTypeList>
164template <typename... Ts>
165struct TypeListHasPixelIDValue<typelist2::typelist<Ts...>>
166{
167 static bool
169 {
170 if (match == sitkUnknown)
171 return false;
172
173 return ((PixelIDToPixelIDValue<Ts>::value == match) || ...);
174 }
175};
176} // namespace detail
177
178
181template <typename TPixelIDTypeList = InstantiatedPixelIDTypeList>
182bool
187
188SITKCommon_EXPORT std::ostream &
189 operator<<(std::ostream & os, const PixelIDValueEnum id);
190#endif
191
192
193} // namespace itk::simple
194#endif // sitkPixelIDValues_h
SITKCommon_EXPORT std::ostream & operator<<(std::ostream &os, const EventEnum k)
bool TypeListHasPixelIDValue(PixelIDValueEnum match)
Check if the runtime PixelID is contained in a template parameter typelist.
const std::string SITKCommon_EXPORT GetPixelIDValueAsString(PixelIDValueType type)
PixelIDValueType SITKCommon_EXPORT GetPixelIDValueFromString(const std::string &enumString)
Function mapping enumeration names in std::string to values.
PixelIDValueEnum
Enumerated values of pixelIDs.
#define SITKCommon_EXPORT
Definition sitkCommon.h:41