NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkAffineTransformer.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 niftkAffineTransformer_h
16 #define niftkAffineTransformer_h
17 
18 #include <itkObject.h>
19 #include <mitkBaseData.h>
20 #include <mitkDataStorage.h>
21 #include <mitkImage.h>
22 #include <vtkSmartPointer.h>
23 #include <vtkLinearTransform.h>
24 
27 
28 #include "niftkCoreExports.h"
29 
30 namespace niftk
31 {
32 
61 class NIFTKCORE_EXPORT AffineTransformer : public itk::Object
62 {
63 
64 public:
65 
67  static const std::string VIEW_ID;
68 
71 
74 
77 
80 
83 
84  mitkClassMacroItkParent(AffineTransformer, itk::Object)
85  itkNewMacro(AffineTransformer)
86 
88  itkGetMacro(RotateAroundCenter, bool);
89  itkSetMacro(RotateAroundCenter, bool);
90 
92  void SetDataStorage(mitk::DataStorage::Pointer dataStorage);
93 
95  mitk::DataStorage::Pointer GetDataStorage() const;
96 
98  AffineTransformParametersDataNodeProperty::Pointer GetCurrentTransformParameters() const;
99 
101  vtkSmartPointer<vtkMatrix4x4> GetTransformMatrixFromNode(std::string which) const;
102 
104  vtkSmartPointer<vtkMatrix4x4> GetCurrentTransformMatrix() const;
105 
107  void ResetTransform();
108 
110  void OnNodeChanged(mitk::DataNode::Pointer node);
111 
113  void OnParametersChanged(AffineTransformParametersDataNodeProperty::Pointer paramsProperty);
114 
116  void OnSaveTransform(std::string filename);
117 
119  void OnLoadTransform(std::string filename);
120 
122  void OnApplyTransform();
123 
125  void OnResampleTransform();
126 
128  void InitialiseTransformProperty(std::string name, mitk::DataNode::Pointer node);
129 
131  void InitialiseNodeProperties(mitk::DataNode::Pointer node);
132 
134  void UpdateNodeProperties(const vtkSmartPointer<vtkMatrix4x4> displayedTransformFromParameters,
135  const vtkSmartPointer<vtkMatrix4x4> incrementalTransformToBeComposed,
136  mitk::DataNode::Pointer);
137 
139  void UpdateTransformProperty(std::string name, vtkSmartPointer<vtkMatrix4x4> transform, mitk::DataNode::Pointer node);
140 
142  void ApplyTransformToNode(const vtkSmartPointer<vtkMatrix4x4> transformFromFile, mitk::DataNode::Pointer node);
143 
145  void ApplyResampleToCurrentNode();
146 
147 protected:
148 
150  virtual ~AffineTransformer();
151 
152  AffineTransformer(const AffineTransformer&); // Purposefully not implemented.
153  AffineTransformer& operator=(const AffineTransformer&); // Purposefully not implemented.
154 
156  virtual vtkSmartPointer<vtkMatrix4x4> ComputeTransformFromParameters(void) const;
157 
159  void UpdateTransformationGeometry();
160 
161 private:
163  AffineTransformParametersDataNodeProperty::Pointer m_CurrDispTransfProp;
164 
166  mitk::DataStorage::Pointer m_DataStorage;
167 
169  mitk::DataNode::Pointer m_CurrentDataNode;
170 
172  bool m_RotateAroundCenter;
173 
175  double m_CentreOfRotation[3];
176 
178  double m_Translation[3];
179  double m_Rotation[3];
180  double m_Scaling[3];
181  double m_Shearing[3];
182 };
183 
184 }
185 
186 #endif
Class to contain all the ITK/MITK logic for the Affine Transformation Plugin, to separate from Affine...
Definition: niftkAffineTransformer.h:61
Definition: niftkAffineTransformParametersDataNodeProperty.h:37
static const std::string INITIAL_TRANSFORM_KEY
See class introduction.
Definition: niftkAffineTransformer.h:70
void ApplyTransformToNode(const vtkMatrix4x4 &transform, mitk::DataNode::Pointer &node)
Applies (sets, i.e. copies) the given transform to the given node.
Definition: niftkDataStorageUtils.cxx:461
Definition: niftkMeshSmoother.cxx:19
Definition: ReceptorMemberCommandTest.cxx:25
static const std::string VIEW_ID
Simply stores the view name = "uk.ac.ucl.cmic.affinetransformview".
Definition: niftkAffineTransformer.h:67
static const std::string DISPLAYED_TRANSFORM_KEY
See class introduction.
Definition: niftkAffineTransformer.h:79
static const std::string INCREMENTAL_TRANSFORM_KEY
See class introduction.
Definition: niftkAffineTransformer.h:73
GLuint GLenum GLenum transform
Definition: glew.h:12775
static const std::string PRELOADED_TRANSFORM_KEY
See class introduction.
Definition: niftkAffineTransformer.h:76
GLuint const GLchar * name
Definition: glew.h:1798
static const std::string DISPLAYED_PARAMETERS_KEY
See class introduction.
Definition: niftkAffineTransformer.h:82
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194