NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkVTKFunctions.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 niftkVTKFunctions_h
16 #define niftkVTKFunctions_h
17 
19 
20 #include <vtkPolyData.h>
21 #include <vtkTransform.h>
22 #include <vtkRandomSequence.h>
23 #include <vtkMinimalStandardRandomSequence.h>
24 #include <vtkCellLocator.h>
25 #include <vtkCamera.h>
26 #include <vtkSmartPointer.h>
27 #include <vtkMatrix4x4.h>
28 
34 namespace niftk {
35 
37 extern "C++" NIFTKVTK_WINEXPORT double GetEuclideanDistanceBetweenTwo3DPoints(const double *a, const double *b);
38 
40 extern "C++" NIFTKVTK_WINEXPORT double GetLength(const double *a);
41 
43 extern "C++" NIFTKVTK_WINEXPORT void ScaleVector(const double& scaleFactor, const double* a, double* b);
44 
46 extern "C++" NIFTKVTK_WINEXPORT void SubtractTwo3DPoints(const double *a, const double *b, double *output);
47 
49 extern "C++" NIFTKVTK_WINEXPORT void AddTwo3DPoints(const double *a, const double *b, double *output);
50 
52 extern "C++" NIFTKVTK_WINEXPORT void NormaliseToUnitLength(const double *a, double *output);
53 
55 extern "C++" NIFTKVTK_WINEXPORT void Normalise3DPoint(const double *a, const double length, double *output);
56 
58 extern "C++" NIFTKVTK_WINEXPORT void CrossProductTwo3DVectors(const double *a, const double *b, double *output);
59 
61 extern "C++" NIFTKVTK_WINEXPORT void CalculateUnitVector(const double *a, const double* b, double *output);
62 
64 extern "C++" NIFTKVTK_WINEXPORT double AngleBetweenTwoUnitVectors(const double *a, const double *b);
65 
67 extern "C++" NIFTKVTK_WINEXPORT double AngleBetweenTwoUnitVectorsInDegrees(const double *a, const double *b);
68 
70 extern "C++" NIFTKVTK_WINEXPORT bool ClipPointToWithinBoundingBox(const double *boundingBoxVector6, double *point);
71 
73 extern "C++" NIFTKVTK_WINEXPORT double GetBoundingBoxDiagonalLength(const double *boundingBoxVector6);
74 
76 extern "C++" NIFTKVTK_WINEXPORT void CopyDoubleVector(int n, const double *a, double *b);
77 
79 extern "C++" NIFTKVTK_WINEXPORT void PerturbPolyDataAlongNormal(vtkPolyData * polydata,
80  double stdDev, vtkRandomSequence * rng);
81 
89 extern "C++" NIFTKVTK_WINEXPORT void PerturbPolyData(vtkPolyData * polydata,
90  double xerr, double yerr, double zerr, vtkRandomSequence * rng);
91 
98 extern "C++" NIFTKVTK_WINEXPORT void PerturbPolyData(vtkPolyData * polydata,
99  double xerr, double yerr, double zerr);
100 
107 extern "C++" NIFTKVTK_WINEXPORT void TranslatePolyData
108  (vtkPolyData * polydata, vtkTransform * transform);
109 
117 extern "C++" NIFTKVTK_WINEXPORT void RandomTransform
118  (vtkTransform * transform,
119  double xtrans, double ytrans, double ztrans, double xrot, double yrot, double zrot,
120  vtkRandomSequence * rng);
121 
128 extern "C++" NIFTKVTK_WINEXPORT void RandomTransform
129  (vtkTransform * transform,
130  double xtrans, double ytrans, double ztrans, double xrot, double yrot, double zrot);
131 
137 extern "C++" NIFTKVTK_WINEXPORT double NormalisedRNG (vtkRandomSequence * rng);
138 
146 extern "C++" NIFTKVTK_WINEXPORT bool DistancesToColorMap ( vtkPolyData * source, vtkPolyData * target );
147 
155 extern "C++" NIFTKVTK_WINEXPORT double DistanceToSurface ( double point[3] , vtkPolyData * target);
156 
165 extern "C++" NIFTKVTK_WINEXPORT double DistanceToSurface ( double point [3] , vtkCellLocator * targetLocator , vtkGenericCell * cell = NULL );
166 
173 extern "C++" NIFTKVTK_WINEXPORT void DistanceToSurface (vtkPolyData * source, vtkPolyData * target);
174 
181 extern "C++" NIFTKVTK_WINEXPORT void DistanceToSurface(vtkPolyData* source, vtkPolyData* target, vtkSmartPointer<vtkDoubleArray>& result);
182 
186 extern "C++" NIFTKVTK_WINEXPORT std::string WriteMatrix4x4ToString(const vtkMatrix4x4& matrix);
187 
194 extern "C++" NIFTKVTK_WINEXPORT bool SaveMatrix4x4ToFile (const std::string& fileName, const vtkMatrix4x4& matrix, const bool& silent=false);
195 
200 extern "C++" NIFTKVTK_WINEXPORT vtkSmartPointer<vtkMatrix4x4> LoadMatrix4x4FromFile(const std::string& fileName, const bool& silent=false);
201 
206 extern "C++" NIFTKVTK_WINEXPORT bool MatricesAreEqual(const vtkMatrix4x4& m1, const vtkMatrix4x4& m2, const double& tolerance=0.01);
207 
220  const int *imageSize,
221  const int *windowSize,
222  const double *origin,
223  const double *spacing,
224  const double *xAxis,
225  const double *yAxis,
226  const double *clippingRange,
227  const bool& flipYAxis,
228  vtkCamera& camera,
229  const double& distanceToFocalPoint = -1000
230  );
231 
236 extern "C++" NIFTKVTK_WINEXPORT bool CropPointsFromPolyData(vtkPolyData* PolyData, int Points = 200);
237 
242 extern "C++" NIFTKVTK_WINEXPORT void MatrixToQuaternion(const vtkMatrix4x4& matrix, double* quaternion);
243 
251 extern "C++" NIFTKVTK_WINEXPORT void InterpolateRotation(const double* beforeRotation, const double* afterRotation, const double& weight, double* outputRotation, bool adjustSign /*= true*/);
252 
257 extern "C++" NIFTKVTK_WINEXPORT void InterpolateTransformationMatrix(const vtkMatrix4x4& before, const vtkMatrix4x4& after, const double& proportion, vtkMatrix4x4& interpolated);
258 
259 } // end namespace
260 
261 #endif
void CopyDoubleVector(int n, const double *a, double *b)
Definition: niftkVTKFunctions.cxx:189
void CalculateUnitVector(const double *a, const double *b, double *output)
Definition: niftkVTKFunctions.cxx:126
double GetEuclideanDistanceBetweenTwo3DPoints(const double *a, const double *b)
Definition: niftkVTKFunctions.cxx:36
double GetBoundingBoxDiagonalLength(const double *boundingBoxVector6)
Definition: niftkVTKFunctions.cxx:177
bool SaveMatrix4x4ToFile(const std::string &fileName, const vtkMatrix4x4 &matrix, const bool &silent)
Save the matrix to a plain text file of 4 rows of 4 space separated numbers.
Definition: niftkVTKFunctions.cxx:494
double AngleBetweenTwoUnitVectors(const double *a, const double *b)
Definition: niftkVTKFunctions.cxx:137
void Normalise3DPoint(const double *a, const double length, double *output)
Definition: niftkVTKFunctions.cxx:92
void PerturbPolyData(vtkPolyData *polydata, double xerr, double yerr, double zerr, vtkRandomSequence *rng)
Perturbs the points in a polydata object by random values, using existing random number generator...
Definition: niftkVTKFunctions.cxx:283
void CrossProductTwo3DVectors(const double *a, const double *b, double *c)
Definition: niftkVTKFunctions.cxx:117
GLuint GLuint GLfloat weight
Definition: glew.h:11786
void AddTwo3DPoints(const double *a, const double *b, double *output)
Definition: niftkVTKFunctions.cxx:82
GLuint GLsizei GLsizei * length
Definition: glew.h:1809
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
GLuint GLenum GLenum transform
Definition: glew.h:12775
#define NIFTKVTK_WINEXPORT
Definition: niftkVTKWin32ExportHeader.h:28
std::string WriteMatrix4x4ToString(const vtkMatrix4x4 &matrix)
Writes matrix out as a string, for use in SaveMatrix4x4ToFile.
Definition: niftkVTKFunctions.cxx:479
GLuint64EXT * result
Definition: glew.h:12084
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:8272
double AngleBetweenTwoUnitVectorsInDegrees(const double *a, const double *b)
Definition: niftkVTKFunctions.cxx:146
void InterpolateTransformationMatrix(const vtkMatrix4x4 &before, const vtkMatrix4x4 &after, const double &proportion, vtkMatrix4x4 &interpolated)
Interpolates between two matrices.
Definition: niftkVTKFunctions.cxx:739
void RandomTransform(vtkTransform *transform, double xtrans, double ytrans, double ztrans, double xrot, double yrot, double zrot, vtkRandomSequence *rng)
Creates a randomly determined vtkTransform, using existing random number geneterator.
Definition: niftkVTKFunctions.cxx:199
bool ClipPointToWithinBoundingBox(const double *bounds, double *point)
Definition: niftkVTKFunctions.cxx:154
void MatrixToQuaternion(const vtkMatrix4x4 &matrix, double *quaternion)
Extracts the rotation matrix, and converts to quaternion.
Definition: niftkVTKFunctions.cxx:672
void SubtractTwo3DPoints(const double *a, const double *b, double *output)
Definition: niftkVTKFunctions.cxx:72
GLuint GLenum matrix
Definition: glew.h:12775
double DistanceToSurface(double point[3], vtkPolyData *target)
Returns the euclidean distance (in 3D) between a point and the closest point on a polydata mesh...
Definition: niftkVTKFunctions.cxx:413
bool CropPointsFromPolyData(vtkPolyData *PolyData, int Points)
Randomly removes points from the passed polydata until the passed number of points Any cells or surfa...
Definition: niftkVTKFunctions.cxx:651
void TranslatePolyData(vtkPolyData *polydata, vtkTransform *transform)
Translates a polydata object using a transform.
Definition: niftkVTKFunctions.cxx:227
double GetLength(const double *a)
Definition: niftkVTKFunctions.cxx:49
vtkSmartPointer< vtkMatrix4x4 > LoadMatrix4x4FromFile(const std::string &fileName, const bool &silent)
Loads the matrix from file, or else creates an Identity matrix, and the caller is responsible for dea...
Definition: niftkVTKFunctions.cxx:519
GLclampd n
Definition: glew.h:6789
bool DistancesToColorMap(vtkPolyData *source, vtkPolyData *target)
Measures the euclidean distances between the points in two polydata, and sets the.
Definition: niftkVTKFunctions.cxx:350
void InterpolateRotation(const double *beforeRotation, const double *afterRotation, const double &weight, double *outputRotation, bool adjustSign)
Performs spherical linear interpolation.
Definition: niftkVTKFunctions.cxx:688
void SetCameraParallelTo2DImage(const int *imageSize, const int *windowSize, const double *origin, const double *spacing, const double *xAxis, const double *yAxis, const double *clippingRange, const bool &flipYAxis, vtkCamera &camera, const double &distanceToFocalPoint)
Used to set a vtkCamera to track a 2D image, and sets the camera to parallel projection mode...
Definition: niftkVTKFunctions.cxx:575
Definition: niftkExceptionObject.h:21
bool MatricesAreEqual(const vtkMatrix4x4 &m1, const vtkMatrix4x4 &m2, const double &tolerance)
Checks matrices for equality.
Definition: niftkVTKFunctions.cxx:554
GLsizei const GLcharARB ** string
Definition: glew.h:5194
void NormaliseToUnitLength(const double *a, double *output)
Definition: niftkVTKFunctions.cxx:109
GLsizei GLsizei GLchar * source
Definition: glew.h:1816
void ScaleVector(const double &scaleFactor, const double *a, double *b)
Definition: niftkVTKFunctions.cxx:62
GLenum target
Definition: glew.h:5584
double NormalisedRNG(vtkRandomSequence *rng)
Normalises the values returned by a vtk random sequence to be centred on zero.
Definition: niftkVTKFunctions.cxx:334
GLint GLenum GLsizei GLint GLsizei imageSize
Definition: glew.h:1363
void PerturbPolyDataAlongNormal(vtkPolyData *polydata, double stdDev, vtkRandomSequence *rng)
Definition: niftkVTKFunctions.cxx:245