ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkShapeLabelObjectAccessors.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 itkShapeLabelObjectAccessors_h
19#define itkShapeLabelObjectAccessors_h
20
22#include "itkIntTypes.h"
23
24/*
25 *
26 * This code was contributed in the Insight Journal paper:
27 * "Label object representation and manipulation with ITK"
28 * by Lehmann G.
29 * https://doi.org/10.54294/q6auw4
30 *
31 */
32
33namespace itk::Functor
34{
35template <typename TLabelObject>
37{
38public:
39 using LabelObjectType = TLabelObject;
41
43 operator()(const LabelObjectType * labelObject) const
44 {
45 return labelObject->GetNumberOfPixels();
46 }
47};
48
49template <typename TLabelObject>
51{
52public:
53 using LabelObjectType = TLabelObject;
54 using AttributeValueType = typename LabelObjectType::RegionType;
55
57 operator()(const LabelObjectType * labelObject) const
58 {
59 return labelObject->GetBoundingBox();
60 }
61};
62
63template <typename TLabelObject>
65{
66public:
67 using LabelObjectType = TLabelObject;
68 using AttributeValueType = double;
69
71 operator()(const LabelObjectType * labelObject) const
72 {
73 return labelObject->GetPhysicalSize();
74 }
75};
76
77template <typename TLabelObject>
79{
80public:
81 using LabelObjectType = TLabelObject;
83
85 operator()(const LabelObjectType * labelObject) const
86 {
87 return labelObject->GetNumberOfPixelsOnBorder();
88 }
89};
90
91template <typename TLabelObject>
93{
94public:
95 using LabelObjectType = TLabelObject;
96 using AttributeValueType = double;
97
99 operator()(const LabelObjectType * labelObject) const
100 {
101 return labelObject->GetPerimeterOnBorder();
102 }
103};
104
105template <typename TLabelObject>
107{
108public:
109 using LabelObjectType = TLabelObject;
110 using AttributeValueType = typename LabelObjectType::CentroidType;
111
112 inline AttributeValueType
113 operator()(const LabelObjectType * labelObject) const
114 {
115 return labelObject->GetCentroid();
116 }
117};
118
119template <typename TLabelObject>
121{
122public:
123 using LabelObjectType = TLabelObject;
124 using AttributeValueType = double;
125
126 inline AttributeValueType
127 operator()(const LabelObjectType * labelObject) const
128 {
129 return labelObject->GetFeretDiameter();
130 }
131};
132
133template <typename TLabelObject>
135{
136public:
137 using LabelObjectType = TLabelObject;
138 using AttributeValueType = typename LabelObjectType::VectorType;
139
140 inline AttributeValueType
141 operator()(const LabelObjectType * labelObject) const
142 {
143 return labelObject->GetPrincipalMoments();
144 }
145};
146
147template <typename TLabelObject>
149{
150public:
151 using LabelObjectType = TLabelObject;
152 using AttributeValueType = typename LabelObjectType::MatrixType;
153
154 inline AttributeValueType
155 operator()(const LabelObjectType * labelObject) const
156 {
157 return labelObject->GetPrincipalAxes();
158 }
159};
160
161template <typename TLabelObject>
163{
164public:
165 using LabelObjectType = TLabelObject;
166 using AttributeValueType = double;
167
168 inline AttributeValueType
169 operator()(const LabelObjectType * labelObject) const
170 {
171 return labelObject->GetElongation();
172 }
173};
174
175template <typename TLabelObject>
177{
178public:
179 using LabelObjectType = TLabelObject;
180 using AttributeValueType = double;
181
182 inline AttributeValueType
183 operator()(const LabelObjectType * labelObject) const
184 {
185 return labelObject->GetPerimeter();
186 }
187};
188
189template <typename TLabelObject>
191{
192public:
193 using LabelObjectType = TLabelObject;
194 using AttributeValueType = double;
195
196 inline AttributeValueType
197 operator()(const LabelObjectType * labelObject) const
198 {
199 return labelObject->GetRoundness();
200 }
201};
202
203template <typename TLabelObject>
205{
206public:
207 using LabelObjectType = TLabelObject;
208 using AttributeValueType = double;
209
210 inline AttributeValueType
211 operator()(const LabelObjectType * labelObject) const
212 {
213 return labelObject->GetEquivalentSphericalRadius();
214 }
215};
216
217template <typename TLabelObject>
219{
220public:
221 using LabelObjectType = TLabelObject;
222 using AttributeValueType = double;
223
224 inline AttributeValueType
225 operator()(const LabelObjectType * labelObject) const
226 {
227 return labelObject->GetEquivalentSphericalPerimeter();
228 }
229};
230
231template <typename TLabelObject>
233{
234public:
235 using LabelObjectType = TLabelObject;
236 using AttributeValueType = typename LabelObjectType::VectorType;
237
238 inline AttributeValueType
239 operator()(const LabelObjectType * labelObject) const
240 {
241 return labelObject->GetEquivalentEllipsoidDiameter();
242 }
243};
244
245template <typename TLabelObject>
247{
248public:
249 using LabelObjectType = TLabelObject;
250 using AttributeValueType = double;
251
252 inline AttributeValueType
253 operator()(const LabelObjectType * labelObject) const
254 {
255 return labelObject->GetFlatness();
256 }
257};
258
259template <typename TLabelObject>
261{
262public:
263 using LabelObjectType = TLabelObject;
264 using AttributeValueType = double;
265
266 inline AttributeValueType
267 operator()(const LabelObjectType * labelObject) const
268 {
269 return labelObject->GetPerimeterOnBorderRatio();
270 }
271};
272
273} // namespace itk::Functor
274
275#endif
AttributeValueType operator()(const LabelObjectType *labelObject) const
typename LabelObjectType::RegionType AttributeValueType
typename LabelObjectType::CentroidType AttributeValueType
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
unsigned long SizeValueType
Definition itkIntTypes.h:86