STIR  6.2.0
ROIValues.h
Go to the documentation of this file.
1 
11 /*
12  Copyright (C) 2000 PARAPET partners
13  Copyright (C) 2000- 2009, Hammersmith Imanet Ltd
14  This file is part of STIR.
15 
16  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
17 
18  See STIR/LICENSE.txt for details
19 */
20 
21 #ifndef __stir_evaluation_ROIValues__H__
22 #define __stir_evaluation_ROIValues__H__
23 
24 #include "stir/common.h"
25 
26 #include <string>
27 #include <iostream>
28 #include <algorithm>
29 
30 START_NAMESPACE_STIR
31 
40 class ROIValues
41 {
42 
43 public:
44  ROIValues() { init(); };
45 
46  ROIValues(float roi_volume, float integral, float integral_of_square, float min_value, float max_value)
47  : roi_volume(roi_volume),
48  integral(integral),
49  integral_of_square(integral_of_square),
50  min_value(min_value),
51  max_value(max_value)
52  {
53  update();
54  };
55 
58  {
59  roi_volume += iv.roi_volume;
60  integral += iv.integral;
61  integral_of_square += iv.integral_of_square;
62 
63  min_value = std::min(min_value, iv.min_value);
64  max_value = std::max(max_value, iv.max_value);
65 
66  update();
67  return *this;
68  };
69 
71  std::string report() const;
72 
74  float get_roi_volume() const { return roi_volume; }
76  float get_integral() const { return integral; }
78  float get_integral_of_square() const { return integral_of_square; }
80  float get_mean() const { return mean_value; }
82  float get_variance() const { return variance_value; }
84  float get_stddev() const { return std_value; }
86  float get_CV() const { return std_value / mean_value; }
88  float get_min() const { return min_value; }
90  float get_max() const { return max_value; }
91 
92  // friend ostream &operator <<( ostream &stream, ROIValues val);
93 
94 private:
95  float roi_volume;
96  float integral;
97  float integral_of_square;
98 
99  float mean_value;
100  float variance_value;
101  float std_value;
102 
103  float min_value;
104  float max_value;
105 
106  void init();
107  void update();
108 };
109 
110 END_NAMESPACE_STIR
111 
112 #endif
float get_integral_of_square() const
Sum of squares times voxel volume.
Definition: ROIValues.h:78
float get_variance() const
Variance.
Definition: ROIValues.h:82
float get_roi_volume() const
Total valume (in mm^3)
Definition: ROIValues.h:74
ROIValues operator+=(const ROIValues &iv)
Combine the ROI values appropriately.
Definition: ROIValues.h:57
float get_max() const
Maximum value in the ROI.
Definition: ROIValues.h:90
float get_integral() const
Sum of elements times voxel volume.
Definition: ROIValues.h:76
A class to store and get results of an ROI calculation.
Definition: ROIValues.h:40
float get_mean() const
Mean value.
Definition: ROIValues.h:80
basic configuration include file
float get_stddev() const
Standard deviation.
Definition: ROIValues.h:84
float get_CV() const
Coefficient of Variance =stddev/mean)
Definition: ROIValues.h:86
float get_min() const
Minimum value in the ROI.
Definition: ROIValues.h:88