ITK  6.0.0
Insight Toolkit
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
32{
33namespace Functor
34{
35template <typename TLabelObject>
37{
38public:
39 using LabelObjectType = TLabelObject;
40 using AttributeValueType = double;
41
43 operator()(const LabelObjectType * labelObject) const
44 {
45 return labelObject->GetMinimum();
46 }
47};
48
49template <typename TLabelObject>
51{
52public:
53 using LabelObjectType = TLabelObject;
54 using AttributeValueType = double;
55
57 operator()(const LabelObjectType * labelObject) const
58 {
59 return labelObject->GetMaximum();
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->GetMean();
74 }
75};
76
77template <typename TLabelObject>
79{
80public:
81 using LabelObjectType = TLabelObject;
82 using AttributeValueType = double;
83
85 operator()(const LabelObjectType * labelObject) const
86 {
87 return labelObject->GetSum();
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->GetStandardDeviation();
102 }
103};
104
105template <typename TLabelObject>
107{
108public:
109 using LabelObjectType = TLabelObject;
110 using AttributeValueType = double;
111
112 inline AttributeValueType
113 operator()(const LabelObjectType * labelObject) const
114 {
115 return labelObject->GetVariance();
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->GetMedian();
130 }
131};
132
133template <typename TLabelObject>
135{
136public:
137 using LabelObjectType = TLabelObject;
139
140 inline AttributeValueType
141 operator()(const LabelObjectType * labelObject) const
142 {
143 return labelObject->GetMaximumIndex();
144 }
145};
146
147template <typename TLabelObject>
149{
150public:
151 using LabelObjectType = TLabelObject;
153
154 inline AttributeValueType
155 operator()(const LabelObjectType * labelObject) const
156 {
157 return labelObject->GetMinimumIndex();
158 }
159};
160
161template <typename TLabelObject>
163{
164public:
165 using LabelObjectType = TLabelObject;
167
168 inline AttributeValueType
169 operator()(const LabelObjectType * labelObject) const
170 {
171 return labelObject->GetCenterOfGravity();
172 }
173};
174
175/*
176template< typename TLabelObject >
177class CentralMomentsLabelObjectAccessor
178{
179public:
180 using LabelObjectType = TLabelObject;
181 using AttributeValueType = typename LabelObjectType::MatrixType;
182
183 inline AttributeValueType operator()( const LabelObjectType * labelObject ) const
184 {
185 return labelObject->GetCentralMoments();
186 }
187 };
188*/
189
190template <typename TLabelObject>
192{
193public:
194 using LabelObjectType = TLabelObject;
196
197 inline AttributeValueType
198 operator()(const LabelObjectType * labelObject) const
199 {
200 return labelObject->GetWeightedPrincipalMoments();
201 }
202};
203
204template <typename TLabelObject>
206{
207public:
208 using LabelObjectType = TLabelObject;
209 using AttributeValueType = typename LabelObjectType::MatrixType;
210
211 inline AttributeValueType
212 operator()(const LabelObjectType * labelObject) const
213 {
214 return labelObject->GetWeightedPrincipalAxes();
215 }
216};
217
218template <typename TLabelObject>
220{
221public:
222 using LabelObjectType = TLabelObject;
223 using AttributeValueType = double;
224
225 inline AttributeValueType
226 operator()(const LabelObjectType * labelObject) const
227 {
228 return labelObject->GetKurtosis();
229 }
230};
231
232template <typename TLabelObject>
234{
235public:
236 using LabelObjectType = TLabelObject;
237 using AttributeValueType = double;
238
239 inline AttributeValueType
240 operator()(const LabelObjectType * labelObject) const
241 {
242 return labelObject->GetSkewness();
243 }
244};
245
246template <typename TLabelObject>
248{
249public:
250 using LabelObjectType = TLabelObject;
251 using AttributeValueType = double;
252
253 inline AttributeValueType
254 operator()(const LabelObjectType * labelObject) const
255 {
256 return labelObject->GetWeightedElongation();
257 }
258};
259
260template <typename TLabelObject>
262{
263public:
264 using LabelObjectType = TLabelObject;
265
266 using AttributeValueType = typename LabelObjectType::HistogramType *;
267
268 inline AttributeValueType
269 operator()(const LabelObjectType * labelObject) const
270 {
271 return labelObject->GetHistogram();
272 }
273};
274
275template <typename TLabelObject>
277{
278public:
279 using LabelObjectType = TLabelObject;
280 using AttributeValueType = double;
281
282 inline AttributeValueType
283 operator()(const LabelObjectType * labelObject) const
284 {
285 return labelObject->GetWeightedFlatness();
286 }
287};
288} // namespace Functor
289} // end namespace itk
290
291#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
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....