SimpleITK  
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 >
34 {
35  enum { Result = typelist2::index_of<InstantiatedPixelIDTypeList, TPixelID >::value };
36  static constexpr int value = typelist2::index_of<InstantiatedPixelIDTypeList, TPixelID >::value;
37 };
38 
39 template <typename TImageType>
41 {
44 };
45 
46 
47 template <unsigned int VImageDimension>
48 struct ImageTypeToPixelIDValue< itk::ImageBase<VImageDimension> >
49 {
50  enum { Result = -1 };
51  static constexpr int value = -1;
52 };
53 
54 
119 };
120 
123 
138 PixelIDValueType SITKCommon_EXPORT GetPixelIDValueFromString(const std::string &enumString );
139 
140 #ifndef SWIG
141 
142 namespace detail
143 {
144 template <typename PixelIDTypeList>
146 template <typename... Ts>
147 struct TypeListHasPixelIDValue<typelist2::typelist<Ts...>>
148 {
149  static bool
151  {
152  if (match == sitkUnknown)
153  return false;
154 
155  bool result = false;
156  ((void)[&match, &result]() { result = result || (PixelIDToPixelIDValue<Ts>::value == match); }(), ...);
157  return result;
158  }
159 };
160 }
161 
162 
165 template <typename TPixelIDTypeList = InstantiatedPixelIDTypeList>
166 bool
168 {
170 }
171 
172 SITKCommon_EXPORT std::ostream& operator<<(std::ostream& os, const PixelIDValueEnum id);
173 #endif
174 
175 
176 }
177 #endif // sitkPixelIDValues_h
itk::simple::sitkVectorInt8
@ sitkVectorInt8
Multi-component of signed 8 bit integer.
Definition: sitkPixelIDValues.h:106
itk::simple::sitkInt64
@ sitkInt64
Signed 64 bit integer.
Definition: sitkPixelIDValues.h:100
itk::simple::operator<<
SITKCommon_EXPORT std::ostream & operator<<(std::ostream &os, const EventEnum k)
itk::simple::sitkVectorUInt64
@ sitkVectorUInt64
Multi-component of unsigned 64 bit integer.
Definition: sitkPixelIDValues.h:111
itk::ImageBase
Definition: sitkPixelIDTypes.h:25
itk::simple::sitkInt32
@ sitkInt32
Signed 32 bit integer.
Definition: sitkPixelIDValues.h:98
sitkCommon.h
itk::simple::sitkLabelUInt16
@ sitkLabelUInt16
RLE label of unsigned 16 bit integers.
Definition: sitkPixelIDValues.h:116
itk::simple::sitkLabelUInt8
@ sitkLabelUInt8
RLE label of unsigned 8 bit integers.
Definition: sitkPixelIDValues.h:115
itk::simple::sitkInt16
@ sitkInt16
Signed 16 bit integer.
Definition: sitkPixelIDValues.h:96
itk::simple::ImageTypeToPixelIDValue::Result
@ Result
Definition: sitkPixelIDValues.h:42
itk::simple::sitkComplexFloat32
@ sitkComplexFloat32
complex number of 32 bit float
Definition: sitkPixelIDValues.h:103
itk::simple::sitkVectorInt64
@ sitkVectorInt64
Multi-component of signed 64 bit integer.
Definition: sitkPixelIDValues.h:112
itk::simple::PixelIDValueEnum
PixelIDValueEnum
Enumerated values of pixelIDs.
Definition: sitkPixelIDValues.h:91
itk::simple::sitkVectorFloat64
@ sitkVectorFloat64
Multi-component of 64 bit float.
Definition: sitkPixelIDValues.h:114
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:167
itk::simple::sitkVectorUInt8
@ sitkVectorUInt8
Multi-component of unsigned 8 bit integer.
Definition: sitkPixelIDValues.h:105
itk::simple::sitkUInt16
@ sitkUInt16
Unsigned 16 bit integer.
Definition: sitkPixelIDValues.h:95
itk::simple::GetPixelIDValueAsString
const std::string SITKCommon_EXPORT GetPixelIDValueAsString(PixelIDValueType type)
itk::simple::ImageTypeToPixelIDValue
Definition: sitkPixelIDValues.h:40
itk::simple::sitkInt8
@ sitkInt8
Signed 8 bit integer.
Definition: sitkPixelIDValues.h:94
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
itk::simple::sitkUInt32
@ sitkUInt32
Unsigned 32 bit integer.
Definition: sitkPixelIDValues.h:97
itk::simple::detail::TypeListHasPixelIDValue
Definition: sitkPixelIDValues.h:145
itk::simple::sitkFloat64
@ sitkFloat64
64 bit float
Definition: sitkPixelIDValues.h:102
itk::simple::sitkFloat32
@ sitkFloat32
32 bit float
Definition: sitkPixelIDValues.h:101
itk::simple::sitkVectorUInt16
@ sitkVectorUInt16
Multi-component of unsigned 16 bit integer.
Definition: sitkPixelIDValues.h:107
itk::simple::PixelIDToPixelIDValue::value
static constexpr int value
Definition: sitkPixelIDValues.h:36
itk::simple::ImageTypeToPixelIDValue::value
static constexpr int value
Definition: sitkPixelIDValues.h:43
itk::simple::detail::TypeListHasPixelIDValue< typelist2::typelist< Ts... > >::op
static bool op(PixelIDValueEnum match)
Definition: sitkPixelIDValues.h:150
sitkPixelIDTypeLists.h
itk::simple::sitkUInt8
@ sitkUInt8
Unsigned 8 bit integer.
Definition: sitkPixelIDValues.h:93
itk::simple::GetPixelIDValueFromString
PixelIDValueType SITKCommon_EXPORT GetPixelIDValueFromString(const std::string &enumString)
Function mapping enumeration names in std::string to values.
itk::simple::sitkVectorInt16
@ sitkVectorInt16
Multi-component of signed 16 bit integer.
Definition: sitkPixelIDValues.h:108
itk
itk::simple::sitkVectorUInt32
@ sitkVectorUInt32
Multi-component of unsigned 32 bit integer.
Definition: sitkPixelIDValues.h:109
itk::simple::sitkVectorInt32
@ sitkVectorInt32
Multi-component of signed 32 bit integer.
Definition: sitkPixelIDValues.h:110
itk::simple::sitkUInt64
@ sitkUInt64
Unsigned 64 bit integer.
Definition: sitkPixelIDValues.h:99
itk::simple::sitkComplexFloat64
@ sitkComplexFloat64
complex number of 64 bit float
Definition: sitkPixelIDValues.h:104
itk::simple::sitkLabelUInt32
@ sitkLabelUInt32
RLE label of unsigned 32 bit integers.
Definition: sitkPixelIDValues.h:117
itk::simple::sitkVectorFloat32
@ sitkVectorFloat32
Multi-component of 32 bit float.
Definition: sitkPixelIDValues.h:113
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::simple::sitkUnknown
@ sitkUnknown
Definition: sitkPixelIDValues.h:92
itk::simple::PixelIDToPixelIDValue::Result
@ Result
Definition: sitkPixelIDValues.h:35
itk::simple::PixelIDValueType
int PixelIDValueType
Definition: sitkPixelIDValues.h:30
itk::simple::sitkLabelUInt64
@ sitkLabelUInt64
RLE label of unsigned 64 bit integers.
Definition: sitkPixelIDValues.h:118