Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
35class vtkMRMLNode;
36class vtkMRMLScene;
43
48
50{
51
52VTK_MRML_EXPORT
53bool CheckNodeInSceneByID(int line, vtkMRMLScene* scene,
54 const char* nodeID, vtkMRMLNode* expected);
55
56VTK_MRML_EXPORT
57bool CheckNodeIdAndName(int line, vtkMRMLNode* node,
58 const char* expectedID, const char* expectedName);
59
60template<typename Type>
61std::string ToString(Type value);
62
64VTK_MRML_EXPORT
66 const char * sceneFilePath, std::vector<std::string>& expectedNodeAddedClassNames);
67
69VTK_MRML_EXPORT
70int ExerciseBasicObjectMethods(vtkObject* object);
71
75VTK_MRML_EXPORT
77
79VTK_MRML_EXPORT
81
84VTK_MRML_EXPORT
86
89VTK_MRML_EXPORT
91
94VTK_MRML_EXPORT
96
99VTK_MRML_EXPORT
101
104VTK_MRML_EXPORT
106
109VTK_MRML_EXPORT
111
117VTK_MRML_EXPORT
118int ExerciseSceneLoadingMethods(const char * sceneFilePath, vtkMRMLScene* inputScene = nullptr);
119
120//---------------------------------------------------------------------------
121class VTK_MRML_EXPORT vtkMRMLNodeCallback : public vtkCallbackCommand
122{
123public:
125 void PrintSelf(ostream& os, vtkIndent indent) override;
126
127 void Execute(vtkObject* caller, unsigned long eid, void *callData) override;
128 virtual void ResetNumberOfEvents();
129
131 std::string GetErrorString();
132
135
137 int GetNumberOfEvents(unsigned long event);
139 std::vector<unsigned long> GetReceivedEvents();
140
141protected:
144
145 void SetErrorString(const char* error);
146
147 void SetErrorString(int line, const char* error);
148
149 vtkMRMLNode* Node{nullptr};
150 std::string ErrorString;
151 std::map<unsigned long, unsigned int> ReceivedEvents;
152};
153
154} // namespace vtkMRMLCoreTestingUtilities
155
156#include "vtkMRMLCoreTestingUtilities.txx"
157
158#endif
std::map< unsigned long, unsigned int > ReceivedEvents
void Execute(vtkObject *caller, unsigned long eid, void *callData) override
void SetErrorString(int line, const char *error)
void PrintSelf(ostream &os, vtkIndent indent) override
int CheckStatus()
Returns EXIT_SUCCESS if string is empty, EXIT_FAILURE if string is non-empty.
std::vector< unsigned long > GetReceivedEvents()
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node to represent a 3D surface model.
A superclass for other storage nodes.
MRML node for representing a transformation between this node space and a parent node space.
MRML node for representing a node with a transform.
VTK_MRML_EXPORT int GetExpectedNodeAddedClassNames(const char *sceneFilePath, std::vector< std::string > &expectedNodeAddedClassNames)
Return list of node that should be added to the scene.
VTK_MRML_EXPORT int ExerciseBasicMRMLMethods(vtkMRMLNode *node)
Slicer Libs/MRML/vtkMRMLNode exercises.
VTK_MRML_EXPORT int ExerciseBasicDisplayMRMLMethods(vtkMRMLDisplayNode *node)
VTK_MRML_EXPORT bool CheckNodeIdAndName(int line, vtkMRMLNode *node, const char *expectedID, const char *expectedName)
VTK_MRML_EXPORT int ExerciseAllBasicMRMLMethods(vtkMRMLNode *object)
VTK_MRML_EXPORT int ExerciseBasicStorableMRMLMethods(vtkMRMLStorableNode *node)
VTK_MRML_EXPORT int ExerciseBasicObjectMethods(vtkObject *object)
Test basic VTK object methods (print, superclass, etc.)
VTK_MRML_EXPORT int ExerciseBasicTransformMRMLMethods(vtkMRMLTransformNode *node)
VTK_MRML_EXPORT int ExerciseBasicDisplayableMRMLMethods(vtkMRMLDisplayableNode *node)
VTK_MRML_EXPORT int ExerciseBasicTransformableMRMLMethods(vtkMRMLTransformableNode *node)
std::string ToString(Type value)
VTK_MRML_EXPORT bool CheckNodeInSceneByID(int line, vtkMRMLScene *scene, const char *nodeID, vtkMRMLNode *expected)
VTK_MRML_EXPORT int ExerciseBasicStorageMRMLMethods(vtkMRMLStorageNode *node)
VTK_MRML_EXPORT int ExerciseSceneLoadingMethods(const char *sceneFilePath, vtkMRMLScene *inputScene=nullptr)