ITK  6.0.0
Insight Toolkit
itkLabelMapUtilities.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 itkLabelMapUtilities_h
19#define itkLabelMapUtilities_h
20
21/*
22 *
23 * This code was contributed in the Insight Journal paper:
24 * "Label object representation and manipulation with ITK"
25 * by Lehmann G.
26 * https://doi.org/10.54294/q6auw4
27 *
28 */
29
30#define itkShapeLabelMapFilterDispatchMacro() \
31 case LabelObjectType::LABEL: \
32 { \
33 using AccessorType = typename Functor::LabelLabelObjectAccessor<LabelObjectType>; \
34 AccessorType accessor; \
35 this->TemplatedGenerateData(accessor); \
36 break; \
37 } \
38 case LabelObjectType::NUMBER_OF_PIXELS: \
39 { \
40 using AccessorType = typename Functor::NumberOfPixelsLabelObjectAccessor<LabelObjectType>; \
41 AccessorType accessor; \
42 this->TemplatedGenerateData(accessor); \
43 break; \
44 } \
45 case LabelObjectType::PHYSICAL_SIZE: \
46 { \
47 using AccessorType = typename Functor::PhysicalSizeLabelObjectAccessor<LabelObjectType>; \
48 AccessorType accessor; \
49 this->TemplatedGenerateData(accessor); \
50 break; \
51 } \
52 case LabelObjectType::NUMBER_OF_PIXELS_ON_BORDER: \
53 { \
54 using AccessorType = typename Functor::NumberOfPixelsOnBorderLabelObjectAccessor<LabelObjectType>; \
55 AccessorType accessor; \
56 this->TemplatedGenerateData(accessor); \
57 break; \
58 } \
59 case LabelObjectType::PERIMETER_ON_BORDER: \
60 { \
61 using AccessorType = typename Functor::PerimeterOnBorderLabelObjectAccessor<LabelObjectType>; \
62 AccessorType accessor; \
63 this->TemplatedGenerateData(accessor); \
64 break; \
65 } \
66 case LabelObjectType::FERET_DIAMETER: \
67 { \
68 using AccessorType = typename Functor::FeretDiameterLabelObjectAccessor<LabelObjectType>; \
69 AccessorType accessor; \
70 this->TemplatedGenerateData(accessor); \
71 break; \
72 } \
73 case LabelObjectType::ELONGATION: \
74 { \
75 using AccessorType = typename Functor::ElongationLabelObjectAccessor<LabelObjectType>; \
76 AccessorType accessor; \
77 this->TemplatedGenerateData(accessor); \
78 break; \
79 } \
80 case LabelObjectType::PERIMETER: \
81 { \
82 using AccessorType = typename Functor::PerimeterLabelObjectAccessor<LabelObjectType>; \
83 AccessorType accessor; \
84 this->TemplatedGenerateData(accessor); \
85 break; \
86 } \
87 case LabelObjectType::ROUNDNESS: \
88 { \
89 using AccessorType = typename Functor::RoundnessLabelObjectAccessor<LabelObjectType>; \
90 AccessorType accessor; \
91 this->TemplatedGenerateData(accessor); \
92 break; \
93 } \
94 case LabelObjectType::EQUIVALENT_SPHERICAL_RADIUS: \
95 { \
96 using AccessorType = typename Functor::EquivalentSphericalRadiusLabelObjectAccessor<LabelObjectType>; \
97 AccessorType accessor; \
98 this->TemplatedGenerateData(accessor); \
99 break; \
100 } \
101 case LabelObjectType::EQUIVALENT_SPHERICAL_PERIMETER: \
102 { \
103 using AccessorType = typename Functor::EquivalentSphericalPerimeterLabelObjectAccessor<LabelObjectType>; \
104 AccessorType accessor; \
105 this->TemplatedGenerateData(accessor); \
106 break; \
107 } \
108 case LabelObjectType::FLATNESS: \
109 { \
110 using AccessorType = typename Functor::FlatnessLabelObjectAccessor<LabelObjectType>; \
111 AccessorType accessor; \
112 this->TemplatedGenerateData(accessor); \
113 break; \
114 } \
115 case LabelObjectType::PERIMETER_ON_BORDER_RATIO: \
116 { \
117 using AccessorType = typename Functor::PerimeterOnBorderRatioLabelObjectAccessor<LabelObjectType>; \
118 AccessorType accessor; \
119 this->TemplatedGenerateData(accessor); \
120 break; \
121 }
122
123
124#define itkStatisticsLabelMapFilterDispatchMacro() \
125 case LabelObjectType::MINIMUM: \
126 { \
127 using AccessorType = typename Functor::MinimumLabelObjectAccessor<LabelObjectType>; \
128 AccessorType accessor; \
129 this->TemplatedGenerateData(accessor); \
130 break; \
131 } \
132 case LabelObjectType::MAXIMUM: \
133 { \
134 using AccessorType = typename Functor::MaximumLabelObjectAccessor<LabelObjectType>; \
135 AccessorType accessor; \
136 this->TemplatedGenerateData(accessor); \
137 break; \
138 } \
139 case LabelObjectType::MEAN: \
140 { \
141 using AccessorType = typename Functor::MeanLabelObjectAccessor<LabelObjectType>; \
142 AccessorType accessor; \
143 this->TemplatedGenerateData(accessor); \
144 break; \
145 } \
146 case LabelObjectType::SUM: \
147 { \
148 using AccessorType = typename Functor::SumLabelObjectAccessor<LabelObjectType>; \
149 AccessorType accessor; \
150 this->TemplatedGenerateData(accessor); \
151 break; \
152 } \
153 case LabelObjectType::STANDARD_DEVIATION: \
154 { \
155 using AccessorType = typename Functor::StandardDeviationLabelObjectAccessor<LabelObjectType>; \
156 AccessorType accessor; \
157 this->TemplatedGenerateData(accessor); \
158 break; \
159 } \
160 case LabelObjectType::VARIANCE: \
161 { \
162 using AccessorType = typename Functor::VarianceLabelObjectAccessor<LabelObjectType>; \
163 AccessorType accessor; \
164 this->TemplatedGenerateData(accessor); \
165 break; \
166 } \
167 case LabelObjectType::MEDIAN: \
168 { \
169 using AccessorType = typename Functor::MedianLabelObjectAccessor<LabelObjectType>; \
170 AccessorType accessor; \
171 this->TemplatedGenerateData(accessor); \
172 break; \
173 } \
174 case LabelObjectType::KURTOSIS: \
175 { \
176 using AccessorType = typename Functor::KurtosisLabelObjectAccessor<LabelObjectType>; \
177 AccessorType accessor; \
178 this->TemplatedGenerateData(accessor); \
179 break; \
180 } \
181 case LabelObjectType::SKEWNESS: \
182 { \
183 using AccessorType = typename Functor::SkewnessLabelObjectAccessor<LabelObjectType>; \
184 AccessorType accessor; \
185 this->TemplatedGenerateData(accessor); \
186 break; \
187 } \
188 case LabelObjectType::WEIGHTED_ELONGATION: \
189 { \
190 using AccessorType = typename Functor::WeightedElongationLabelObjectAccessor<LabelObjectType>; \
191 AccessorType accessor; \
192 this->TemplatedGenerateData(accessor); \
193 break; \
194 } \
195 case LabelObjectType::WEIGHTED_FLATNESS: \
196 { \
197 using AccessorType = typename Functor::WeightedFlatnessLabelObjectAccessor<LabelObjectType>; \
198 AccessorType accessor; \
199 this->TemplatedGenerateData(accessor); \
200 break; \
201 }
202
203#endif