ITK  4.8.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  * http://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  typedef TLabelObject LabelObjectType;
41  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
54  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
67  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
80  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
93  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
106  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
119  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
132  typedef typename LabelObjectType::IndexType AttributeValueType;
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  typedef TLabelObject LabelObjectType;
145  typedef typename LabelObjectType::IndexType AttributeValueType;
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  typedef TLabelObject LabelObjectType;
158  typedef typename LabelObjectType::PointType AttributeValueType;
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  typedef TLabelObject LabelObjectType;
172  typedef typename LabelObjectType::MatrixType AttributeValueType;
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  typedef TLabelObject LabelObjectType;
186  typedef typename LabelObjectType::VectorType AttributeValueType;
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  typedef TLabelObject LabelObjectType;
199  typedef typename LabelObjectType::MatrixType AttributeValueType;
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  typedef TLabelObject LabelObjectType;
212  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
225  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
238  typedef double AttributeValueType;
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  typedef TLabelObject LabelObjectType;
251 
252  typedef typename LabelObjectType::HistogramType *AttributeValueType;
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  typedef TLabelObject LabelObjectType;
265  typedef double AttributeValueType;
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
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const
AttributeValueType operator()(const LabelObjectType *labelObject) const