ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkWasmMapComponentType.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 * https://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 itkWasmMapComponentType_h
19#define itkWasmMapComponentType_h
20
21#include <variant>
22#include <type_traits>
23#include <string_view>
24
25#include "itkIntTypes.h"
26#include "itkIOCommon.h"
27
28#include "itkIntTypesJSON.h"
29#include "itkFloatTypesJSON.h"
31
32namespace itk
33{
34
35namespace wasm
36{
37
38template <typename TComponent>
46
47template <>
48struct MapComponentType<signed char>
49{
50 static constexpr std::string_view ComponentString = "int8";
53};
54
55template <>
56struct MapComponentType<char>
57{
58 // Todo: does not compile:
59 // std::numeric_limits<char>::is_signed ? "int8" : "uint8_
60 static constexpr std::string_view ComponentString = "int8";
63};
64
65template <>
66struct MapComponentType<unsigned char>
67{
68 static constexpr std::string_view ComponentString = "uint8";
71};
72
73template <>
74struct MapComponentType<short>
75{
76 static constexpr std::string_view ComponentString = "int16";
79};
80
81template <>
82struct MapComponentType<unsigned short>
83{
84 static constexpr std::string_view ComponentString = "uint16";
87};
88
89template <>
91{
92 static constexpr std::string_view ComponentString = "int32";
95};
96
97template <>
98struct MapComponentType<unsigned int>
99{
100 static constexpr std::string_view ComponentString = "uint32";
103};
104
105#if ((LLONG_MAX != LONG_MAX))
106template <>
107struct MapComponentType<long>
108{
109 static constexpr std::string_view ComponentString = "int32";
112};
113#else
114template <>
116{
117 static constexpr std::string_view ComponentString = "int64";
120};
121#endif
122
123#if ((ULLONG_MAX != ULONG_MAX))
124template <>
125struct MapComponentType<unsigned long>
126{
127 static constexpr std::string_view ComponentString = "uint32";
130};
131#else
132template <>
133struct MapComponentType<unsigned long>
134{
135 static constexpr std::string_view ComponentString = "uint64";
138};
139#endif
140
141template <>
142struct MapComponentType<long long>
143{
144 static constexpr std::string_view ComponentString = "int64";
147};
148
149template <>
150struct MapComponentType<unsigned long long>
151{
152 static constexpr std::string_view ComponentString = "uint64";
155};
156
157template <>
158struct MapComponentType<float>
159{
160 static constexpr std::string_view ComponentString = "float32";
163};
164
165template <>
166struct MapComponentType<double>
167{
168 static constexpr std::string_view ComponentString = "float64";
171};
172
173} // end namespace wasm
174} // end namespace itk
175
176
177#endif // itkWasmMapComponentType_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr std::string_view ComponentString
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONFloatTypesEnum JSONFloatTypeEnum
static constexpr std::string_view ComponentString
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr JSONFloatTypesEnum JSONFloatTypeEnum
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr std::string_view ComponentString
static constexpr std::string_view ComponentString
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONIntTypesEnum JSONIntTypeEnum
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr std::string_view ComponentString
static constexpr JSONFloatTypesEnum JSONFloatTypeEnum