Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkCollectionStatistic.h
Go to the documentation of this file.
1 #ifndef mitkCollectionStatistic_h
2 #define mitkCollectionStatistic_h
3 
4 #include <MitkDataCollectionExports.h>
5 
6 #include <mitkDataCollection.h>
7 
8 #include <iostream>
9 
10 namespace mitk {
11 struct MITKDATACOLLECTION_EXPORT StatisticData
12 {
13  unsigned int m_TruePositive;
14  unsigned int m_FalsePositive;
15  unsigned int m_TrueNegative;
16  unsigned int m_FalseNegative;
17 
18  double m_DICE;
19  double m_Jaccard;
20  double m_Sensitivity;
21  double m_Specificity;
22  double m_RMSD;
23 
25  m_TruePositive(0), m_FalsePositive(0), m_TrueNegative(0), m_FalseNegative(0),
26  m_DICE(0), m_Jaccard(0), m_Sensitivity(0), m_Specificity(0), m_RMSD(-1.0)
27  {}
28 };
29 
31 {
32 public:
33  virtual unsigned char operator() (unsigned char value) const = 0;
34 };
35 
37 {
38 public:
39  unsigned char operator() (unsigned char value) const
40  {
41  return value;
42  }
43 };
44 
46 {
47 public:
48  unsigned char operator() (unsigned char value) const
49  {
50  if (value == 1 || value == 5)
51  return 0;
52  else
53  return 1;
54  }
55 };
56 
58 {
59 public:
60  unsigned char operator() (unsigned char value) const
61  {
62  if (value == 1 || value == 0)
63  return 0;
64  else
65  return 1;
66  }
67 };
68 
69 class MITKDATACOLLECTION_EXPORT CollectionStatistic
70 {
71 public:
72 
75 
76  typedef std::vector<StatisticData> DataVector;
77  typedef std::vector<DataVector> MultiDataVector;
78 
79  void SetCollection(DataCollection::Pointer collection);
80  DataCollection::Pointer GetCollection();
81 
82  void SetClassCount (size_t count);
83  size_t GetClassCount();
84 
85  void SetGoldName(std::string name);
86  std::string GetGoldName();
87 
88  void SetTestName(std::string name);
89  std::string GetTestName();
90 
91  void SetMaskName(std::string name) {m_MaskName = name; }
92 
93  void SetGroundTruthValueToIndexMapper(const ValueToIndexMapper* mapper);
94  const ValueToIndexMapper* GetGroundTruthValueToIndexMapper(void) const;
95 
96  void SetTestValueToIndexMapper(const ValueToIndexMapper* mapper);
97  const ValueToIndexMapper* GetTestValueToIndexMapper(void) const;
98 
99  void Print(std::ostream& out, std::ostream& sout = std::cout, bool withHeader = false, std::string label = "None");
100  bool Update();
101  int IsInSameVirtualClass(unsigned char gold, unsigned char test);
102 
108  std::vector<StatisticData> GetStatisticData(unsigned char c) const;
109 
113  void ComputeRMSD();
114 
115 private:
116  size_t m_ClassCount;
117  std::string m_GroundTruthName;
118  std::string m_TestName;
119  std::string m_MaskName;
120  DataCollection::Pointer m_Collection;
121 
122  std::vector<unsigned char> m_ConnectionGold;
123  std::vector<unsigned char> m_ConnectionTest;
124  std::vector<unsigned char> m_ConnectionClass;
125  size_t m_VituralClassCount;
126 
127  MultiDataVector m_ImageClassStatistic;
128  std::vector<std::string> m_ImageNames;
129  DataVector m_ImageStatistic;
130  StatisticData m_MeanCompleteStatistic;
131  StatisticData m_CompleteStatistic;
132 
133  const ValueToIndexMapper* m_GroundTruthValueToIndexMapper;
134  const ValueToIndexMapper* m_TestValueToIndexMapper;
135 };
136 }
137 
138 #endif // mitkCollectionStatistic_h
unsigned char operator()(unsigned char value) const
unsigned char operator()(unsigned char value) const
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:32
virtual unsigned char operator()(unsigned char value) const =0
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
DataCollection - Class to facilitate loading/accessing structured data.
void SetMaskName(std::string name)
std::vector< DataVector > MultiDataVector
unsigned char operator()(unsigned char value) const
std::vector< StatisticData > DataVector