Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLCoreTestingUtilities.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 1U24CA194354-01
18 
19 ==============================================================================*/
20 
21 #ifndef __vtkMRMLCoreTestingUtilities_h
22 #define __vtkMRMLCoreTestingUtilities_h
23 
24 // MRML/Core includes
25 #include <vtkMRML.h>
26 
27 // VTK includes
28 #include <vtkCallbackCommand.h>
29 
30 // STD includes
31 #include <sstream>
32 #include <vector>
33 #include <map>
34 
35 class vtkMRMLNode;
36 class vtkMRMLScene;
38 class vtkMRMLDisplayNode;
40 class vtkMRMLStorageNode;
43 
48 
50 {
51 
52 VTK_MRML_EXPORT
53 bool CheckNodeInSceneByID(int line, vtkMRMLScene* scene,
54  const char* nodeID, vtkMRMLNode* expected);
55 
56 VTK_MRML_EXPORT
57 bool CheckNodeIdAndName(int line, vtkMRMLNode* node,
58  const char* expectedID, const char* expectedName);
59 
60 template<typename Type>
61 std::string ToString(Type value);
62 
64 VTK_MRML_EXPORT
65 int ExerciseBasicObjectMethods(vtkObject* object);
66 
70 VTK_MRML_EXPORT
72 
74 VTK_MRML_EXPORT
76 
79 VTK_MRML_EXPORT
81 
84 VTK_MRML_EXPORT
86 
89 VTK_MRML_EXPORT
91 
94 VTK_MRML_EXPORT
96 
99 VTK_MRML_EXPORT
101 
104 VTK_MRML_EXPORT
106 
112 VTK_MRML_EXPORT
113 int ExerciseSceneLoadingMethods(const char * sceneFilePath, vtkMRMLScene* inputScene = NULL);
114 
115 //---------------------------------------------------------------------------
116 class VTK_MRML_EXPORT vtkMRMLNodeCallback : public vtkCallbackCommand
117 {
118 public:
120  void PrintSelf(ostream& os, vtkIndent indent);
121 
122  virtual void Execute(vtkObject* caller, unsigned long eid, void *callData);
123  virtual void ResetNumberOfEvents();
124 
125  void SetMRMLNode(vtkMRMLNode*);
126  std::string GetErrorString();
127 
129  int CheckStatus();
130 
131  int GetNumberOfModified();
132  int GetNumberOfEvents(unsigned long event);
133  int GetTotalNumberOfEvents();
134  std::vector<unsigned long> GetReceivedEvents();
135 
136 protected:
139 
140  void SetErrorString(const char* error);
141 
142  void SetErrorString(int line, const char* error);
143 
145  std::string ErrorString;
146  std::map<unsigned long, unsigned int> ReceivedEvents;
147 };
148 
149 } // namespace vtkMRMLCoreTestingUtilities
150 
151 #include "vtkMRMLCoreTestingUtilities.txx"
152 
153 #endif
VTK_MRML_EXPORT int ExerciseBasicTransformableMRMLMethods(vtkMRMLTransformableNode *node)
MRML node for representing a transformation between this node space and a parent node space...
VTK_MRML_EXPORT int ExerciseSceneLoadingMethods(const char *sceneFilePath, vtkMRMLScene *inputScene=NULL)
std::string ToString(Type value)
VTK_MRML_EXPORT int ExerciseBasicMRMLMethods(vtkMRMLNode *node)
Slicer Libs/MRML/vtkMRMLNode exercises.
VTK_MRML_EXPORT int ExerciseAllBasicMRMLMethods(vtkMRMLNode *object)
VTK_MRML_EXPORT int ExerciseBasicStorageMRMLMethods(vtkMRMLStorageNode *node)
VTK_MRML_EXPORT int ExerciseBasicTransformMRMLMethods(vtkMRMLTransformNode *node)
VTK_MRML_EXPORT int ExerciseBasicStorableMRMLMethods(vtkMRMLStorableNode *node)
VTK_MRML_EXPORT int ExerciseBasicDisplayableMRMLMethods(vtkMRMLDisplayableNode *node)
MRML node to represent a 3D surface model.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
std::map< unsigned long, unsigned int > ReceivedEvents
A supercalss for other storage nodes.
Abstract class that contains graphical display properties for displayable nodes.
VTK_MRML_EXPORT int ExerciseBasicDisplayMRMLMethods(vtkMRMLDisplayNode *node)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
VTK_MRML_EXPORT int ExerciseBasicObjectMethods(vtkObject *object)
Test basic VTK object methods (print, superclass, etc.)
VTK_MRML_EXPORT bool CheckNodeIdAndName(int line, vtkMRMLNode *node, const char *expectedID, const char *expectedName)
VTK_MRML_EXPORT bool CheckNodeInSceneByID(int line, vtkMRMLScene *scene, const char *nodeID, vtkMRMLNode *expected)
MRML node for representing a node with a tranform.