NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkPointUtils.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 niftkPointUtils_h
16 #define niftkPointUtils_h
17 
18 #include "niftkCoreExports.h"
19 #include <mitkVector.h>
20 #include <mitkPointSet.h>
21 #include <vtkMatrix4x4.h>
23 
28 namespace niftk {
29 
33 NIFTKCORE_EXPORT double CalculateStepSize(double *spacing);
34 
38 NIFTKCORE_EXPORT bool AreDifferent(const mitk::Point3D& a, const mitk::Point3D& b);
39 
43 NIFTKCORE_EXPORT double GetSquaredDistanceBetweenPoints(const mitk::Point3D& a, const mitk::Point3D& b);
44 
51 NIFTKCORE_EXPORT double GetRMSErrorBetweenPoints(
52  const mitk::PointSet& fixed,
53  const mitk::PointSet& moving,
54  const CoordinateAxesData * const transform = NULL);
55 
59 NIFTKCORE_EXPORT void GetDifference(const mitk::Point3D& a, const mitk::Point3D& b, mitk::Point3D& output);
60 
64 NIFTKCORE_EXPORT double Length(mitk::Point3D& vector);
65 
69 NIFTKCORE_EXPORT void Normalise(mitk::Point3D& vector);
70 
74 NIFTKCORE_EXPORT void CopyValues(const mitk::Point3D& a, mitk::Point3D& b);
75 
79 NIFTKCORE_EXPORT void CrossProduct(const mitk::Point3D& a, const mitk::Point3D& b, mitk::Point3D& c);
80 
84 NIFTKCORE_EXPORT void ComputeNormalFromPoints(const mitk::Point3D& a, const mitk::Point3D& b, const mitk::Point3D& c, mitk::Point3D& output);
85 
89 NIFTKCORE_EXPORT double FindLargestDistanceBetweenTwoPoints(const mitk::PointSet& input);
90 
94 NIFTKCORE_EXPORT int CopyPointSets(const mitk::PointSet& input, mitk::PointSet& output);
95 
99 NIFTKCORE_EXPORT void ScalePointSets(const mitk::PointSet& input, mitk::PointSet& output, double scaleFactor);
100 
106 NIFTKCORE_EXPORT int FilterMatchingPoints(
107  const mitk::PointSet& fixedPointsIn,
108  const mitk::PointSet& movingPointsIn,
109  mitk::PointSet& fixedPointsOut,
110  mitk::PointSet& movingPointsOut
111  );
112 
118 NIFTKCORE_EXPORT int RemoveNaNPoints(
119  const mitk::PointSet& pointsIn,
120  mitk::PointSet& pointsOut
121  );
122 
127 NIFTKCORE_EXPORT bool CheckForNaNPoint(
128  const mitk::PointSet::PointType& point);
129 
135 NIFTKCORE_EXPORT void TransformPointByVtkMatrix(
136  const vtkMatrix4x4* matrix,
137  const bool& isNormal,
138  mitk::Point3D& pointOrNormal
139  );
140 
144 NIFTKCORE_EXPORT void TransformPointsByVtkMatrix(
145  const mitk::PointSet& input,
146  const vtkMatrix4x4& matrix,
147  mitk::PointSet& output
148  );
149 
153 NIFTKCORE_EXPORT mitk::Point3D ComputeCentroid(
154  const mitk::PointSet& input
155  );
156 
157 }
158 
159 #endif
void TransformPointsByVtkMatrix(const mitk::PointSet &input, const vtkMatrix4x4 &matrix, mitk::PointSet &output)
Multiplies one point set by a matrix.
Definition: niftkPointUtils.cxx:300
const GLfloat * c
Definition: glew.h:14144
GLenum GLenum GLenum input
Definition: glew.h:12016
void CrossProduct(const mitk::Point3D &a, const mitk::Point3D &b, mitk::Point3D &c)
Computes c = a x b, and will normalise a and b to unit length first.
Definition: niftkPointUtils.cxx:236
void GetDifference(const mitk::Point3D &a, const mitk::Point3D &b, mitk::Point3D &output)
Returns as output the vector difference of a-b.
Definition: niftkPointUtils.cxx:123
void Normalise(mitk::Point3D &vector)
Given a vector, will normalise it to unit length.
Definition: niftkPointUtils.cxx:149
int FilterMatchingPoints(const mitk::PointSet &fixedPointsIn, const mitk::PointSet &movingPointsIn, mitk::PointSet &fixedPointsOut, mitk::PointSet &movingPointsOut)
Takes fixed and moving points, and scans for matching ID's and returns 2 point sets with ordered and ...
Definition: niftkPointUtils.cxx:325
double Length(mitk::Point3D &vector)
Given a vector, will calculate the length.
Definition: niftkPointUtils.cxx:133
double CalculateStepSize(double *spacing)
Given a double[3] of x,y,z voxel spacing, calculates a step size along a ray, as 1/3 of the smallest ...
Definition: niftkPointUtils.cxx:24
double FindLargestDistanceBetweenTwoPoints(const mitk::PointSet &input)
Computes the largest Euclidean Distance between any two points.
Definition: niftkPointUtils.cxx:163
void ComputeNormalFromPoints(const mitk::Point3D &a, const mitk::Point3D &b, const mitk::Point3D &c, mitk::Point3D &output)
Computes the normal by calculating cross product of (a-b) and (c-b).
Definition: niftkPointUtils.cxx:252
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
GLuint GLenum GLenum transform
Definition: glew.h:12775
double GetRMSErrorBetweenPoints(const mitk::PointSet &fixedPoints, const mitk::PointSet &movingPoints, const CoordinateAxesData *const transform)
Gets the RMS error between fixed point set and a moving point set, with optional transform specified...
Definition: niftkPointUtils.cxx:74
void ScalePointSets(const mitk::PointSet &input, mitk::PointSet &output, double scaleFactor)
Copies input to output, i.e. the output is erased, and re-populated, multiplying by a scale factor...
Definition: niftkPointUtils.cxx:204
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:8272
int RemoveNaNPoints(const mitk::PointSet &pointsIn, mitk::PointSet &pointsOut)
Takes a point set and scans for matching NaN's and returns a point set with the offending points remo...
Definition: niftkPointUtils.cxx:371
mitk::Point3D ComputeCentroid(const mitk::PointSet &input)
Computes the mean/centroid of an mitk::PointSet.
Definition: niftkPointUtils.cxx:418
bool CheckForNaNPoint(const mitk::PointSet::PointType &point)
Checks if the point contains a NaN value.
Definition: niftkPointUtils.cxx:407
GLuint GLenum matrix
Definition: glew.h:12775
bool AreDifferent(const mitk::Point3D &a, const mitk::Point3D &b)
Returns true if a and b are different (up to a given tolerance, currently 0.01), and false otherwise...
Definition: niftkPointUtils.cxx:42
void CopyValues(const mitk::Point3D &a, mitk::Point3D &b)
Copies a into b.
Definition: niftkPointUtils.cxx:226
int CopyPointSets(const mitk::PointSet &input, mitk::PointSet &output)
Copies input to output, i.e. the output is erased, and re-populated.
Definition: niftkPointUtils.cxx:188
void TransformPointByVtkMatrix(const vtkMatrix4x4 *matrix, const bool &isNormal, mitk::Point3D &point)
Simple method to multiply a mitk::Point3D by a vtkMatrix, if the matrix is not NULL, and otherwise if matrix is NULL, will simply leave the point un-altered.
Definition: niftkPointUtils.cxx:264
Definition: niftkExceptionObject.h:21
double GetSquaredDistanceBetweenPoints(const mitk::Point3D &a, const mitk::Point3D &b)
Returns the squared Euclidean distance between a and b.
Definition: niftkPointUtils.cxx:60