15 #include <vtkPoints.h> 23 vnl_svd<double> svd(sum.GetVnlMatrix());
27 diag[0][0] = 1.0 / sqrt(svd.W(0));
28 diag[1][1] = 1.0 / sqrt(svd.W(1));
29 diag[2][2] = 1.0 / sqrt(svd.W(2));
32 for (
unsigned int i = 0; i < 3; ++i)
33 for (
unsigned int j = 0; j < 3; ++j)
34 V[i][j] = svd.V()[i][j];
37 returnValue = V * diag * V.GetTranspose();
47 #pragma omp parallel for 48 for (
int i = 0; i < src->GetNumberOfPoints(); ++i)
52 src->GetPoint(i, p_in);
54 for (
unsigned int j = 0; j < 3; ++j)
56 p_out[j] = p_in[0] * rotation[j][0] + p_in[1] * rotation[j][1] + p_in[2] * rotation[j][2] + translation[j];
59 dst->SetPoint(i, p_out);
67 const vnl_matrix_fixed<double, 3, 3> rotationT = rotation.GetTranspose();
69 #pragma omp parallel for 70 for (
int i = 0; i < static_cast<int>(src.size()); ++i)
72 dst[i] = rotation * src[i] * rotationT;
83 for (
int i = 0; i < movingTargets->
GetSize(); ++i)
89 pm = rotation * pm + translation;
92 (ps[0] - pm[0]) * (ps[0] - pm[0]) + (ps[1] - pm[1]) * (ps[1] - pm[1]) + (ps[2] - pm[2]) * (ps[2] - pm[2]);
97 tre /= movingTargets->
GetSize();
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
virtual int GetSize(unsigned int t=0) const
returns the current size of the point-list
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.
PointType GetPoint(PointIdentifier id, int t=0) const
Get the point with ID id in world coordinates.