19 #include <vtkPoints.h>
27 vnl_svd<double> svd(sum.GetVnlMatrix());
31 diag[0][0] = 1.0 / sqrt(svd.W(0));
32 diag[1][1] = 1.0 / sqrt(svd.W(1));
33 diag[2][2] = 1.0 / sqrt(svd.W(2));
36 for (
unsigned int i = 0; i < 3; ++i)
37 for (
unsigned int j = 0; j < 3; ++j)
38 V[i][j] = svd.V()[i][j];
41 returnValue = V * diag * V.GetTranspose();
51 #pragma omp parallel for
52 for (vtkIdType i = 0; i < src->GetNumberOfPoints(); ++i)
56 src->GetPoint(i, p_in);
58 for (
unsigned int j = 0; j < 3; ++j)
60 p_out[j] = p_in[0] * rotation[j][0] + p_in[1] * rotation[j][1] + p_in[2] * rotation[j][2] + translation[j];
63 dst->SetPoint(i, p_out);
71 const vnl_matrix_fixed<double, 3, 3> rotationT = rotation.GetTranspose();
73 #pragma omp parallel for
74 for (
int i = 0; i < static_cast<int>(src.size()); ++i)
76 dst[i] = rotation * src[i] * rotationT;
87 for (
int i = 0; i < movingTargets->
GetSize(); ++i)
93 pm = rotation * pm + translation;
96 (ps[0] - pm[0]) * (ps[0] - pm[0]) + (ps[1] - pm[1]) * (ps[1] - pm[1]) + (ps[2] - pm[2]) * (ps[2] - pm[2]);
101 tre /= movingTargets->
GetSize();
virtual int GetSize(unsigned int t=0) const
returns the current size of the point-list
PointType GetPoint(PointIdentifier id, int t=0) const
Get the point with ID id in world coordinates.
static double ComputeTargetRegistrationError(const mitk::PointSet *movingTargets, const mitk::PointSet *fixedTargets, const Rotation &rotation, const Translation &translation)
Compute the target registration error between two point sets.
std::vector< WeightMatrix > MatrixList
static void PropagateMatrices(const MatrixList &src, MatrixList &dst, const Rotation &rotation)
Propagate a list of matrices with a rotation matrix.
Data structure which stores a set of points. Superclass of mitk::Mesh.
itk::Matrix< double, 3, 3 > WeightMatrix
WeightMatrix CovarianceMatrix
static void TransformPoints(vtkPoints *src, vtkPoints *dst, const Rotation &rotation, const Translation &translation)
Transforms a point cloud with a Rotation and Translation.
static WeightMatrix CalculateWeightMatrix(const CovarianceMatrix &sigma_X, const CovarianceMatrix &sigma_Y)
Method that computes a WeightMatrix with two CovarianceMatrices.