Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLModelNode.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: 3D Slicer
9  Module: $RCSfile: vtkMRMLModelNode.h,v $
10  Date: $Date: 2006/03/19 17:12:28 $
11  Version: $Revision: 1.6 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLModelNode_h
16 #define __vtkMRMLModelNode_h
17 
18 // MRML includes
19 #include "vtkMRMLDisplayableNode.h"
21 class vtkMRMLStorageNode;
22 
23 // VTK includes
24 class vtkAlgorithmOutput;
25 class vtkAssignAttributes;
26 class vtkEventForwarderCommand;
27 class vtkDataArray;
28 class vtkPointSet;
29 class vtkPolyData;
30 class vtkTransformFilter;
31 class vtkUnstructuredGrid;
32 class vtkMRMLDisplayNode;
33 
42 class VTK_MRML_EXPORT vtkMRMLModelNode : public vtkMRMLDisplayableNode
43 {
44 public:
45  static vtkMRMLModelNode *New();
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
49  //--------------------------------------------------------------------------
51  //--------------------------------------------------------------------------
52 
53  vtkMRMLNode* CreateNodeInstance() override;
54 
56  const char* GetNodeTagName() override {return "Model";};
57 
61 
63  void ProcessMRMLEvents ( vtkObject * /*caller*/,
64  unsigned long /*event*/,
65  void * /*callData*/ ) override;
66 
68  vtkMRMLModelDisplayNode* GetModelDisplayNode();
69 
72  virtual void SetAndObserveMesh(vtkPointSet *Mesh);
73 
76  virtual void SetAndObservePolyData(vtkPolyData *polyData);
77 
80  virtual vtkPointSet* GetMesh();
81 
84  virtual vtkPolyData* GetPolyData();
85 
89  virtual vtkUnstructuredGrid* GetUnstructuredGrid();
90 
94  virtual void SetPolyDataConnection(vtkAlgorithmOutput *inputPort);
95 
99  virtual void SetUnstructuredGridConnection(vtkAlgorithmOutput *inputPort);
100 
103  vtkGetObjectMacro(MeshConnection,vtkAlgorithmOutput)
104 
105 
106  virtual vtkAlgorithmOutput* GetPolyDataConnection();
109 
113  virtual vtkAlgorithmOutput* GetUnstructuredGridConnection();
114 
117  typedef enum {
118  PolyDataMeshType = 0,
119  UnstructuredGridMeshType
120  } MeshTypeHint;
121 
127  vtkGetMacro(MeshType, MeshTypeHint);
128 
135  enum
136  {
137  MeshModifiedEvent = 17001,
138  PolyDataModifiedEvent = 17001
139  };
140 
143  void AddPointScalars(vtkDataArray *array);
144 
147  void AddCellScalars(vtkDataArray *array);
148 
152  void AddScalars(vtkDataArray *array, int location);
153 
155  void RemoveScalars(const char *scalarName);
156 
160  bool HasPointScalarName(const char* scalarName);
161 
165  bool HasCellScalarName(const char* scalarName);
166 
174  int SetActivePointScalars(const char *scalarName, int attributeType);
175 
181  const char *GetActivePointScalarName(int type);
182 
190  int SetActiveCellScalars(const char *scalarName, int attributeType);
191 
196  const char *GetActiveCellScalarName(int type);
197 
201  static int GetAttributeTypeFromString(const char* typeName);
202 
213  int CompositeScalars(const char* backgroundName, const char* overlayName,
214  float overlayMin, float overlayMax,
215  int showOverlayPositive, int showOverlayNegative,
216  int reverseOverlay);
217 
222  void GetRASBounds(double bounds[6]) override;
223 
227  void GetBounds(double bounds[6]) override;
228 
233  virtual void TransformBoundsToRAS(double inputBounds_Local[6], double outputBounds_RAS[6]);
234 
235  bool CanApplyNonLinearTransforms()const override;
236  void ApplyTransform(vtkAbstractTransform* transform) override;
237 
239 
240  std::string GetDefaultStorageNodeClassName(const char* filename /* =nullptr */) override;
241 
243  void CreateDefaultDisplayNodes() override;
244 
252  bool GetModifiedSinceRead() override;
253 
254 protected:
256  ~vtkMRMLModelNode() override;
258  void operator=(const vtkMRMLModelNode&);
259 
261  virtual void SetMeshConnection(vtkAlgorithmOutput *inputPort);
262 
265  virtual void UpdateDisplayNodeMesh(vtkMRMLDisplayNode *dnode);
266 
269  void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override;
270 
273  void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override;
274 
275 
278  void SetMeshToDisplayNodes();
279 
282  virtual void SetMeshToDisplayNode(vtkMRMLModelDisplayNode* modelDisplayNode);
283 
285  vtkAlgorithmOutput* MeshConnection;
286  vtkEventForwarderCommand* DataEventForwarder;
288 };
289 
290 #endif
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
vtkEventForwarderCommand * DataEventForwarder
MRML node to represent a display property of 3D surface model.
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual void GetBounds(double bounds[6])
MRML node to represent a 3D surface model.
virtual bool GetModifiedSinceRead()
void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override
Called when a node reference ID is added (list size increased).
virtual void ApplyTransform(vtkAbstractTransform *transform)
void operator=(const vtkMRMLDisplayableNode &)
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
virtual std::string GetDefaultStorageNodeClassName(const char *filename=nullptr)
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void CreateDefaultDisplayNodes()
A superclass for other storage nodes.
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
vtkMRMLCopyContentMacro(vtkMRMLStorableNode)
vtkAlgorithmOutput * MeshConnection
Data.
virtual bool CanApplyNonLinearTransforms() const
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Called when a node reference ID is modified.
virtual void GetRASBounds(double bounds[6])
MeshTypeHint MeshType