ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkStatisticsLabelObjectAccessors.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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://hdl.handle.net/1926/584
28  * http://www.insight-journal.org/browse/publication/176
29  *
30  */
31 
32 namespace itk
33 {
34 namespace Functor
35 {
36 template< typename TLabelObject >
38 {
39 public:
40  using LabelObjectType = TLabelObject;
41  using AttributeValueType = double;
42 
43  inline AttributeValueType 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 operator()(const LabelObjectType *labelObject) const
57  {
58  return labelObject->GetMaximum();
59  }
60 };
61 
62 template< typename TLabelObject >
64 {
65 public:
66  using LabelObjectType = TLabelObject;
67  using AttributeValueType = double;
68 
69  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
70  {
71  return labelObject->GetMean();
72  }
73 };
74 
75 template< typename TLabelObject >
77 {
78 public:
79  using LabelObjectType = TLabelObject;
80  using AttributeValueType = double;
81 
82  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
83  {
84  return labelObject->GetSum();
85  }
86 };
87 
88 template< typename TLabelObject >
90 {
91 public:
92  using LabelObjectType = TLabelObject;
93  using AttributeValueType = double;
94 
95  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
96  {
97  return labelObject->GetStandardDeviation();
98  }
99 };
100 
101 template< typename TLabelObject >
103 {
104 public:
105  using LabelObjectType = TLabelObject;
106  using AttributeValueType = double;
107 
108  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
109  {
110  return labelObject->GetVariance();
111  }
112 };
113 
114 template< typename TLabelObject >
116 {
117 public:
118  using LabelObjectType = TLabelObject;
119  using AttributeValueType = double;
120 
121  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
122  {
123  return labelObject->GetMedian();
124  }
125 };
126 
127 template< typename TLabelObject >
129 {
130 public:
131  using LabelObjectType = TLabelObject;
133 
134  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
135  {
136  return labelObject->GetMaximumIndex();
137  }
138 };
139 
140 template< typename TLabelObject >
142 {
143 public:
144  using LabelObjectType = TLabelObject;
146 
147  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
148  {
149  return labelObject->GetMinimumIndex();
150  }
151 };
152 
153 template< typename TLabelObject >
155 {
156 public:
157  using LabelObjectType = TLabelObject;
159 
160  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
161  {
162  return labelObject->GetCenterOfGravity();
163  }
164 };
165 
166 /*
167 template< typename TLabelObject >
168 class CentralMomentsLabelObjectAccessor
169 {
170 public:
171  using LabelObjectType = TLabelObject;
172  using AttributeValueType = typename LabelObjectType::MatrixType;
173 
174  inline AttributeValueType operator()( const LabelObjectType * labelObject ) const
175  {
176  return labelObject->GetCentralMoments();
177  }
178  };
179 */
180 
181 template< typename TLabelObject >
183 {
184 public:
185  using LabelObjectType = TLabelObject;
187 
188  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
189  {
190  return labelObject->GetWeightedPrincipalMoments();
191  }
192 };
193 
194 template< typename TLabelObject >
196 {
197 public:
198  using LabelObjectType = TLabelObject;
199  using AttributeValueType = typename LabelObjectType::MatrixType;
200 
201  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
202  {
203  return labelObject->GetWeightedPrincipalAxes();
204  }
205 };
206 
207 template< typename TLabelObject >
209 {
210 public:
211  using LabelObjectType = TLabelObject;
212  using AttributeValueType = double;
213 
214  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
215  {
216  return labelObject->GetKurtosis();
217  }
218 };
219 
220 template< typename TLabelObject >
222 {
223 public:
224  using LabelObjectType = TLabelObject;
225  using AttributeValueType = double;
226 
227  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
228  {
229  return labelObject->GetSkewness();
230  }
231 };
232 
233 template< typename TLabelObject >
235 {
236 public:
237  using LabelObjectType = TLabelObject;
238  using AttributeValueType = double;
239 
240  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
241  {
242  return labelObject->GetWeightedElongation();
243  }
244 };
245 
246 template< typename TLabelObject >
248 {
249 public:
250  using LabelObjectType = TLabelObject;
251 
252  using AttributeValueType = typename LabelObjectType::HistogramType *;
253 
254  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
255  {
256  return labelObject->GetHistogram();
257  }
258 };
259 
260 template< typename TLabelObject >
262 {
263 public:
264  using LabelObjectType = TLabelObject;
265  using AttributeValueType = double;
266 
267  inline AttributeValueType operator()(const LabelObjectType *labelObject) const
268  {
269  return labelObject->GetWeightedFlatness();
270  }
271 };
272 }
273 } // end namespace itk
274 
275 #endif
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
typename LabelObjectType::HistogramType * AttributeValueType
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const