SimpleITK  2.0.0
sitkPixelIDTokens.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 sitkPixelIDTokens_h
19 #define sitkPixelIDTokens_h
20 
21 #include "sitkConfigure.h"
22 #include "sitkPixelIDValues.h"
23 
24 #include <type_traits>
25 
26 namespace itk
27 {
28 namespace simple
29 {
30 
31 using TrueType = std::true_type;
32 using FalseType = std::false_type;
33 
34 template <typename TPixelIDType>
35 struct IsBasic
36 {
37  static const bool Value = FalseType::value;
38  using ValueType = typename FalseType::value_type;
39  using Type = typename FalseType::type;
40 };
41 template <typename TPixelType>
42 struct IsBasic< BasicPixelID<TPixelType> >
43 {
44  static const bool Value = TrueType::value;
45  using ValueType = typename TrueType::value_type;
46  using Type = typename TrueType::type;
47 };
48 template <typename TPixelType, unsigned int VImageDimension>
49 struct IsBasic< itk::Image< TPixelType, VImageDimension> >
50  : public IsBasic< typename ImageTypeToPixelID< itk::Image<TPixelType, VImageDimension> >::PixelIDType >
51 {};
52 
53 
54 template <typename TPixelIDType>
55 struct IsVector
56 {
57  static const bool Value = FalseType::value;
58  using ValueType = typename FalseType::value_type;
59  using Type = typename FalseType::type;
60 };
61 template <typename TPixelType>
62 struct IsVector< VectorPixelID<TPixelType> >
63 {
64  static const bool Value = TrueType::value;
65  using ValueType = typename TrueType::value_type;
66  using Type = typename TrueType::type;
67 };
68 template <typename TPixelType, unsigned int VImageDimension>
69 struct IsVector< itk::VectorImage< TPixelType, VImageDimension> >
70  : public IsVector< typename ImageTypeToPixelID< itk::VectorImage<TPixelType, VImageDimension> >::PixelIDType >
71 {};
72 
73 
74 template <typename TPixelIDType>
75 struct IsLabel
76 {
77  static const bool Value = FalseType::value;
78  using ValueType = typename FalseType::value_type;
79  using Type = typename FalseType::type;
80 };
81 template <typename TPixelType>
82 struct IsLabel< LabelPixelID<TPixelType> >
83 {
84  static const bool Value = TrueType::value;
85  using ValueType = typename TrueType::value_type;
86  using Type = typename TrueType::type;
87 };
88 template <typename TLabelType, unsigned int VImageDimension>
89 struct IsLabel< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >
90  : public IsLabel< typename ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType >
91 {};
92 
93 
94 template <typename TPixelIDType, unsigned int VImageDimension =0>
96 {
98  && ( (VImageDimension == 0) ||
99  (VImageDimension >= 2 && VImageDimension <= SITK_MAX_DIMENSION));
100  using ValueType = typename std::integral_constant<bool, Value>::value_type;
101  using Type = typename std::integral_constant<bool, Value>::type;
102 };
103  template <typename TPixelType, unsigned int VImageDimension >
104 struct IsInstantiated< itk::Image< TPixelType, VImageDimension>, 0 >
105  : public IsInstantiated< typename ImageTypeToPixelID< itk::Image<TPixelType, VImageDimension> >::PixelIDType, VImageDimension >
106 {};
107 template <typename TPixelType, unsigned int VImageDimension>
108 struct IsInstantiated< itk::VectorImage< TPixelType, VImageDimension>, 0 >
109  : public IsInstantiated< typename ImageTypeToPixelID< itk::VectorImage<TPixelType, VImageDimension> >::PixelIDType, VImageDimension >
110 {};
111 template <typename TLabelType, unsigned int VImageDimension>
112 struct IsInstantiated< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > >, 0 >
113  : public IsInstantiated< typename ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType, VImageDimension >
114 {};
115 
116 }
117 }
118 
119 #endif // _sitkPixelIDTokens_h
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:75
itk::simple::IsInstantiated< ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType, VImageDimension >::ValueType
typename std::integral_constant< bool, Value >::value_type ValueType
Definition: sitkPixelIDTokens.h:100
itk::simple::IsVector::Value
static const bool Value
Definition: sitkPixelIDTokens.h:57
itk::simple::IsVector< VectorPixelID< TPixelType > >::Type
typename TrueType::type Type
Definition: sitkPixelIDTokens.h:66
itk::simple::IsLabel::Value
static const bool Value
Definition: sitkPixelIDTokens.h:77
itk::simple::IsLabel
Definition: sitkPixelIDTokens.h:75
itk::VectorImage
Definition: sitkPixelIDTypes.h:27
itk::simple::IsInstantiated::Value
static const bool Value
Definition: sitkPixelIDTokens.h:97
itk::simple::IsInstantiated
Definition: sitkPixelIDTokens.h:95
itk::simple::PixelIDToPixelIDValue
Definition: sitkPixelIDValues.h:35
itk::simple::IsVector< ImageTypeToPixelID< itk::VectorImage< TPixelType, VImageDimension > >::PixelIDType >::Type
typename FalseType::type Type
Definition: sitkPixelIDTokens.h:59
itk::LabelMap
Definition: sitkPixelIDTypes.h:28
itk::simple::IsLabel< ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType >::Type
typename FalseType::type Type
Definition: sitkPixelIDTokens.h:79
itk::simple::LabelPixelID
Definition: sitkPixelIDTypes.h:84
itk::simple::IsBasic< ImageTypeToPixelID< itk::Image< TPixelType, VImageDimension > >::PixelIDType >::Type
typename FalseType::type Type
Definition: sitkPixelIDTokens.h:39
SITK_MAX_DIMENSION
#define SITK_MAX_DIMENSION
Definition: sitkConfigure.h:30
itk::simple::IsBasic< BasicPixelID< TPixelType > >::Type
typename TrueType::type Type
Definition: sitkPixelIDTokens.h:46
itk::simple::IsVector< ImageTypeToPixelID< itk::VectorImage< TPixelType, VImageDimension > >::PixelIDType >::ValueType
typename FalseType::value_type ValueType
Definition: sitkPixelIDTokens.h:58
itk::simple::TrueType
std::true_type TrueType
Definition: sitkPixelIDTokens.h:31
itk::simple::IsInstantiated< ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType, VImageDimension >::Type
typename std::integral_constant< bool, Value >::type Type
Definition: sitkPixelIDTokens.h:101
sitkPixelIDValues.h
itk::simple::IsLabel< LabelPixelID< TPixelType > >::ValueType
typename TrueType::value_type ValueType
Definition: sitkPixelIDTokens.h:85
itk::simple::BasicPixelID
Definition: sitkPixelIDTypes.h:48
itk::simple::IsBasic< BasicPixelID< TPixelType > >::ValueType
typename TrueType::value_type ValueType
Definition: sitkPixelIDTokens.h:45
sitkConfigure.h
itk::simple::IsVector
Definition: sitkPixelIDTokens.h:55
itk::simple::IsBasic< ImageTypeToPixelID< itk::Image< TPixelType, VImageDimension > >::PixelIDType >::ValueType
typename FalseType::value_type ValueType
Definition: sitkPixelIDTokens.h:38
itk
itk::simple::IsBasic::Value
static const bool Value
Definition: sitkPixelIDTokens.h:37
itk::simple::FalseType
std::false_type FalseType
Definition: sitkPixelIDTokens.h:32
itk::simple::IsLabel< ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType >::ValueType
typename FalseType::value_type ValueType
Definition: sitkPixelIDTokens.h:78
itk::simple::IsLabel< LabelPixelID< TPixelType > >::Type
typename TrueType::type Type
Definition: sitkPixelIDTokens.h:86
itk::simple::sitkUnknown
@ sitkUnknown
Definition: sitkPixelIDValues.h:91
itk::simple::IsBasic
Definition: sitkPixelIDTokens.h:35
itk::simple::IsVector< VectorPixelID< TPixelType > >::ValueType
typename TrueType::value_type ValueType
Definition: sitkPixelIDTokens.h:65
itk::simple::VectorPixelID
Definition: sitkPixelIDTypes.h:66