Slicer  5.1
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) override;
39 
40  vtkMRMLNode* CreateNodeInstance() override;
41 
44  void ReadXMLAttributes( const char** atts) override;
45 
48  void WriteXML(ostream& of, int indent) override;
49 
53 
56  const char* GetNodeTagName() override {return "Transform";};
57 
60  void UpdateScene(vtkMRMLScene *scene) 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  void ApplyTransformMatrix(vtkMatrix4x4* transformMatrix) override;
226 
231  virtual int SetAndObserveMatrixTransformToParent(vtkMatrix4x4 *matrix);
232 
237  virtual int SetAndObserveMatrixTransformFromParent(vtkMatrix4x4 *matrix);
238 
240  bool CanApplyNonLinearTransforms()const override;
242  void ApplyTransform(vtkAbstractTransform* transform) override;
243 
247  virtual int Split();
248 
252 
255  void CreateDefaultDisplayNodes() override;
256 
258  void CreateDefaultSequenceDisplayNodes() override;
259 
267  vtkGetMacro(ReadAsTransformToParent, int);
268  vtkSetMacro(ReadAsTransformToParent, int);
269  vtkBooleanMacro(ReadAsTransformToParent, int);
270 
275  virtual void TransformModified()
276  {
278  }
279 
280  bool GetModifiedSinceRead() override;
281 
287  vtkAbstractTransform* GetTransformToParentAs(const char* transformType, bool logErrorIfFails = true, bool modifiableOnly = false);
288 
294  vtkAbstractTransform* GetTransformFromParentAs(const char* transformType, bool logErrorIfFails = true, bool modifiableOnly = false);
295 
301  void SetAndObserveTransformToParent(vtkAbstractTransform *transform);
302 
308  void SetAndObserveTransformFromParent(vtkAbstractTransform *transform);
309 
311  void ProcessMRMLEvents ( vtkObject * /*caller*/,
312  unsigned long /*event*/,
313  void * /*callData*/ ) override;
314 
318  static void FlattenGeneralTransform(vtkCollection* outputTransformList, vtkAbstractTransform* inputTransform);
319 
323  static bool AreTransformsEqual(vtkAbstractTransform* transform1, vtkAbstractTransform* transform2);
324 
330  static bool IsGeneralTransformLinear(vtkAbstractTransform* inputTransform, vtkTransform* concatenatedLinearTransform=nullptr);
331 
336  static bool IsAbstractTransformComputedFromInverse(vtkAbstractTransform* abstractTransform);
337 
342  static int DeepCopyTransform(vtkAbstractTransform* dst, vtkAbstractTransform* src);
343 
347  void Inverse();
348 
351  virtual void InverseName();
352 
354  vtkMTimeType GetTransformToWorldMTime();
355 
361  const char* GetTransformInfo(vtkAbstractTransform* inputTransform);
362 
364  static const char* GetMovingNodeReferenceRole() { return "spatialRegistrationMoving"; };
366  static const char* GetFixedNodeReferenceRole() { return "spatialRegistrationFixed"; };
367 
368 protected:
370  ~vtkMRMLTransformNode() override;
372  void operator=(const vtkMRMLTransformNode&);
373 
378  virtual vtkAbstractTransform* GetAbstractTransformAs(vtkAbstractTransform* inputTransform, const char* transformClassName, bool logErrorIfFails);
379 
382  virtual void SetAndObserveTransform(vtkAbstractTransform** originalTransformPtr, vtkAbstractTransform** inverseTransformPtr, vtkAbstractTransform *transform);
383 
391  vtkAbstractTransform* TransformToParent;
392  vtkAbstractTransform* TransformFromParent;
393 
395 
396  // Temporary buffers used for returning transform info as char*
397  std::string TransformInfo;
398 
403 };
404 
405 #endif
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file
MRML node for representing a transformation between this node space and a parent node space...
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual void InvokeCustomModifiedEvent(int eventId, void *callData=nullptr)
This method allows the node to compress events.
Definition: vtkMRMLNode.h:577
static const char * GetMovingNodeReferenceRole()
Reference role name from the transform node to the moving volume or fiducial node that participated i...
virtual bool GetModifiedSinceRead()
virtual void ApplyTransform(vtkAbstractTransform *transform)
vtkAbstractTransform * TransformFromParent
virtual void CreateDefaultSequenceDisplayNodes()
vtkMatrix4x4 * CachedMatrixTransformToParent
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void operator=(const vtkMRMLDisplayableNode &)
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void CreateDefaultDisplayNodes()
virtual void ApplyTransformMatrix(vtkMatrix4x4 *transformMatrix)
A superclass for other storage nodes.
void UpdateScene(vtkMRMLScene *scene) override
Finds the storage node and read the data
static const char * GetFixedNodeReferenceRole()
Reference role name from the transform node to the moving volume or fiducial node that participated i...
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
virtual void TransformModified()
vtkMRMLCopyContentMacro(vtkMRMLStorableNode)
virtual bool CanApplyNonLinearTransforms() const
vtkAbstractTransform * TransformToParent
void UpdateScene(vtkMRMLScene *scene) override
Finds the storage node and read the data
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
vtkMatrix4x4 * CachedMatrixTransformFromParent