18 #ifndef __itkStatisticsLabelObject_h
19 #define __itkStatisticsLabelObject_h
40 template<
class TLabel,
unsigned int VImageDimension >
60 itkStaticConstMacro(ImageDimension,
unsigned int, VImageDimension);
68 typedef typename Superclass::LineType
LineType;
100 if ( s ==
"Minimum" )
104 else if ( s ==
"Maximum" )
108 else if ( s ==
"Mean" )
112 else if ( s ==
"Sum" )
116 else if ( s ==
"StandardDeviation" )
118 return STANDARD_DEVIATION;
120 else if ( s ==
"Variance" )
124 else if ( s ==
"Median" )
128 else if ( s ==
"MaximumIndex" )
130 return MAXIMUM_INDEX;
132 else if ( s ==
"MinimumIndex" )
134 return MINIMUM_INDEX;
136 else if ( s ==
"CenterOfGravity" )
138 return CENTER_OF_GRAVITY;
146 else if ( s ==
"WeightedPrincipalMoments" )
148 return WEIGHTED_PRINCIPAL_MOMENTS;
150 else if ( s ==
"WeightedPrincipalAxes" )
152 return WEIGHTED_PRINCIPAL_AXES;
154 else if ( s ==
"Kurtosis" )
158 else if ( s ==
"Skewness" )
162 else if ( s ==
"WeightedElongation" )
164 return WEIGHTED_ELONGATION;
166 else if ( s ==
"Histogram" )
170 else if ( s ==
"WeightedFlatness" )
172 return WEIGHTED_FLATNESS;
175 return Superclass::GetAttributeFromName(s);
194 case STANDARD_DEVIATION:
195 return "StandardDeviation";
204 return "MaximumIndex";
207 return "MinimumIndex";
209 case CENTER_OF_GRAVITY:
210 return "CenterOfGravity";
215 case WEIGHTED_PRINCIPAL_MOMENTS:
216 return "WeightedPrincipalMoments";
218 case WEIGHTED_PRINCIPAL_AXES:
219 return "WeightedPrincipalAxes";
227 case WEIGHTED_ELONGATION:
228 return "WeightedElongation";
233 case WEIGHTED_FLATNESS:
234 return "WeightedFlatness";
238 return Superclass::GetNameFromAttribute(a);
247 Superclass::CopyAttributesFrom(lo);
250 const Self *src =
dynamic_cast< const Self *
>( lo );
255 m_Minimum = src->m_Minimum;
256 m_Maximum = src->m_Maximum;
257 m_Mean = src->m_Mean;
259 m_StandardDeviation = src->m_StandardDeviation;
260 m_Variance = src->m_Variance;
261 m_Median = src->m_Median;
262 m_MaximumIndex = src->m_MaximumIndex;
263 m_MinimumIndex = src->m_MinimumIndex;
264 m_CenterOfGravity = src->m_CenterOfGravity;
266 m_WeightedPrincipalMoments = src->m_WeightedPrincipalMoments;
267 m_WeightedPrincipalAxes = src->m_WeightedPrincipalAxes;
268 m_Kurtosis = src->m_Kurtosis;
269 m_Skewness = src->m_Skewness;
270 m_WeightedElongation = src->m_WeightedElongation;
271 m_Histogram = src->m_Histogram;
272 m_WeightedFlatness = src->m_WeightedFlatness;
275 const double & GetMinimum()
const
280 void SetMinimum(
const double & v)
285 const double & GetMaximum()
const
290 void SetMaximum(
const double & v)
295 const double & GetMean()
const
300 void SetMean(
const double & v)
305 const double & GetSum()
const
310 void SetSum(
const double & v)
315 const double & GetStandardDeviation()
const
317 return m_StandardDeviation;
320 void SetStandardDeviation(
const double & v)
322 m_StandardDeviation = v;
325 const double & GetVariance()
const
330 void SetVariance(
const double & v)
335 const double & GetMedian()
const
340 void SetMedian(
const double & v)
347 return m_MaximumIndex;
357 return m_MinimumIndex;
367 return m_CenterOfGravity;
372 m_CenterOfGravity = v;
388 return m_WeightedPrincipalMoments;
393 m_WeightedPrincipalMoments = v;
398 return m_WeightedPrincipalAxes;
403 m_WeightedPrincipalAxes = v;
406 const double & GetSkewness()
const
411 void SetSkewness(
const double & v)
416 const double & GetKurtosis()
const
421 void SetKurtosis(
const double & v)
426 const double & GetWeightedElongation()
const
428 return m_WeightedElongation;
431 void SetWeightedElongation(
const double & v)
433 m_WeightedElongation = v;
446 const double & GetWeightedFlatness()
const
448 return m_WeightedFlatness;
451 void SetWeightedFlatness(
const double & v)
453 m_WeightedFlatness = v;
468 for (
unsigned int i = 0; i < ImageDimension; i++ )
470 offset[i] = m_CenterOfGravity[i];
471 for (
unsigned int j = 0; j < ImageDimension; j++ )
473 matrix[j][i] = m_WeightedPrincipalAxes[i][j];
480 result->SetMatrix(matrix);
481 result->SetOffset(offset);
494 for (
unsigned int i = 0; i < ImageDimension; i++ )
496 offset[i] = m_CenterOfGravity[i];
497 for (
unsigned int j = 0; j < ImageDimension; j++ )
499 matrix[j][i] = m_WeightedPrincipalAxes[i][j];
505 result->SetMatrix(matrix);
506 result->SetOffset(offset);
509 result->GetInverse(inverse);
521 m_StandardDeviation = 0;
524 m_MaximumIndex.Fill(0);
525 m_MinimumIndex.Fill(0);
526 m_CenterOfGravity.Fill(0);
528 m_WeightedPrincipalMoments.Fill(0);
529 m_WeightedPrincipalAxes.Fill(0);
532 m_WeightedElongation = 0;
534 m_WeightedFlatness = 0;
537 void PrintSelf(std::ostream & os,
Indent indent)
const
539 Superclass::PrintSelf(os, indent);
541 os << indent <<
"Minimum: " << m_Minimum << std::endl;
542 os << indent <<
"Maximum: " << m_Maximum << std::endl;
543 os << indent <<
"Mean: " << m_Mean << std::endl;
544 os << indent <<
"Sum: " << m_Sum << std::endl;
545 os << indent <<
"StandardDeviation: " << m_StandardDeviation << std::endl;
546 os << indent <<
"Variance: " << m_Variance << std::endl;
547 os << indent <<
"Median: " << m_Median << std::endl;
548 os << indent <<
"Skewness: " << m_Skewness << std::endl;
549 os << indent <<
"Kurtosis: " << m_Kurtosis << std::endl;
550 os << indent <<
"WeightedElongation: " << m_WeightedElongation << std::endl;
551 os << indent <<
"WeightedFlatness: " << m_WeightedFlatness << std::endl;
552 os << indent <<
"MaximumIndex: " << m_MaximumIndex << std::endl;
553 os << indent <<
"MinimumIndex: " << m_MinimumIndex << std::endl;
554 os << indent <<
"CenterOfGravity: " << m_CenterOfGravity << std::endl;
556 os << indent <<
"WeightedPrincipalMoments: " << m_WeightedPrincipalMoments << std::endl;
557 os << indent <<
"WeightedPrincipalAxes: " << std::endl << m_WeightedPrincipalAxes;
558 os << indent <<
"Histogram: ";
559 if ( m_Histogram.IsNull() )
561 os <<
"NULL" << std::endl;
565 m_Histogram->Print(os, indent);
571 void operator=(
const Self &);