Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLClipNode.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4 Queen's University, Kingston, ON, Canada. All Rights Reserved.
5
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15 This file was originally developed by Kyle Sunderland, PerkLab, Queen's University
16 and was supported in part through NIH grant R01 HL153166.
17
18==============================================================================*/
19
20#ifndef __vtkMRMLClipNode_h
21#define __vtkMRMLClipNode_h
22
23#include "vtkMRMLNode.h"
24
25class vtkImplicitBoolean;
26class vtkImplicitFunction;
27class vtkImplicitFunctionCollection;
29class vtkPlaneCollection;
30
41class VTK_MRML_EXPORT vtkMRMLClipNode : public vtkMRMLNode
42{
43public:
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
48 //--------------------------------------------------------------------------
50 //--------------------------------------------------------------------------
51
53
55 void ReadXMLAttributes(const char** atts) override;
56
58 void WriteXML(ostream& of, int indent) override;
59
63
65 const char* GetNodeTagName() override { return "Clip"; }
66
70 enum
71 {
73 };
74
80
82
85 void SetClipType(int clipType);
88
90
92 static int GetClipTypeFromString(const char* name);
93 static const char* GetClipTypeAsString(int type);
95
97 int GetClippingNodeIndex(const char* nodeID);
98
101 {
102 ClipOff = 0, // Clipping disabled
103 ClipPositiveSpace = 1, // Keep +ve region of the implicit function
104 ClipNegativeSpace = 2, // Keep -ve region of the implicit function
105 };
106
108
111 int GetClippingNodeState(const char* nodeID);
114 void SetClippingNodeState(const char* nodeID, int);
115 void SetNthClippingNodeState(int n, int state);
117
119
124
126
131
133
138
141
143
145 static int GetClippingStateFromString(const char* name);
146 static const char* GetClippingStateAsString(int state);
148
150
158
159
161
164 vtkGetMacro(ClippingMethod, int);
165 vtkSetMacro(ClippingMethod, int);
167
169
171 static int GetClippingMethodFromString(const char* name);
172 static const char* GetClippingMethodAsString(int type);
174
178 void AddAndObserveClippingNodeID(const char* clippingNodeID);
179
181
184 void SetAndObserveClippingNodeID(const char* clippingNodeID);
185 void SetAndObserveNthClippingNodeID(int n, const char* clippingNodeID);
187
189
190 void RemoveClippingNodeID(const char* clippingNodeID);
194
196
197 const char* GetNthClippingNodeID(int n);
198 const char* GetClippingNodeID();
200
202 bool HasClippingNodeID(const char* clippingNodeID);
203
206
208 int GetClippingNodeIndexFromID(const char* clippingNodeID);
209
211
215
217 const char* GetClippingNodeReferenceRole() const;
218
220 vtkImplicitFunction* GetImplicitFunctionWorld();
221
223 void GetPlanes(vtkPlaneCollection* planes);
224
226 void ProcessMRMLEvents(vtkObject* caller, unsigned long event, void* callData) override;
227
229 void CopyReferences(vtkMRMLNode* node) override;
230
233 bool GetClippingPlanes(vtkPlaneCollection* planeCollection, bool invert = false, vtkMRMLMessageCollection* messages = nullptr);
234
235protected:
238
239 int GetSliceClipState(const char* nodeID);
240 void SetSliceClipState(const char* nodeID, int state);
241
245 static bool GetClippingPlanesFromFunction(vtkImplicitFunction* function, vtkPlaneCollection* planeCollection, bool invert = false);
246
247protected:
252
256
259
263
264 static const char* ClippingNodeReferenceRole;
265 static const char* ClippingNodeReferenceRef;
267
269
270 vtkSmartPointer<vtkImplicitBoolean> ImplicitFunction;
271};
272
273#endif
int GetClippingNodeIndex(const char *nodeID)
Get or set the clipping node index.
void SetAndObserveClippingNodeID(const char *clippingNodeID)
bool HasClippingNodeID(const char *clippingNodeID)
Check if the clip plane node ID exists.
void CopyReferences(vtkMRMLNode *node) override
Overridden to update the implicit function when the clipping nodes are modified.
void RemoveNthClippingNodeID(int n)
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
Overridden to update the implicit function when the clipping nodes are modified.
int GetNthClippingNodeState(int n)
void GetPlanes(vtkPlaneCollection *planes)
Get all the plane implicit functions from the clipping nodes.
vtkMRMLClipNode(const vtkMRMLClipNode &)
vtkImplicitFunction * GetImplicitFunctionWorld()
Get the implicit function that represents the clipping function created from the referenced clipping ...
static const char * ClippingNodeStatePropertyName
static const char * GetClipTypeAsString(int type)
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
void PrintSelf(ostream &os, vtkIndent indent) override
void RemoveClippingNodeID(const char *clippingNodeID)
Remove the clip plane node.
static bool GetClippingPlanesFromFunction(vtkImplicitFunction *function, vtkPlaneCollection *planeCollection, bool invert=false)
void AddAndObserveClippingNodeID(const char *clippingNodeID)
bool GetClippingPlanes(vtkPlaneCollection *planeCollection, bool invert=false, vtkMRMLMessageCollection *messages=nullptr)
int GetYellowSliceClipState()
void SetRedSliceClipState(int)
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
const char * GetClippingNodeReferenceRole() const
Node reference role used for storing clip plane node references.
void SetClippingNodeState(const char *nodeID, int)
void SetGreenSliceClipState(int)
vtkMRMLNode * GetClippingNode()
int GetNumberOfClippingNodes()
Get the number of clip plane nodes.
void SetAndObserveNthClippingNodeID(int n, const char *clippingNodeID)
vtkMRMLCopyContentMacro(vtkMRMLClipNode)
void RemoveAllClippingNodeIDs()
~vtkMRMLClipNode() override
static const char * ClippingNodeReferenceRole
int GetSliceClipState(const char *nodeID)
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Called when a node reference ID is modified.
vtkMRMLNode * GetNthClippingNode(int n)
Get the clipping node.
static int GetClippingStateFromString(const char *name)
void SetClipType(int clipType)
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override
Called when a node reference ID is added (list size increased).
static const char * GetClippingMethodAsString(int type)
const char * GetClippingNodeID()
void UpdateImplicitFunction()
Update the implicit function based on the clipping nodes.
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
int GetRedSliceClipState()
vtkSmartPointer< vtkImplicitBoolean > ImplicitFunction
void SetClippingNodeState(vtkMRMLNode *, int)
ClippingStateType
Clipping state for each clipping node reference.
static vtkMRMLClipNode * New()
void OnNodeReferenceRemoved(vtkMRMLNodeReference *reference) override
Called after a node reference ID is removed (list size decreased).
void SetSliceClipState(const char *nodeID, int state)
int GetGreenSliceClipState()
static const char * GetClippingStateAsString(int state)
static int GetClippingMethodFromString(const char *name)
void SetNthClippingNodeState(int n, int state)
int GetClippingNodeState(vtkMRMLNode *node)
static int GetClipTypeFromString(const char *name)
int GetClippingNodeState(const char *nodeID)
static const char * GetClippingNodeStatePropertyName()
Get the node reference property name for the clipping node state.
void operator=(const vtkMRMLClipNode &)
void SetYellowSliceClipState(int)
int GetClippingNodeIndexFromID(const char *clippingNodeID)
Get the index of the clipping node.
const char * GetNthClippingNodeID(int n)
Get the clip plane node ID.
static const char * ClippingNodeReferenceRef
Class to hold information about a node reference.