20  itk::Vector<double,3> point; 
 
   21  point[0] = rotationVector[0];
 
   22  point[1] = rotationVector[1];
 
   23  point[2] = rotationVector[2];
 
   29  itk::Matrix<double,3,3> rotMatrixA;
 
   30  for(
int i=0; i<3; i++) 
for(
int j=0; j<3; j++) rotMatrixA[i][j] = a.rotation_matrix_transpose().transpose()[i][j];
 
   32  itk::Matrix<double,3,3> rotMatrixB;
 
   33  for(
int i=0; i<3; i++) 
for(
int j=0; j<3; j++) rotMatrixB[i][j] = b.rotation_matrix_transpose().transpose()[i][j];
 
   35  itk::Vector<double,3> pt1 = rotMatrixA * point;
 
   36  itk::Vector<double,3> pt2 = rotMatrixB * point;
 
   38  returnValue = (pt1[0]*pt2[0]+pt1[1]*pt2[1]+pt1[2]*pt2[2]) / ( sqrt(pow(pt1[0],2.0)+pow(pt1[1],2.0)+pow(pt1[2],2.0)) * sqrt(pow(pt2[0],2.0)+pow(pt2[1],2.0)+pow(pt2[2],2.0)));
 
   39  returnValue = acos(returnValue) * 57.296; 
 
 
   56    double PI = 3.141592653589793;
 
   57    alpha = alpha * PI / 180;
 
   58    beta = beta * PI / 180;
 
   59    gamma = gamma * PI / 180;
 
   62    itk::Matrix<double,3,3> matrix;
 
   79    matrix[0][0] = cos(beta) * cos(alpha);
 
   80    matrix[0][1] = cos(beta) * sin(alpha);
 
   81    matrix[0][2] = -sin(beta);
 
   83    matrix[1][0] = sin(gamma) * sin(beta) * cos(alpha) - cos(gamma) * sin(alpha) ;
 
   84    matrix[1][1] = sin(gamma) * sin(beta) * sin(alpha) + cos(gamma) * cos(alpha);
 
   85    matrix[1][2] = sin(gamma) * cos(beta);
 
   87    matrix[2][0] = cos(gamma) * sin(beta) * cos(alpha) + sin(gamma) * sin(alpha);
 
   88    matrix[2][1] = cos(gamma) * sin(beta) * sin(alpha) - sin(gamma) * cos(alpha);
 
   89    matrix[2][2] = cos(gamma) * cos(beta);
 
 
   96  if (imageFiducials->GetSize() != realWorldFiducials->GetSize())
 
   98    MITK_WARN << 
"Cannot compute FRE, got different numbers of points (1: " << imageFiducials->GetSize() << 
" /2: " << realWorldFiducials->GetSize() << 
")";
 
  102  for (
int i = 0; i < imageFiducials->GetSize(); i++)
 
  104    itk::Point<double> current_image_fiducial_point = imageFiducials->GetPoint(i);
 
  105    if (transform != 
nullptr)
 
  107      current_image_fiducial_point = transform->TransformPoint(imageFiducials->GetPoint(i)[0], imageFiducials->GetPoint(i)[1], imageFiducials->GetPoint(i)[2]);
 
  109    double cur_error_squared = current_image_fiducial_point.SquaredEuclideanDistanceTo(realWorldFiducials->GetPoint(i));
 
  110    FRE += cur_error_squared;
 
  113  FRE = sqrt(FRE / (
double)imageFiducials->GetSize());
 
 
MITKIGTBASE_EXPORT double ComputeFRE(mitk::PointSet::Pointer imageFiducials, mitk::PointSet::Pointer realWorldFiducials, vtkSmartPointer< vtkLandmarkTransform > transform=nullptr)
Computes the fiducial registration error out of two sets of fiducials. The two sets must have the sam...