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