Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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, const char* nodeID, vtkMRMLNode* expected);
54
55VTK_MRML_EXPORT
56bool CheckNodeIdAndName(int line, vtkMRMLNode* node, const char* expectedID, const char* expectedName);
57
58template <typename Type>
59std::string ToString(Type value);
60
62VTK_MRML_EXPORT
63int GetExpectedNodeAddedClassNames(const char* sceneFilePath, std::vector<std::string>& expectedNodeAddedClassNames);
64
66VTK_MRML_EXPORT
67int ExerciseBasicObjectMethods(vtkObject* object);
68
72VTK_MRML_EXPORT
74
76VTK_MRML_EXPORT
78
81VTK_MRML_EXPORT
83
86VTK_MRML_EXPORT
88
91VTK_MRML_EXPORT
93
96VTK_MRML_EXPORT
98
101VTK_MRML_EXPORT
103
106VTK_MRML_EXPORT
108
114VTK_MRML_EXPORT
115int ExerciseSceneLoadingMethods(const char* sceneFilePath, vtkMRMLScene* inputScene = nullptr);
116
117//---------------------------------------------------------------------------
118class VTK_MRML_EXPORT vtkMRMLNodeCallback : public vtkCallbackCommand
119{
120public:
122 void PrintSelf(ostream& os, vtkIndent indent) override;
123
124 void Execute(vtkObject* caller, unsigned long eid, void* callData) override;
125 virtual void ResetNumberOfEvents();
126
128 std::string GetErrorString();
129
132
134 int GetNumberOfEvents(unsigned long event);
136 std::vector<unsigned long> GetReceivedEvents();
137
138protected:
141
142 void SetErrorString(const char* error);
143
144 void SetErrorString(int line, const char* error);
145
146 vtkMRMLNode* Node{ nullptr };
147 std::string ErrorString;
148 std::map<unsigned long, unsigned int> ReceivedEvents;
149};
150
151} // namespace vtkMRMLCoreTestingUtilities
152
153#include "vtkMRMLCoreTestingUtilities.txx"
154
155#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)