SimpleITK  1.3.0.dev466
sitkPixelIDTokens.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
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 #include "nsstd/type_traits.h"
24 
25 
26 namespace itk
27 {
28 namespace simple
29 {
30 
31 typedef nsstd::true_type TrueType;
32 typedef nsstd::false_type FalseType;
33 
34 template <typename TPixelIDType>
35 struct IsBasic
36 {
37  static const bool Value = FalseType::value;
38  typedef typename FalseType::value_type ValueType;
39  typedef typename FalseType::type Type;
40 };
41 template <typename TPixelType>
42 struct IsBasic< BasicPixelID<TPixelType> >
43 {
44  static const bool Value = TrueType::value;
45  typedef typename TrueType::value_type ValueType;
46  typedef typename TrueType::type 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  typedef typename FalseType::value_type ValueType;
59  typedef typename FalseType::type Type;
60 };
61 template <typename TPixelType>
62 struct IsVector< VectorPixelID<TPixelType> >
63 {
64  static const bool Value = TrueType::value;
65  typedef typename TrueType::value_type ValueType;
66  typedef typename TrueType::type 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  typedef typename FalseType::value_type ValueType;
79  typedef typename FalseType::type Type;
80 };
81 template <typename TPixelType>
82 struct IsLabel< LabelPixelID<TPixelType> >
83 {
84  static const bool Value = TrueType::value;
85  typedef typename TrueType::value_type ValueType;
86  typedef typename TrueType::type 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)||(VImageDimension == 2) || (VImageDimension == 3)
99 #ifdef SITK_4D_IMAGES
100  || (VImageDimension == 4)
101 #endif
102  );
103  typedef typename nsstd::integral_constant<bool, Value>::value_type ValueType;
104  typedef typename nsstd::integral_constant<bool, Value>::type Type;
105 };
106  template <typename TPixelType, unsigned int VImageDimension >
107 struct IsInstantiated< itk::Image< TPixelType, VImageDimension>, 0 >
108  : public IsInstantiated< typename ImageTypeToPixelID< itk::Image<TPixelType, VImageDimension> >::PixelIDType, VImageDimension >
109 {};
110 template <typename TPixelType, unsigned int VImageDimension>
111 struct IsInstantiated< itk::VectorImage< TPixelType, VImageDimension>, 0 >
112  : public IsInstantiated< typename ImageTypeToPixelID< itk::VectorImage<TPixelType, VImageDimension> >::PixelIDType, VImageDimension >
113 {};
114 template <typename TLabelType, unsigned int VImageDimension>
115 struct IsInstantiated< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > >, 0 >
116  : public IsInstantiated< typename ImageTypeToPixelID< itk::LabelMap< itk::LabelObject< TLabelType, VImageDimension > > >::PixelIDType, VImageDimension >
117 {};
118 
119 }
120 }
121 
122 #endif // _sitkPixelIDTokens_h
FalseType::value_type ValueType
FalseType::value_type ValueType
nsstd::integral_constant< bool, Value >::type Type
FalseType::type Type
static const bool Value
static const bool Value
nsstd::true_type TrueType
FalseType::value_type ValueType
nsstd::integral_constant< bool, Value >::value_type ValueType
The Image class for SimpleITK.
Definition: sitkImage.h:78
nsstd::false_type FalseType
static const bool Value
FalseType::type Type