ITK  5.4.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://www.insight-journal.org/browse/publication/176
28  *
29  */
30 
31 namespace itk
32 {
33 namespace Functor
34 {
35 template <typename TLabelObject>
37 {
38 public:
39  using LabelObjectType = TLabelObject;
40  using AttributeValueType = double;
41 
42  inline AttributeValueType
43  operator()(const LabelObjectType * labelObject) const
44  {
45  return labelObject->GetMinimum();
46  }
47 };
48 
49 template <typename TLabelObject>
51 {
52 public:
53  using LabelObjectType = TLabelObject;
54  using AttributeValueType = double;
55 
56  inline AttributeValueType
57  operator()(const LabelObjectType * labelObject) const
58  {
59  return labelObject->GetMaximum();
60  }
61 };
62 
63 template <typename TLabelObject>
65 {
66 public:
67  using LabelObjectType = TLabelObject;
68  using AttributeValueType = double;
69 
70  inline AttributeValueType
71  operator()(const LabelObjectType * labelObject) const
72  {
73  return labelObject->GetMean();
74  }
75 };
76 
77 template <typename TLabelObject>
79 {
80 public:
81  using LabelObjectType = TLabelObject;
82  using AttributeValueType = double;
83 
84  inline AttributeValueType
85  operator()(const LabelObjectType * labelObject) const
86  {
87  return labelObject->GetSum();
88  }
89 };
90 
91 template <typename TLabelObject>
93 {
94 public:
95  using LabelObjectType = TLabelObject;
96  using AttributeValueType = double;
97 
98  inline AttributeValueType
99  operator()(const LabelObjectType * labelObject) const
100  {
101  return labelObject->GetStandardDeviation();
102  }
103 };
104 
105 template <typename TLabelObject>
107 {
108 public:
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 
119 template <typename TLabelObject>
121 {
122 public:
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 
133 template <typename TLabelObject>
135 {
136 public:
137  using LabelObjectType = TLabelObject;
139 
140  inline AttributeValueType
141  operator()(const LabelObjectType * labelObject) const
142  {
143  return labelObject->GetMaximumIndex();
144  }
145 };
146 
147 template <typename TLabelObject>
149 {
150 public:
151  using LabelObjectType = TLabelObject;
153 
154  inline AttributeValueType
155  operator()(const LabelObjectType * labelObject) const
156  {
157  return labelObject->GetMinimumIndex();
158  }
159 };
160 
161 template <typename TLabelObject>
163 {
164 public:
165  using LabelObjectType = TLabelObject;
167 
168  inline AttributeValueType
169  operator()(const LabelObjectType * labelObject) const
170  {
171  return labelObject->GetCenterOfGravity();
172  }
173 };
174 
175 /*
176 template< typename TLabelObject >
177 class CentralMomentsLabelObjectAccessor
178 {
179 public:
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 
190 template <typename TLabelObject>
192 {
193 public:
194  using LabelObjectType = TLabelObject;
196 
197  inline AttributeValueType
198  operator()(const LabelObjectType * labelObject) const
199  {
200  return labelObject->GetWeightedPrincipalMoments();
201  }
202 };
203 
204 template <typename TLabelObject>
206 {
207 public:
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 
218 template <typename TLabelObject>
220 {
221 public:
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 
232 template <typename TLabelObject>
234 {
235 public:
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 
246 template <typename TLabelObject>
248 {
249 public:
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 
260 template <typename TLabelObject>
262 {
263 public:
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 
275 template <typename TLabelObject>
277 {
278 public:
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
itk::Functor::MaximumIndexLabelObjectAccessor::AttributeValueType
typename LabelObjectType::IndexType AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:138
itk::Functor::WeightedElongationLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:250
itk::Functor::MedianLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:120
itk::Functor::WeightedPrincipalAxesLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:208
itk::Functor::WeightedPrincipalAxesLabelObjectAccessor::AttributeValueType
typename LabelObjectType::MatrixType AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:209
itk::Functor::MinimumIndexLabelObjectAccessor::AttributeValueType
typename LabelObjectType::IndexType AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:152
itk::Functor::MaximumIndexLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:134
itk::Functor::WeightedFlatnessLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:276
itk::Functor::WeightedFlatnessLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:280
itk::Functor::WeightedElongationLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:251
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::Functor::MinimumIndexLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:148
itk::Functor::KurtosisLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:219
itk::Functor::VarianceLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:109
itk::Functor::StandardDeviationLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:95
itk::Functor::WeightedFlatnessLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:283
itk::Functor::CenterOfGravityLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:165
itk::Functor::SumLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:85
itk::Functor::MaximumIndexLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:141
itk::Functor::KurtosisLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:223
itk::Functor::CenterOfGravityLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:162
itk::Functor::SkewnessLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:237
itk::Functor::MinimumLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:40
itk::Functor::MinimumLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:36
itk::Functor::MinimumIndexLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:151
itkShapeLabelObjectAccessors.h
itk::Functor::CenterOfGravityLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:169
itk::Functor::HistogramLabelObjectAccessor::AttributeValueType
typename LabelObjectType::HistogramType * AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:266
itk::Functor::HistogramLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:264
itk::Functor::VarianceLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:110
itk::Functor::SkewnessLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:240
itk::Functor::MedianLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:124
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::Functor::WeightedElongationLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:247
itk::Functor::SumLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:82
itk::Functor::SumLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:81
itk::Functor::MeanLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:71
itk::Functor::MeanLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:68
itk::Functor::StandardDeviationLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:92
itk::Functor::SumLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:78
itk::Functor::MaximumLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:53
itk::Functor::VarianceLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:113
itk::Functor::CenterOfGravityLabelObjectAccessor::AttributeValueType
typename LabelObjectType::PointType AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:166
itk::Functor::WeightedFlatnessLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:279
itk::Functor::MinimumLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:39
itk::Functor::MaximumLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:54
itk::Functor::WeightedPrincipalMomentsLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:198
itk::Functor::WeightedElongationLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:254
itk::Functor::SkewnessLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:233
itk::Functor::SkewnessLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:236
itk::Functor::HistogramLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:261
itk::Functor::VarianceLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:106
itk::Functor::MaximumIndexLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:137
itk::Functor::MeanLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:67
itk::Functor::WeightedPrincipalMomentsLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:194
itk::Functor::HistogramLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:269
itk::Functor::MinimumIndexLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:155
itk::Functor::KurtosisLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:226
itk::Functor::MedianLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:127
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Functor::MaximumLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:57
itk::Functor::KurtosisLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:222
itk::Functor::WeightedPrincipalMomentsLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:191
itk::Functor::StandardDeviationLabelObjectAccessor::AttributeValueType
double AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:96
itk::Functor::MaximumLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:50
itk::Functor::WeightedPrincipalMomentsLabelObjectAccessor::AttributeValueType
typename LabelObjectType::VectorType AttributeValueType
Definition: itkStatisticsLabelObjectAccessors.h:195
itk::Functor::MeanLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:64
itk::Functor::MedianLabelObjectAccessor::LabelObjectType
TLabelObject LabelObjectType
Definition: itkStatisticsLabelObjectAccessors.h:123
itk::Functor::WeightedPrincipalAxesLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:212
itk::Functor::StandardDeviationLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:99
itk::Functor::WeightedPrincipalAxesLabelObjectAccessor
Definition: itkStatisticsLabelObjectAccessors.h:205
itk::Functor::MinimumLabelObjectAccessor::operator()
AttributeValueType operator()(const LabelObjectType *labelObject) const
Definition: itkStatisticsLabelObjectAccessors.h:43