Slicer  4.13
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 
258  void CreateDefaultDisplayNodes() override;
259 
261  void CreateDefaultSequenceDisplayNodes() override;
262 
270  vtkGetMacro(ReadAsTransformToParent, int);
271  vtkSetMacro(ReadAsTransformToParent, int);
272  vtkBooleanMacro(ReadAsTransformToParent, int);
273 
278  virtual void TransformModified()
279  {
281  }
282 
283  bool GetModifiedSinceRead() override;
284 
290  vtkAbstractTransform* GetTransformToParentAs(const char* transformType, bool logErrorIfFails = true, bool modifiableOnly = false);
291 
297  vtkAbstractTransform* GetTransformFromParentAs(const char* transformType, bool logErrorIfFails = true, bool modifiableOnly = false);
298 
304  void SetAndObserveTransformToParent(vtkAbstractTransform *transform);
305 
311  void SetAndObserveTransformFromParent(vtkAbstractTransform *transform);
312 
314  void ProcessMRMLEvents ( vtkObject * /*caller*/,
315  unsigned long /*event*/,
316  void * /*callData*/ ) override;
317 
321  static void FlattenGeneralTransform(vtkCollection* outputTransformList, vtkAbstractTransform* inputTransform);
322 
326  static bool AreTransformsEqual(vtkAbstractTransform* transform1, vtkAbstractTransform* transform2);
327 
333  static bool IsGeneralTransformLinear(vtkAbstractTransform* inputTransform, vtkTransform* concatenatedLinearTransform=nullptr);
334 
339  static bool IsAbstractTransformComputedFromInverse(vtkAbstractTransform* abstractTransform);
340 
345  static int DeepCopyTransform(vtkAbstractTransform* dst, vtkAbstractTransform* src);
346 
350  void Inverse();
351 
354  virtual void InverseName();
355 
357  vtkMTimeType GetTransformToWorldMTime();
358 
364  const char* GetTransformInfo(vtkAbstractTransform* inputTransform);
365 
367  static const char* GetMovingNodeReferenceRole() { return "spatialRegistrationMoving"; };
369  static const char* GetFixedNodeReferenceRole() { return "spatialRegistrationFixed"; };
370 
371 protected:
373  ~vtkMRMLTransformNode() override;
375  void operator=(const vtkMRMLTransformNode&);
376 
381  virtual vtkAbstractTransform* GetAbstractTransformAs(vtkAbstractTransform* inputTransform, const char* transformClassName, bool logErrorIfFails);
382 
385  virtual void SetAndObserveTransform(vtkAbstractTransform** originalTransformPtr, vtkAbstractTransform** inverseTransformPtr, vtkAbstractTransform *transform);
386 
394  vtkAbstractTransform* TransformToParent;
395  vtkAbstractTransform* TransformFromParent;
396 
398 
399  // Temporary buffers used for returning transform info as char*
400  std::string TransformInfo;
401 
406 };
407 
408 #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:551
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 &)
virtual vtkMRMLStorageNode * CreateDefaultSequenceStorageNode()
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
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