Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLTransformNode.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: vtkMRMLTransformNode.h,v $
10  Date: $Date: 2006/03/19 17:12:29 $
11  Version: $Revision: 1.13 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLTransformNode_h
16 #define __vtkMRMLTransformNode_h
17 
18 #include "vtkMRMLDisplayableNode.h"
19 
20 class vtkCollection;
21 class vtkAbstractTransform;
22 class vtkGeneralTransform;
23 class vtkMatrix4x4;
24 class vtkTransform;
25 
33 class VTK_MRML_EXPORT vtkMRMLTransformNode : public vtkMRMLDisplayableNode
34 {
35 public:
36  static vtkMRMLTransformNode *New();
38  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
39 
40  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
41 
44  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
45 
48  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
49 
52  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
53 
56  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "Transform";};
57 
60  virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE
61  {
63  };
64 
67  virtual int IsLinear();
68 
71  virtual int IsComposite();
72 
75  virtual vtkAbstractTransform* GetTransformToParent();
76 
80  virtual int GetMatrixTransformToParent(vtkMatrix4x4* matrix);
81 
85  virtual int GetMatrixTransformFromParent(vtkMatrix4x4* matrix);
86 
92  virtual vtkMatrix4x4* GetMatrixTransformToParent();
93 
99  virtual vtkMatrix4x4* GetMatrixTransformFromParent();
100 
103  virtual const char* GetTransformToParentInfo();
104 
107  virtual vtkAbstractTransform* GetTransformFromParent();
108 
111  virtual const char* GetTransformFromParentInfo();
112 
115  int IsTransformToWorldLinear();
116 
119  int IsTransformToNodeLinear(vtkMRMLTransformNode* node);
120 
124  void GetTransformToWorld(vtkGeneralTransform* transformToWorld);
125 
129  void GetTransformFromWorld(vtkGeneralTransform* transformToWorld);
130 
134  void GetTransformToNode(vtkMRMLTransformNode* node,
135  vtkGeneralTransform* transformToNode);
136 
140  void GetTransformFromNode(vtkMRMLTransformNode* node,
141  vtkGeneralTransform* transformFromNode);
142 
146  static void GetTransformBetweenNodes(vtkMRMLTransformNode* sourceNode,
147  vtkMRMLTransformNode* targetNode, vtkGeneralTransform* transformSourceToTarget);
148 
153  virtual int GetMatrixTransformToWorld(vtkMatrix4x4* transformToWorld);
154 
159  virtual int GetMatrixTransformFromWorld(vtkMatrix4x4* transformFromWorld);
160 
165  virtual int GetMatrixTransformToNode(vtkMRMLTransformNode* node,
166  vtkMatrix4x4* transformToNode);
167 
172  virtual int GetMatrixTransformFromNode(vtkMRMLTransformNode* node,
173  vtkMatrix4x4* transformFromNode);
174 
179  static int GetMatrixTransformBetweenNodes(vtkMRMLTransformNode* sourceNode,
180  vtkMRMLTransformNode* targetNode, vtkMatrix4x4* transformSourceToTarget);
181 
185  int IsTransformNodeMyParent(vtkMRMLTransformNode* node);
186 
189  int IsTransformNodeMyChild(vtkMRMLTransformNode* node);
190 
195  vtkMRMLTransformNode* GetFirstCommonParent(vtkMRMLTransformNode* targetNode);
196 
209  virtual int SetMatrixTransformToParent(vtkMatrix4x4 *matrix);
210 
214  virtual int SetMatrixTransformFromParent(vtkMatrix4x4 *matrix);
215 
225  virtual void ApplyTransformMatrix(vtkMatrix4x4* transformMatrix) VTK_OVERRIDE;
226 
231  virtual int SetAndObserveMatrixTransformToParent(vtkMatrix4x4 *matrix);
232 
237  virtual int SetAndObserveMatrixTransformFromParent(vtkMatrix4x4 *matrix);
238 
240  virtual bool CanApplyNonLinearTransforms()const VTK_OVERRIDE;
242  virtual void ApplyTransform(vtkAbstractTransform* transform) VTK_OVERRIDE;
243 
247  virtual int Split();
248 
251  virtual vtkMRMLStorageNode* CreateDefaultStorageNode() VTK_OVERRIDE;
252 
255  virtual void CreateDefaultDisplayNodes() VTK_OVERRIDE;
256 
264  vtkGetMacro(ReadAsTransformToParent, int);
265  vtkSetMacro(ReadAsTransformToParent, int);
266  vtkBooleanMacro(ReadAsTransformToParent, int);
267 
272  virtual void TransformModified()
273  {
275  }
276 
277  virtual bool GetModifiedSinceRead() VTK_OVERRIDE;
278 
284  vtkAbstractTransform* GetTransformToParentAs(const char* transformType, bool logErrorIfFails = true, bool modifiableOnly = false);
285 
291  vtkAbstractTransform* GetTransformFromParentAs(const char* transformType, bool logErrorIfFails = true, bool modifiableOnly = false);
292 
298  void SetAndObserveTransformToParent(vtkAbstractTransform *transform);
299 
305  void SetAndObserveTransformFromParent(vtkAbstractTransform *transform);
306 
308  virtual void ProcessMRMLEvents ( vtkObject * /*caller*/,
309  unsigned long /*event*/,
310  void * /*callData*/ ) VTK_OVERRIDE;
311 
315  static void FlattenGeneralTransform(vtkCollection* outputTransformList, vtkAbstractTransform* inputTransform);
316 
322  static bool IsGeneralTransformLinear(vtkAbstractTransform* inputTransform, vtkTransform* concatenatedLinearTransform=NULL);
323 
328  static bool IsAbstractTransformComputedFromInverse(vtkAbstractTransform* abstractTransform);
329 
334  static int DeepCopyTransform(vtkAbstractTransform* dst, vtkAbstractTransform* src);
335 
339  void Inverse();
340 
342  vtkMTimeType GetTransformToWorldMTime();
343 
349  const char* GetTransformInfo(vtkAbstractTransform* inputTransform);
350 
351 protected:
355  void operator=(const vtkMRMLTransformNode&);
356 
361  virtual vtkAbstractTransform* GetAbstractTransformAs(vtkAbstractTransform* inputTransform, const char* transformClassName, bool logErrorIfFails);
362 
365  virtual void SetAndObserveTransform(vtkAbstractTransform** originalTransformPtr, vtkAbstractTransform** inverseTransformPtr, vtkAbstractTransform *transform);
366 
374  vtkAbstractTransform* TransformToParent;
375  vtkAbstractTransform* TransformFromParent;
376 
378 
379  // Temporary buffers used for returning transform info as char*
380  std::string TransformInfo;
381 
386 };
387 
388 #endif
virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE
Finds the storage node and read the data.
MRML node for representing a transformation between this node space and a parent node space...
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual bool GetModifiedSinceRead()
virtual void ApplyTransform(vtkAbstractTransform *transform)
vtkAbstractTransform * TransformFromParent
vtkMatrix4x4 * CachedMatrixTransformToParent
void operator=(const vtkMRMLDisplayableNode &)
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual void ProcessMRMLEvents(vtkObject *, unsigned long, void *) VTK_OVERRIDE
alternative method to propagate events generated in Display nodes
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void CreateDefaultDisplayNodes()
virtual void ApplyTransformMatrix(vtkMatrix4x4 *transformMatrix)
A supercalss for other storage nodes.
virtual void TransformModified()
virtual void InvokeCustomModifiedEvent(int eventId, void *callData=NULL)
This method allows the node to compress events.
Definition: vtkMRMLNode.h:492
virtual bool CanApplyNonLinearTransforms() const
vtkAbstractTransform * TransformToParent
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE
Finds the storage node and read the data.
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE=0
MRMLNode methods.
vtkMatrix4x4 * CachedMatrixTransformFromParent