Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSceneIOTestScenarioProvider.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 mitkSceneIOTestScenarioProvider_h_included
18 #define mitkSceneIOTestScenarioProvider_h_included
19 
21 
22 namespace mitk
23 {
41  {
42  public:
45 
55  struct Scenario
56  {
57  std::string key;
58  bool serializable;
62 
65 
75  Scenario(const std::string &_key,
76  const SceneIOTestScenarioProvider *_scenarioProvider,
78  bool _isSerializable,
79  const std::string &_referenceArchiveFilename,
80  bool _isReferenceLoadable,
81  double _comparisonPrecision);
82 
83  private:
84  const SceneIOTestScenarioProvider *m_ScenarioProvider;
86  };
87 
89  typedef std::vector<Scenario> ScenarioList;
90 
92  ScenarioList GetAllScenarios() const;
93 
94  private:
95  ScenarioList m_Scenarios;
96 
98  int m_HowMuchIsMany;
99 
103  void AddScenario(const std::string &key,
104  BuilderMethodPointer creator,
105  bool isSerializable,
106  const std::string &referenceArchiveFilename = std::string(),
107  bool isReferenceLoadable = false,
108  double comparisionPrecision = mitk::eps);
109 
113  DataStorage::Pointer EmptyStorage() const;
114 
118  DataStorage::Pointer OneEmptyNode() const;
119 
123  DataStorage::Pointer OneEmptyNamedNode() const;
124 
136  DataStorage::Pointer ManyTopLevelNodes() const;
137 
149  DataStorage::Pointer LineOfManyOnlyChildren() const;
150 
154  DataStorage::Pointer ComplicatedFamilySituation() const;
155 
159  DataStorage::Pointer Image() const;
160 
165 
170 
175 
179  DataStorage::Pointer SpecialProperties() const;
180 
181  public:
182 // Helper to simplify writing the registration
183 #define AddSaveAndRestoreScenario(name) AddScenario(#name, &mitk::SceneIOTestScenarioProvider::name, true);
184 
185  // this one in the header so it is clearly visible when someone
186  // adds a test to the bottom of the list
187  SceneIOTestScenarioProvider() : m_HowMuchIsMany(50)
188  {
190  AddSaveAndRestoreScenario(EmptyStorage);
191  AddSaveAndRestoreScenario(OneEmptyNode);
192  AddSaveAndRestoreScenario(OneEmptyNamedNode);
193  AddSaveAndRestoreScenario(ManyTopLevelNodes);
194  AddSaveAndRestoreScenario(LineOfManyOnlyChildren);
195  AddSaveAndRestoreScenario(ComplicatedFamilySituation);
196 
200 
201  if (sizeof(size_t) != 4)
202  // this test is deactivated on 32 bit systems since it fails
203  // on the only 32 bit dartclient. To activate it there, one
204  // would have to debug the precision problem on a 32 bit
205  // machine and either adapt expectations or fix a bug.
207 
208  AddSaveAndRestoreScenario(SpecialProperties);
209 
210  // AddScenario("GeometryData", &mitk::SceneIOTestScenarioProvider::GeometryData, true, std::string(), false,
211  // mitk::eps);
212  }
213 
214  }; // class
215 
216 } // namespace
217 
218 #endif
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
std::string referenceArchiveFilename
Absolute filename with a reference .mitk file.
#define AddSaveAndRestoreScenario(name)
bool referenceArchiveLoadable
Do we expect that the reference can be loaded without errors?
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
double comparisonPrecision
Precision used for floating point comparisons after save/load cycle (eps).
DataStorage::Pointer BuildDataStorage() const
Construct the DataStorage for this scenario.
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:79
DataStorage::Pointer(SceneIOTestScenarioProvider::* BuilderMethodPointer)() const
Typedef for type BuilderMethodPointer which is function pointer to member of SceneIOTestScenarioProvi...
Image class for storing images.
Definition: mitkImage.h:76
Data class only having a BaseGeometry but not containing any specific data.
Scenario(const std::string &_key, const SceneIOTestScenarioProvider *_scenarioProvider, SceneIOTestScenarioProvider::BuilderMethodPointer _providerMethod, bool _isSerializable, const std::string &_referenceArchiveFilename, bool _isReferenceLoadable, double _comparisonPrecision)
MITKCORE_EXPORT const ScalarType eps
bool serializable
Do we expect that this can be stored in a .mitk file?
Provides DataStorages that serve as test scenarios.
std::vector< Scenario > ScenarioList
List of Scenarios.
ScenarioList GetAllScenarios() const
Returns all registered scenarios.