10 #include <itkScalableAffineTransform.h>
11 #include <itkSmartPointer.h>
18 #include <vnl/vnl_matrix_fixed.h>
19 #include <vnl/vnl_vector.h>
20 #include <vnl/vnl_vector_fixed.h>
21 #include <vtkMatrix4x4.h>
22 #include <vtkMatrixToLinearTransform.h>
23 #include <vtkTransform.h>
30 mitk::AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
31 vnlmatrix = transform->GetMatrix().GetVnlMatrix();
33 spacing[0] = vnlmatrix.get_column(0).magnitude();
34 spacing[1] = vnlmatrix.get_column(1).magnitude();
35 spacing[2] = vnlmatrix.get_column(2).magnitude();
42 m_VtkIndexToWorldTransform->SetInput(m_VtkMatrix);
50 m_VtkIndexToWorldTransform->SetInput(m_VtkMatrix);
56 m_VtkMatrix->Delete();
57 m_VtkIndexToWorldTransform->Delete();
62 if (m_IndexToWorldTransform.IsNull())
65 m_IndexToWorldTransform->SetIdentity();
67 m_VtkMatrix->Identity();
85 void GeometryTransformHolder::TransferItkToVtkTransform()
94 void GeometryTransformHolder::TransferVtkToItkTransform()
112 m_IndexToWorldTransform->SetOffset(origin.GetVectorFromOrigin());
113 TransferItkToVtkTransform();
134 assert(aSpacing[0] > 0 && aSpacing[1] > 0 && aSpacing[2] > 0);
136 AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
138 vnlmatrix = m_IndexToWorldTransform->GetMatrix().GetVnlMatrix();
141 col = vnlmatrix.get_column(0);
144 vnlmatrix.set_column(0, col);
145 col = vnlmatrix.get_column(1);
148 vnlmatrix.set_column(1, col);
149 col = vnlmatrix.get_column(2);
152 vnlmatrix.set_column(2, col);
158 transform->SetMatrix(matrix);
159 transform->SetOffset(m_IndexToWorldTransform->GetOffset());
174 return m_IndexToWorldTransform;
182 m_IndexToWorldTransform = transform;
183 TransferItkToVtkTransform();
193 m_VtkMatrix->DeepCopy(vtkmatrix);
194 TransferVtkToItkTransform();
225 return (vtkLinearTransform *)m_VtkIndexToWorldTransform;
230 m_IndexToWorldTransform->SetMatrix(matrix);
231 TransferItkToVtkTransform();
236 m_IndexToWorldTransform->SetIdentity();
237 TransferItkToVtkTransform();
242 m_IndexToWorldTransform->Compose(other, pre);
243 TransferItkToVtkTransform();
248 m_VtkMatrix->DeepCopy(vtktransform->GetMatrix());
249 TransferVtkToItkTransform();
255 return m_IndexToWorldTransform->GetMatrix().GetVnlMatrix();
264 if ((leftHandSide ==
nullptr) || (rightHandSide ==
nullptr))
266 MITK_ERROR <<
"mitk::Equal(const mitk::Geometry3D *leftHandSide, const mitk::Geometry3D *rightHandSide, ScalarType "
267 "eps, bool verbose) does not with NULL pointer input.";
270 return Equal(*leftHandSide, *rightHandSide, eps, verbose);
285 MITK_INFO <<
"[( Geometry3D )] Spacing differs.";
286 MITK_INFO <<
"rightHandSide is " << setprecision(12) << rightHandSide.
GetSpacing() <<
" : leftHandSide is "
297 MITK_INFO <<
"[( Geometry3D )] Origin differs.";
298 MITK_INFO <<
"rightHandSide is " << setprecision(12) << rightHandSide.
GetOrigin() <<
" : leftHandSide is "
299 << leftHandSide.
GetOrigin() <<
" and tolerance is " <<
eps;
311 for (
int i = 0; i < 4; i++)
313 for (
int j = 0; j < 4; j++)
void TransferVtkMatrixToItkTransform(const vtkMatrix4x4 *vtkmatrix, TTransformType *itkTransform)
itk::SmartPointer< Self > Pointer
vnl_vector< ScalarType > VnlVector
DataCollection - Class to facilitate loading/accessing structured data.
void TransferItkTransformToVtkMatrix(const TTransformType *itkTransform, vtkMatrix4x4 *vtkmatrix)
itk::AffineGeometryFrame< ScalarType, 3 >::TransformType AffineTransform3D
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
MITKCORE_EXPORT const ScalarType eps
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.