NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkAffineTransformDataNodeProperty.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkAffineTransformDataNodeProperty_h
16 #define niftkAffineTransformDataNodeProperty_h
17 
18 #include "niftkCoreExports.h"
19 
20 #include <algorithm>
21 
22 #include <vtkSmartPointer.h>
23 #include <vtkMatrix4x4.h>
24 
25 #include <mitkBaseProperty.h>
26 #include <mitkDataNode.h>
27 
28 namespace niftk
29 {
30 
35 class NIFTKCORE_EXPORT AffineTransformDataNodeProperty : public mitk::BaseProperty
36 {
37 
38 public:
39 
40  mitkClassMacro(AffineTransformDataNodeProperty, mitk::BaseProperty)
41  itkNewMacro(Self)
42 
43 
46  vtkMatrix4x4& GetTransform(void)
47  {
48  return *msp_Transform;
49  }
50 
54  const vtkMatrix4x4& GetTransform(void) const
55  {
56  return *msp_Transform;
57  }
58 
65  void SetTransform(const vtkMatrix4x4 &transform)
66  {
67  if (msp_Transform.GetPointer() == NULL)
68  msp_Transform = vtkSmartPointer<vtkMatrix4x4>::New();
69  msp_Transform->DeepCopy(&transform.Element[0][0]);
70  }
71 
75  virtual std::string GetValueAsString() const override;
76 
80  virtual void Identity()
81  {
82  msp_Transform->Identity();
83  }
84 
91  static vtkSmartPointer<vtkMatrix4x4> LoadTransformFromNode(const std::string propertyName, const mitk::DataNode &node);
92 
96  static void StoreTransformInNode(const std::string propertyName, const vtkMatrix4x4 &transform, mitk::DataNode &r_node);
97 
98 protected:
99 
101  AffineTransformDataNodeProperty(void); // Purposefully hidden.
102  AffineTransformDataNodeProperty(const AffineTransformDataNodeProperty& other); // Purposefully hidden.
103 
104 private:
105 
106  AffineTransformDataNodeProperty& operator=(const AffineTransformDataNodeProperty&); // Purposefully not implemented.
107  itk::LightObject::Pointer InternalClone() const override;
108 
112  virtual bool IsEqual(const BaseProperty& property) const override;
113 
117  virtual bool Assign(const BaseProperty& ) override;
118 
119  vtkSmartPointer<vtkMatrix4x4> msp_Transform;
120 };
121 
122 }
123 
124 #endif
const vtkMatrix4x4 & GetTransform(void) const
Definition: niftkAffineTransformDataNodeProperty.h:54
void SetTransform(const vtkMatrix4x4 &transform)
Sets transform.
Definition: niftkAffineTransformDataNodeProperty.h:65
virtual ~AffineTransformDataNodeProperty(void)
Definition: niftkAffineTransformDataNodeProperty.h:100
GLuint GLenum GLenum transform
Definition: glew.h:12775
INT property
Definition: wglew.h:144
MITK data-node property suitable for holding affine transforms.
Definition: niftkAffineTransformDataNodeProperty.h:35
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194
virtual void Identity()
Method to set these parameters back to identity.
Definition: niftkAffineTransformDataNodeProperty.h:80