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
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;
28class vtkPlaneCollection;
29
40class VTK_MRML_EXPORT vtkMRMLClipNode : public vtkMRMLNode
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
47 //--------------------------------------------------------------------------
49 //--------------------------------------------------------------------------
50
52
54 void ReadXMLAttributes(const char** atts) override;
55
57 void WriteXML(ostream& of, int indent) override;
58
62
64 const char* GetNodeTagName() override { return "Clip"; }
65
69 enum
70 {
72 };
73
79
81
84 void SetClipType(int clipType);
87
89
91 static int GetClipTypeFromString(const char* name);
92 static const char* GetClipTypeAsString(int type);
94
96 int GetClippingNodeIndex(const char* nodeID);
97
100 {
101 ClipOff = 0, // Clipping disabled
102 ClipPositiveSpace = 1, // Keep +ve region of the implicit function
103 ClipNegativeSpace = 2, // Keep -ve region of the implicit function
104 };
105
107
110 int GetClippingNodeState(const char* nodeID);
113 void SetClippingNodeState(const char* nodeID, int);
114 void SetNthClippingNodeState(int n, int state);
116
118
123
125
130
132
137
140
142
144 static int GetClippingStateFromString(const char* name);
145 static const char* GetClippingStateAsString(int state);
147
149
157
158
160
163 vtkGetMacro(ClippingMethod, int);
164 vtkSetMacro(ClippingMethod, int);
166
168
170 static int GetClippingMethodFromString(const char* name);
171 static const char* GetClippingMethodAsString(int type);
173
177 void AddAndObserveClippingNodeID(const char* clippingNodeID);
178
180
183 void SetAndObserveClippingNodeID(const char* clippingNodeID);
184 void SetAndObserveNthClippingNodeID(int n, const char* clippingNodeID);
186
188
189 void RemoveClippingNodeID(const char* clippingNodeID);
193
195
196 const char* GetNthClippingNodeID(int n);
197 const char* GetClippingNodeID();
199
201 bool HasClippingNodeID(const char* clippingNodeID);
202
205
207 int GetClippingNodeIndexFromID(const char* clippingNodeID);
208
210
214
216 const char* GetClippingNodeReferenceRole() const;
217
219 vtkImplicitFunction* GetImplicitFunctionWorld();
220
222 void GetPlanes(vtkPlaneCollection* planes);
223
225 void ProcessMRMLEvents(vtkObject* caller, unsigned long event, void* callData) override;
226
228 void CopyReferences(vtkMRMLNode* node) override;
229
230protected:
231
234
235 int GetSliceClipState(const char* nodeID);
236 void SetSliceClipState(const char* nodeID, int state);
237
238protected:
243
247
250
254
255 static const char* ClippingNodeReferenceRole;
256 static const char* ClippingNodeReferenceRef;
258
260
261 vtkSmartPointer<vtkImplicitBoolean> ImplicitFunction;
262};
263
264#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.
void AddAndObserveClippingNodeID(const char *clippingNodeID)
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.