ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkStatisticsLabelObjectAccessors.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 itkStatisticsLabelObjectAccessors_h
19#define itkStatisticsLabelObjectAccessors_h
21
22/*
23 *
24 * This code was contributed in the Insight Journal paper:
25 * "Label object representation and manipulation with ITK"
26 * by Lehmann G.
27 * https://doi.org/10.54294/q6auw4
28 *
29 */
30
31namespace itk::Functor
32{
33template <typename TLabelObject>
35{
36public:
37 using LabelObjectType = TLabelObject;
38 using AttributeValueType = double;
39
41 operator()(const LabelObjectType * labelObject) const
42 {
43 return labelObject->GetMinimum();
44 }
45};
46
47template <typename TLabelObject>
49{
50public:
51 using LabelObjectType = TLabelObject;
52 using AttributeValueType = double;
53
55 operator()(const LabelObjectType * labelObject) const
56 {
57 return labelObject->GetMaximum();
58 }
59};
60
61template <typename TLabelObject>
63{
64public:
65 using LabelObjectType = TLabelObject;
66 using AttributeValueType = double;
67
69 operator()(const LabelObjectType * labelObject) const
70 {
71 return labelObject->GetMean();
72 }
73};
74
75template <typename TLabelObject>
77{
78public:
79 using LabelObjectType = TLabelObject;
80 using AttributeValueType = double;
81
83 operator()(const LabelObjectType * labelObject) const
84 {
85 return labelObject->GetSum();
86 }
87};
88
89template <typename TLabelObject>
91{
92public:
93 using LabelObjectType = TLabelObject;
94 using AttributeValueType = double;
95
97 operator()(const LabelObjectType * labelObject) const
98 {
99 return labelObject->GetStandardDeviation();
100 }
101};
102
103template <typename TLabelObject>
105{
106public:
107 using LabelObjectType = TLabelObject;
108 using AttributeValueType = double;
109
110 inline AttributeValueType
111 operator()(const LabelObjectType * labelObject) const
112 {
113 return labelObject->GetVariance();
114 }
115};
116
117template <typename TLabelObject>
119{
120public:
121 using LabelObjectType = TLabelObject;
122 using AttributeValueType = double;
123
124 inline AttributeValueType
125 operator()(const LabelObjectType * labelObject) const
126 {
127 return labelObject->GetMedian();
128 }
129};
130
131template <typename TLabelObject>
133{
134public:
135 using LabelObjectType = TLabelObject;
136 using AttributeValueType = typename LabelObjectType::IndexType;
137
138 inline AttributeValueType
139 operator()(const LabelObjectType * labelObject) const
140 {
141 return labelObject->GetMaximumIndex();
142 }
143};
144
145template <typename TLabelObject>
147{
148public:
149 using LabelObjectType = TLabelObject;
150 using AttributeValueType = typename LabelObjectType::IndexType;
151
152 inline AttributeValueType
153 operator()(const LabelObjectType * labelObject) const
154 {
155 return labelObject->GetMinimumIndex();
156 }
157};
158
159template <typename TLabelObject>
161{
162public:
163 using LabelObjectType = TLabelObject;
164 using AttributeValueType = typename LabelObjectType::PointType;
165
166 inline AttributeValueType
167 operator()(const LabelObjectType * labelObject) const
168 {
169 return labelObject->GetCenterOfGravity();
170 }
171};
172
173/*
174template< typename TLabelObject >
175class CentralMomentsLabelObjectAccessor
176{
177public:
178 using LabelObjectType = TLabelObject;
179 using AttributeValueType = typename LabelObjectType::MatrixType;
180
181 inline AttributeValueType operator()( const LabelObjectType * labelObject ) const
182 {
183 return labelObject->GetCentralMoments();
184 }
185 };
186*/
187
188template <typename TLabelObject>
190{
191public:
192 using LabelObjectType = TLabelObject;
193 using AttributeValueType = typename LabelObjectType::VectorType;
194
195 inline AttributeValueType
196 operator()(const LabelObjectType * labelObject) const
197 {
198 return labelObject->GetWeightedPrincipalMoments();
199 }
200};
201
202template <typename TLabelObject>
204{
205public:
206 using LabelObjectType = TLabelObject;
207 using AttributeValueType = typename LabelObjectType::MatrixType;
208
209 inline AttributeValueType
210 operator()(const LabelObjectType * labelObject) const
211 {
212 return labelObject->GetWeightedPrincipalAxes();
213 }
214};
215
216template <typename TLabelObject>
218{
219public:
220 using LabelObjectType = TLabelObject;
221 using AttributeValueType = double;
222
223 inline AttributeValueType
224 operator()(const LabelObjectType * labelObject) const
225 {
226 return labelObject->GetKurtosis();
227 }
228};
229
230template <typename TLabelObject>
232{
233public:
234 using LabelObjectType = TLabelObject;
235 using AttributeValueType = double;
236
237 inline AttributeValueType
238 operator()(const LabelObjectType * labelObject) const
239 {
240 return labelObject->GetSkewness();
241 }
242};
243
244template <typename TLabelObject>
246{
247public:
248 using LabelObjectType = TLabelObject;
249 using AttributeValueType = double;
250
251 inline AttributeValueType
252 operator()(const LabelObjectType * labelObject) const
253 {
254 return labelObject->GetWeightedElongation();
255 }
256};
257
258template <typename TLabelObject>
260{
261public:
262 using LabelObjectType = TLabelObject;
263
264 using AttributeValueType = typename LabelObjectType::HistogramType *;
265
266 inline AttributeValueType
267 operator()(const LabelObjectType * labelObject) const
268 {
269 return labelObject->GetHistogram();
270 }
271};
272
273template <typename TLabelObject>
275{
276public:
277 using LabelObjectType = TLabelObject;
278 using AttributeValueType = double;
279
280 inline AttributeValueType
281 operator()(const LabelObjectType * labelObject) const
282 {
283 return labelObject->GetWeightedFlatness();
284 }
285};
286} // namespace itk::Functor
287
288#endif
AttributeValueType operator()(const LabelObjectType *labelObject) const
typename LabelObjectType::HistogramType * 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