go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxSupportedImageDimensions.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 elxSupportedImageDimensions_h
19#define elxSupportedImageDimensions_h
20
21#include <elxSupportedImageTypes.h>
22#include <utility> // For index_sequence
23
24
25namespace elastix
26{
27
29constexpr unsigned minSupportedImageDimension{ 2 };
30
32constexpr unsigned maxSupportedImageDimension{ 4 };
33
34
35template <unsigned VDimension, std::size_t... VIndex>
36constexpr bool
38{
39 const bool foundEntries[] = { (ElastixTypedef<VIndex + 1>::FixedDimension == VDimension)... };
40
41 for (const bool isDimensionFound : foundEntries)
42 {
43 if (isDimensionFound)
44 {
45 return true;
46 }
47 }
48 return false;
49}
50
51
52// Tells whether any of the supported fixed image types has the specified dimension.
53template <unsigned VDimension>
54constexpr bool
56{
58 std::make_index_sequence<NrOfSupportedImageTypes>());
59}
60
61
62template <unsigned VDimension = minSupportedImageDimension>
64{
65 // Adds those dimensions from the specified sequence that are supported.
66 template <std::size_t... VIndex>
67 static constexpr auto
68 AddSupportedDimensions(std::index_sequence<VIndex...>)
69 {
70 using AddDimensionIfSupported = std::conditional_t<SupportsFixedDimension<VDimension>(),
71 std::index_sequence<VDimension, VIndex...>,
72 std::index_sequence<VIndex...>>;
73
75 }
76};
77
78
79template <>
81{
82 template <std::size_t... VIndex>
83 static constexpr auto
84 AddSupportedDimensions(std::index_sequence<VIndex...> dimensionSequence)
85 {
86 return dimensionSequence;
87 }
88};
89
90
94
95} // namespace elastix
96
97#endif
constexpr unsigned minSupportedImageDimension
constexpr unsigned maxSupportedImageDimension
constexpr bool SupportsFixedDimensionByImageTypeIndexSequence(std::index_sequence< VIndex... >)
const auto SupportedFixedImageDimensionSequence
constexpr bool SupportsFixedDimension()
static constexpr auto AddSupportedDimensions(std::index_sequence< VIndex... > dimensionSequence)
static constexpr auto AddSupportedDimensions(std::index_sequence< VIndex... >)


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo