Medical Imaging Interaction Toolkit  2023.04.00
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
mitk::StatisticData::m_Sensitivity
double m_Sensitivity
Definition: mitkCollectionStatistic.h:32
mitk::ValueToIndexMapper
Definition: mitkCollectionStatistic.h:42
mitk::BinaryValueminusOneToIndexMapper::operator()
unsigned char operator()(unsigned char value) const override
Definition: mitkCollectionStatistic.h:51
mitk::StatisticData::m_TruePositive
unsigned int m_TruePositive
Definition: mitkCollectionStatistic.h:25
mitk::StatisticData
Definition: mitkCollectionStatistic.h:23
mitk::StatisticData::StatisticData
StatisticData()
Definition: mitkCollectionStatistic.h:36
mitk::StatisticData::m_RMSD
double m_RMSD
Definition: mitkCollectionStatistic.h:34
itk::SmartPointer< Self >
mitk::StatisticData::m_FalsePositive
unsigned int m_FalsePositive
Definition: mitkCollectionStatistic.h:26
mitk::MultiClassValueToIndexMapper::operator()
unsigned char operator()(unsigned char value) const override
Definition: mitkCollectionStatistic.h:69
mitk::ValueToIndexMapper::operator()
virtual unsigned char operator()(unsigned char value) const =0
test
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:28
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::StatisticData::m_TrueNegative
unsigned int m_TrueNegative
Definition: mitkCollectionStatistic.h:27
mitk::CollectionStatistic::MultiDataVector
std::vector< DataVector > MultiDataVector
Definition: mitkCollectionStatistic.h:98
mitk::StatisticData::m_DICE
double m_DICE
Definition: mitkCollectionStatistic.h:30
mitk::MultiClassValueToIndexMapper
Definition: mitkCollectionStatistic.h:66
mitk::StatisticData::m_Jaccard
double m_Jaccard
Definition: mitkCollectionStatistic.h:31
mitkDataCollection.h
mitk::BinaryValueToIndexMapper
Definition: mitkCollectionStatistic.h:57
mitk::ProgressionValueToIndexMapper::operator()
unsigned char operator()(unsigned char value) const override
Definition: mitkCollectionStatistic.h:81
mitk::CollectionStatistic::SetMaskName
void SetMaskName(std::string name)
Definition: mitkCollectionStatistic.h:112
mitk::ProgressionValueToIndexMapper
Definition: mitkCollectionStatistic.h:78
MitkDataCollectionExports.h
mitk::BinaryValueminusOneToIndexMapper
Definition: mitkCollectionStatistic.h:48
mitk::CollectionStatistic::DataVector
std::vector< StatisticData > DataVector
Definition: mitkCollectionStatistic.h:97
MITKDATACOLLECTION_EXPORT
#define MITKDATACOLLECTION_EXPORT
Definition: MitkDataCollectionExports.h:15
mitk::CollectionStatistic
Definition: mitkCollectionStatistic.h:90
mitk::StatisticData::m_Specificity
double m_Specificity
Definition: mitkCollectionStatistic.h:33
mitk::BinaryValueToIndexMapper::operator()
unsigned char operator()(unsigned char value) const override
Definition: mitkCollectionStatistic.h:60
mitk::StatisticData::m_FalseNegative
unsigned int m_FalseNegative
Definition: mitkCollectionStatistic.h:28