Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
Medical Imaging Interaction Toolkit
mitkCollectionStatistic.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkCollectionStatistic_h
14 #define mitkCollectionStatistic_h
15 
17 
18 #include <mitkDataCollection.h>
19 
20 #include <iostream>
21 
22 namespace mitk {
24 {
25  unsigned int m_TruePositive;
26  unsigned int m_FalsePositive;
27  unsigned int m_TrueNegative;
28  unsigned int m_FalseNegative;
29 
30  double m_DICE;
31  double m_Jaccard;
32  double m_Sensitivity;
33  double m_Specificity;
34  double m_RMSD;
35 
37  m_TruePositive(0), m_FalsePositive(0), m_TrueNegative(0), m_FalseNegative(0),
38  m_DICE(0), m_Jaccard(0), m_Sensitivity(0), m_Specificity(0), m_RMSD(-1.0)
39  {}
40 };
41 
43 {
44 public:
45  virtual unsigned char operator() (unsigned char value) const = 0;
46 };
47 
49 {
50 public:
51  unsigned char operator() (unsigned char value) const override
52  {
53  return value-1;
54  }
55 };
56 
58 {
59 public:
60  unsigned char operator() (unsigned char value) const override
61  {
62  return value;
63  }
64 };
65 
67 {
68 public:
69  unsigned char operator() (unsigned char value) const override
70  {
71  if (value == 1 || value == 5)
72  return 0;
73  else
74  return 1;
75  }
76 };
77 
79 {
80 public:
81  unsigned char operator() (unsigned char value) const override
82  {
83  if (value == 1 || value == 0)
84  return 0;
85  else
86  return 1;
87  }
88 };
89 
91 {
92 public:
93 
96 
97  typedef std::vector<StatisticData> DataVector;
98  typedef std::vector<DataVector> MultiDataVector;
99 
100  void SetCollection(DataCollection::Pointer collection);
101  DataCollection::Pointer GetCollection();
102 
103  void SetClassCount (size_t count);
104  size_t GetClassCount();
105 
106  void SetGoldName(std::string name);
107  std::string GetGoldName();
108 
109  void SetTestName(std::string name);
110  std::string GetTestName();
111 
112  void SetMaskName(std::string name) {m_MaskName = name; }
113 
114  void SetGroundTruthValueToIndexMapper(const ValueToIndexMapper* mapper);
115  const ValueToIndexMapper* GetGroundTruthValueToIndexMapper(void) const;
116 
117  void SetTestValueToIndexMapper(const ValueToIndexMapper* mapper);
118  const ValueToIndexMapper* GetTestValueToIndexMapper(void) const;
119 
120  void Print(std::ostream& out, std::ostream& sout = std::cout, bool withHeader = false, std::string label = "None");
121  bool Update();
122  int IsInSameVirtualClass(unsigned char gold, unsigned char test);
123 
129  std::vector<StatisticData> GetStatisticData(unsigned char c) const;
130 
134  void ComputeRMSD();
135 
136 private:
137  size_t m_ClassCount;
138  std::string m_GroundTruthName;
139  std::string m_TestName;
140  std::string m_MaskName;
141  DataCollection::Pointer m_Collection;
142 
143  std::vector<unsigned char> m_ConnectionGold;
144  std::vector<unsigned char> m_ConnectionTest;
145  std::vector<unsigned char> m_ConnectionClass;
146 
147  MultiDataVector m_ImageClassStatistic;
148  std::vector<std::string> m_ImageNames;
149  DataVector m_ImageStatistic;
150  StatisticData m_MeanCompleteStatistic;
151  StatisticData m_CompleteStatistic;
152 
153  const ValueToIndexMapper* m_GroundTruthValueToIndexMapper;
154  const ValueToIndexMapper* m_TestValueToIndexMapper;
155 };
156 }
157 
158 #endif // mitkCollectionStatistic_h
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:28
DataCollection - Class to facilitate loading/accessing structured data.
void SetMaskName(std::string name)
std::vector< DataVector > MultiDataVector
std::vector< StatisticData > DataVector
#define MITKDATACOLLECTION_EXPORT