Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkDataStorageCompare.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkDataStorageCompare_h_included
18 #define mitkDataStorageCompare_h_included
19 
20 #include "mitkDataStorage.h"
21 
22 namespace mitk
23 {
67  {
68  public:
74  typedef enum {
77  CMP_Data = 2,
81  CMP_All = 0xfffffff,
82  } Tests;
83 
92  DataStorageCompare(const DataStorage *reference,
93  const DataStorage *test,
94  Tests flags = CMP_All,
95  double eps = mitk::eps);
96 
100  bool CompareVerbose();
101 
109  bool Compare(bool verbose = false);
110 
116  void Report();
117 
118  private:
127  bool CompareHierarchy(bool verbose);
128 
138  bool CompareDataNodes(bool verbose);
139 
153  bool AreNodesEqual(const mitk::DataNode *reference, const mitk::DataNode *test, bool verbose = false);
154 
160  bool IsDataEqual(const mitk::BaseData *reference, const mitk::BaseData *test, bool verbose = false);
161 
168  bool ArePropertyListsEqual(const mitk::DataNode &reference, const mitk::DataNode &test, bool verbose = false);
169 
174  bool AreMappersEqual(const mitk::DataNode &reference, const mitk::DataNode &test, bool verbose);
175 
182  bool ArePropertyListsEqual(const mitk::PropertyList &reference,
183  const mitk::PropertyList &test,
184  bool verbose = false);
185 
187  double m_Eps;
188 
190  Tests m_TestAspects;
191 
193  DataStorage::ConstPointer m_ReferenceDS;
194 
196  DataStorage::ConstPointer m_TestDS;
197 
204  typedef std::multimap<std::string, DataNode::Pointer> HierarchyDescriptorMap;
205 
207  HierarchyDescriptorMap m_RefNodesByHierarchy;
208 
210  HierarchyDescriptorMap m_TestNodesByHierarchy;
211 
216  void DescribeHierarchyOfNodes(DataStorage::ConstPointer storage, HierarchyDescriptorMap &result);
217 
222  std::string GenerateNodeDescriptor(mitk::DataNode::Pointer node);
223 
230  std::string GenerateHierarchyDescriptor(DataNode::Pointer node, DataStorage::ConstPointer storage);
231 
232  bool m_HierarchyPassed;
233  bool m_DataPassed;
234  bool m_PropertiesPassed;
235  bool m_MappersPassed;
236  bool m_InteractorsPassed;
237  int m_AspectsFailed;
238 
239  }; // class
240 
243  {
244  return static_cast<DataStorageCompare::Tests>(static_cast<int>(a) | static_cast<int>(b));
245  }
246 
247 } // namespace
248 
249 #endif
Data management class that handles 'was created by' relations.
Base of all data objects.
Definition: mitkBaseData.h:39
bool CompareVerbose()
Shorthand for Compare(true).
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:32
InteractionEvent::MouseButtons operator|(InteractionEvent::MouseButtons a, InteractionEvent::MouseButtons b)
DataCollection - Class to facilitate loading/accessing structured data.
Key-value list holding instances of BaseProperty.
DataStorageCompare(const DataStorage *reference, const DataStorage *test, Tests flags=CMP_All, double eps=mitk::eps)
Constructor taking reference and test DataStorage.
bool Compare(bool verbose=false)
Execute the comparison.
Tests
Flag describing the aspects of comparing two DataStorages.
MITKCORE_EXPORT const ScalarType eps
void Report()
Prints a small summary of what tests have been executed and which ones failed or passed.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66