Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
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 (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 mitkDataStorageCompare_h_included
14 #define mitkDataStorageCompare_h_included
15 
16 #include "mitkDataStorage.h"
17 
18 namespace mitk
19 {
63  {
64  public:
70  typedef enum {
73  CMP_Data = 2,
77  CMP_All = 0xfffffff,
78  } Tests;
79 
88  DataStorageCompare(const DataStorage *reference,
89  const DataStorage *test,
90  Tests flags = CMP_All,
91  double eps = mitk::eps);
92 
96  bool CompareVerbose();
97 
105  bool Compare(bool verbose = false);
106 
112  void Report();
113 
114  private:
123  bool CompareHierarchy(bool verbose);
124 
134  bool CompareDataNodes(bool verbose);
135 
149  bool AreNodesEqual(const mitk::DataNode *reference, const mitk::DataNode *test, bool verbose = false);
150 
156  bool IsDataEqual(const mitk::BaseData *reference, const mitk::BaseData *test, bool verbose = false);
157 
164  bool ArePropertyListsEqual(const mitk::DataNode &reference, const mitk::DataNode &test, bool verbose = false);
165 
170  bool AreMappersEqual(const mitk::DataNode &reference, const mitk::DataNode &test, bool verbose);
171 
178  bool ArePropertyListsEqual(const mitk::PropertyList &reference,
179  const mitk::PropertyList &test,
180  bool verbose = false);
181 
183  double m_Eps;
184 
186  Tests m_TestAspects;
187 
189  DataStorage::ConstPointer m_ReferenceDS;
190 
192  DataStorage::ConstPointer m_TestDS;
193 
200  typedef std::multimap<std::string, DataNode::Pointer> HierarchyDescriptorMap;
201 
203  HierarchyDescriptorMap m_RefNodesByHierarchy;
204 
206  HierarchyDescriptorMap m_TestNodesByHierarchy;
207 
212  void DescribeHierarchyOfNodes(DataStorage::ConstPointer storage, HierarchyDescriptorMap &result);
213 
218  std::string GenerateNodeDescriptor(mitk::DataNode::Pointer node);
219 
226  std::string GenerateHierarchyDescriptor(DataNode::Pointer node, DataStorage::ConstPointer storage);
227 
228  bool m_HierarchyPassed;
229  bool m_DataPassed;
230  bool m_PropertiesPassed;
231  bool m_MappersPassed;
232  bool m_InteractorsPassed;
233  int m_AspectsFailed;
234 
235  }; // class
236 
239  {
240  return static_cast<DataStorageCompare::Tests>(static_cast<int>(a) | static_cast<int>(b));
241  }
242 
243 } // namespace
244 
245 #endif
Data management class that handles &#39;was created by&#39; relations.
Base of all data objects.
Definition: mitkBaseData.h:37
bool CompareVerbose()
Shorthand for Compare(true).
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:28
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 verbose(false)
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:57