NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Classes | Namespaces | Functions
mitkOpenCVMaths.cxx File Reference
Include dependency graph for mitkOpenCVMaths.cxx:

Classes

class  mitk::out_of_bounds
 

Namespaces

 mitk
 

Functions

std::vector< cv::Point3d > mitk::SubtractPointFromPoints (const std::vector< cv::Point3d > listOfPoints, const cv::Point3d &point)
 Subtracts a point (e.g. the centroid) from a list of points. More...
 
std::vector< cv::Point3d > mitk::PointSetToVector (const mitk::PointSet::Pointer &pointSet)
 Converts mitk::PointSet to vector of cv::Point3d, but you lose the point ID contained within the mitk::PointSet. More...
 
void mitk::MakeIdentity (cv::Matx44d &outputMatrix)
 Haven't found a direct method to do this yet. More...
 
cv::Matx33d mitk::CalculateCrossCovarianceH (const std::vector< cv::Point3d > &q, const std::vector< cv::Point3d > &qPrime)
 Calculates 1/N Sum (q_i * qPrime_i^t) where q_i and qPrime_i are column vectors, so the product is a 3x3 matrix. More...
 
bool mitk::DoSVDPointBasedRegistration (const std::vector< cv::Point3d > &fixedPoints, const std::vector< cv::Point3d > &movingPoints, cv::Matx33d &H, cv::Point3d &p, cv::Point3d &pPrime, cv::Matx44d &outputMatrix, double &fiducialRegistrationError)
 Helper method to do the main SVD bit of the point based registration, and handle the degenerate conditions mentioned in Aruns paper. More...
 
double mitk::CalculateFiducialRegistrationError (const std::vector< cv::Point3d > &fixedPoints, const std::vector< cv::Point3d > &movingPoints, const cv::Matx44d &matrix)
 Calculates Fiducial Registration Error by multiplying the movingPoints by the matrix, and comparing with fixedPoints. More...
 
double mitk::CalculateFiducialRegistrationError (const mitk::PointSet::Pointer &fixedPointSet, const mitk::PointSet::Pointer &movingPointSet, vtkMatrix4x4 &vtkMatrix)
 Converts format of input to call the other CalculateFiducialRegistrationError method. More...
 
void mitk::ConstructAffineMatrix (const cv::Matx31d &translation, const cv::Matx33d &rotation, cv::Matx44d &matrix)
 Simply copies the translation vector and rotation matrix into the 4x4 matrix. More...
 
void mitk::CopyToVTK4x4Matrix (const cv::Matx44d &matrix, vtkMatrix4x4 &vtkMatrix)
 Copies matrix to vtkMatrix. More...
 
void mitk::CopyToOpenCVMatrix (const vtkMatrix4x4 &matrix, cv::Matx44d &openCVMatrix)
 Copies matrix to openCVMatrix. More...
 
void mitk::CopyToVTK4x4Matrix (const cv::Mat &input, vtkMatrix4x4 &output)
 Copies to VTK matrix, throwing exceptions if input is not 4x4. More...
 
void mitk::CopyToOpenCVMatrix (const vtkMatrix4x4 &input, cv::Mat &output)
 Copies to OpenCV matrix, throwing exceptions if output is not 4x4. More...
 
void mitk::CopyToOpenCVMatrix (const cv::Matx44d &matrix, cv::Mat &output)
 Copies to OpenCV matrix, throwing exceptions if output is not 4x4. More...
 
std::vector< mitk::WorldPointmitk::operator* (const cv::Mat &M, const std::vector< mitk::WorldPoint > &p)
 multiplies a set of points and corresponding scalar values by a 4x4 transformation matrix More...
 
std::vector< mitk::WorldPointmitk::operator* (const cv::Matx44d &M, const std::vector< mitk::WorldPoint > &p)
 multiplies a set of points and corresponding scalar values by a 4x4 transformation matrix More...
 
mitk::WorldPoint mitk::operator* (const cv::Mat &M, const mitk::WorldPoint &p)
 multiplies a point and corresponding scalar value by a 4x4 transformation matrix More...
 
mitk::WorldPoint mitk::operator* (const cv::Matx44d &M, const mitk::WorldPoint &p)
 multiplies a point and corresponding scalar value by a 4x4 transformation matrix More...
 
std::vector< cv::Point3d > mitk::operator* (const cv::Mat &M, const std::vector< cv::Point3d > &p)
 multiplies a set of points by a 4x4 transformation matrix More...
 
std::vector< cv::Point3d > mitk::operator* (const cv::Matx44d &M, const std::vector< cv::Point3d > &p)
 multiplies a set of points by a 4x4 transformation matrix More...
 
cv::Point3d mitk::operator* (const cv::Mat &M, const cv::Point3d &p)
 multiplies a point by a 4x4 transformation matrix More...
 
cv::Point3d mitk::operator* (const cv::Matx44d &M, const cv::Point3d &p)
 multiplies a point by a 4x4 transformation matrix More...
 
std::pair< cv::Point3d,
cv::Point3d > 
mitk::TransformPointPair (const cv::Matx44d &M, const std::pair< cv::Point3d, cv::Point3d > &p)
 multiplies a point pair by a 4x4 transformation matrix More...
 
bool mitk::NearlyEqual (const cv::Point2d &p1, const cv::Point2d &p2, const double &tolerance)
 Tests equality of 2 2d points. The openCV == operator struggles on floating points,. More...
 
bool mitk::NearlyEqual (const cv::Point3d &p1, const cv::Point3d &p2, const double &tolerance)
 Tests equality of 2 3d points. The openCV == operator struggles on floating points,. More...
 
bool mitk::ImageHeadersEqual (const cv::Mat &m1, const cv::Mat &m2)
 Tests whether two cv::Mat have the same header info (dimension and data type),. More...
 
bool mitk::ImageDataEqual (const cv::Mat &m1, const cv::Mat &m2, const double &tolerance)
 Tests whether two cv::Mat have the same data. More...
 
cv::Point2d mitk::operator/ (const cv::Point2d &p, const int &n)
 Divides a 2d point by an integer (x=x1/n, y=y1/2) More...
 
cv::Point2d mitk::operator* (const cv::Point2d &p1, const cv::Point2d &p2)
 Multiplies the components of a 2d point by an integer (x=x1*x2, y=y1*y2) More...
 
cv::Point2d mitk::FindIntersect (const cv::Vec4i &line1, const cv::Vec4i &line2)
 
bool mitk::PointInInterval (const cv::Point2d &point, const cv::Vec4i &interval)
 
bool mitk::CheckIfLinesArePerpendicular (cv::Vec4i line1, cv::Vec4i line2, double tolerance)
 
double mitk::AngleBetweenLines (cv::Vec4i line1, cv::Vec4i line2)
 
std::vector< cv::Point2d > mitk::FindIntersects (const std::vector< cv::Vec4i > &lines, const bool &rejectIfPointNotOnBothLines, const bool &rejectIfNotPerpendicular, const double &angleTolerance)
 
cv::Point2d mitk::GetCentroid (const std::vector< cv::Point2d > &points, bool RefineForOutliers=false, cv::Point2d *StandardDeviation=NULL)
 Calculates the centroid of a vector of points. More...
 
cv::Point3d mitk::GetCentroid (const std::vector< cv::Point3d > &points, bool RefineForOutliers=false, cv::Point3d *StandardDeviation=NULL)
 Calculates the centroid of a vector of points. More...
 
cv::Matx33d mitk::ConstructEulerRxMatrix (const double &rx)
 Generates a rotation about X-axis, given a Euler angle in radians. More...
 
cv::Matx33d mitk::ConstructEulerRyMatrix (const double &ry)
 Generates a rotation about Y-axis, given a Euler angle in radians. More...
 
cv::Matx33d mitk::ConstructEulerRzMatrix (const double &rz)
 Generates a rotation about Z-axis, given a Euler angle in radians. More...
 
cv::Matx33d mitk::ConstructEulerRotationMatrix (const double &rx, const double &ry, const double &rz)
 Generates a rotation matrix, given Euler angles in radians. More...
 
cv::Matx13d mitk::ConvertEulerToRodrigues (const double &rx, const double &ry, const double &rz)
 Converts Euler angles in radians to the Rodrigues rotation vector (axis-angle convention) mentioned in OpenCV. More...
 
cv::Matx44d mitk::ConstructRigidTransformationMatrix (const double &rx, const double &ry, const double &rz, const double &tx, const double &ty, const double &tz)
 From rotations in radians and translations in millimetres, constructs a 4x4 transformation matrix. More...
 
cv::Matx44d mitk::ConstructRodriguesTransformationMatrix (const double &r1, const double &r2, const double &r3, const double &tx, const double &ty, const double &tz)
 From Rodrigues rotation parameters and translations in millimetres, constructs a 4x4 transformation matrix. More...
 
cv::Matx44d mitk::ConstructScalingTransformation (const double &sx, const double &sy, const double &sz=1)
 Constructs a scaling matrix from sx, sy, sz where the scale factors simply appear on the diagonal. More...
 
cv::Matx44d mitk::ConstructSimilarityTransformationMatrix (const double &rx, const double &ry, const double &rz, const double &tx, const double &ty, const double &tz, const double &sx, const double &sy, const double &sz)
 Constructs an affine transformation, without skew using the specified parameters, where rotations are in degrees. More...
 
cv::Point3d mitk::FindMinimumValues (std::vector< cv::Point3d > inputValues, cv::Point3i *indexes=NULL)
 Takes a point vector and finds the minimum value in each dimension. Returns the minimum values. Optionally returns the indexes of the minium values. More...
 
std::pair< double, double > mitk::RMSError (std::vector< mitk::ProjectedPointPairsWithTimingError > measured, std::vector< mitk::ProjectedPointPairsWithTimingError > actual, int index=-1, cv::Point2d outlierSD=cv::Point2d(2.0, 2.0), long long allowableTimingError=30e6, bool duplicateLines=true)
 Returns the RMS error between two projected point vectors. More...
 
mitk::ProjectedPointPair mitk::MeanError (std::vector< mitk::ProjectedPointPairsWithTimingError > measured, std::vector< mitk::ProjectedPointPairsWithTimingError > actual, mitk::ProjectedPointPair *StandardDeviations=NULL, int index=-1, long long allowableTimingError=30e6, bool duplicateLines=true)
 Returns the mean pixel errors for the right and left sets of projected points. More...
 
cv::Mat mitk::PerturbTransform (const cv::Mat transformIn, const double tx, const double ty, const double tz, const double rx, const double ry, const double rz)
 perturbs a 4x4 matrix with a 6 dof rigid transform. The transform is defined by three translations and 3 rotations, in Degrees More...
 
cv::Point2d mitk::FindNearestPoint (const cv::Point2d &point, const std::vector< cv::Point2d > &matchingPonints, double *minRatio=NULL, unsigned int *index=NULL)
 Searches through vector of 2D points to find the one closest (by distance) to the passed point, and returns the index of that point. More...
 
mitk::PickedObject mitk::FindNearestPickedObject (const mitk::PickedObject &point, const std::vector< mitk::PickedObject > &matchingPoints, double *minRatio=NULL)
 Searches through vector of 3D points and lines to find the one closest (by distance) to the passed point. Returns an empty PickedPoint if no point found. More...
 
bool mitk::DistanceCompare (const cv::Point2d &p1, const cv::Point2d &p2)
 Compare two cv point based on their distance from 0,0. More...
 
cv::Mat mitk::Tracker2ToTracker1Rotation (const std::vector< cv::Mat > &Tracker1ToWorld1, const std::vector< cv::Mat > &World2ToTracker2, double &Residual)
 works out the rigid rotation correspondence between two sets of corresponding rigid body transforms More...
 
cv::Mat mitk::Tracker2ToTracker1Translation (const std::vector< cv::Mat > &Tracker1ToWorld1, const std::vector< cv::Mat > &World2ToTracker2, double &Residual, const cv::Mat &rcg)
 works out the rigid translation correspondence between two sets of corresponding rigid body transforms More...
 
cv::Mat mitk::Tracker2ToTracker1RotationAndTranslation (const std::vector< cv::Mat > &Tracker1ToWorld1, const std::vector< cv::Mat > &World2ToTracker2, std::vector< double > &Residuals, cv::Mat *World2ToWorld1=NULL)
 works out the rigid rotation and translation correspondence between two sets of corresponding rigid body transforms More...
 
cv::Mat mitk::AverageMatrices (const std::vector< cv::Mat > &matrices)
 find the average of a vector of 4x4 matrices More...
 
std::vector< cv::Mat > mitk::FlipMatrices (const std::vector< cv::Mat > matrices)
 Flips the matrices in the vector from left handed coordinate system to right handed and vice versa. More...
 
std::vector< intmitk::SortMatricesByDistance (const std::vector< cv::Mat > matrices)
 Sorts the matrices based on the translations , and returns the order. More...
 
std::vector< intmitk::SortMatricesByAngle (const std::vector< cv::Mat > matrices)
 Sorts the matrices based on the rotations, and returns the order. More...
 
double mitk::AngleBetweenMatrices (cv::Mat Mat1, cv::Mat Mat2)
 Returns the angular distance between two rotation matrices. More...
 
double mitk::DistanceBetweenMatrices (cv::Mat Mat1, cv::Mat Mat2)
 Returns the distance between two 4x4 matrices. More...
 
cv::Mat mitk::DirectionCosineToQuaternion (cv::Mat dc_Matrix)
 Converts a 3x3 rotation matrix to a quaternion. More...
 
void mitk::InvertRigid4x4Matrix (const CvMat &input, CvMat &output)
 Specific method that inverts a matrix without SVD or decomposition, because the input is known to be orthonormal. More...
 
void mitk::InvertRigid4x4Matrix (const cv::Mat &input, cv::Mat &output)
 Overloaded invert method that calls the C-looking one. More...
 
void mitk::InvertRigid4x4Matrix (const cv::Matx44d &input, cv::Matx44d &output)
 Overloaded invert method that calls the C-looking one. More...
 
void mitk::InterpolateTransformationMatrix (const cv::Mat &before, const cv::Mat &after, const double &proportion, cv::Mat &output)
 Interpolates between two matrices. More...
 
void mitk::InterpolateTransformationMatrix (const cv::Matx44d &before, const cv::Matx44d &after, const double &proportion, cv::Matx44d &output)
 
std::string mitk::MatrixType (const cv::Mat &matrix)
 returns the matrix type as a string More...
 
bool mitk::IsNaN (const cv::Point2d &)
 check if point has a NaN value More...
 
bool mitk::IsNaN (const cv::Point3d &)
 check if point has a NaN value More...
 
bool mitk::IsNotNaNorInf (const cv::Point2d &)
 check if 2D point has a NaN or inf value More...
 
bool mitk::IsNotNaNorInf (const cv::Point3d &)
 check if 3D point has a NaN or inf value More...
 
double mitk::DistanceToLine (const std::pair< cv::Point3d, cv::Point3d > &line, const cv::Point3d &point)
 calculates the distance between a line and a point More...
 
double mitk::DistanceBetweenTwoPoints (const cv::Point3d &p1, const cv::Point3d &p2, cv::Point3d *delta=NULL)
 calculates the distance between two points More...
 
double mitk::DistanceBetweenTwoSplines (const std::vector< cv::Point3d > &s0, const std::vector< cv::Point3d > &s1, unsigned int splineOrder, cv::Point3d *delta=NULL)
 calculates the average shortest distance between two splines. More...
 
double mitk::DistanceToLineSegment (const std::pair< cv::Point3d, cv::Point3d > &line, const cv::Point3d &point, cv::Point3d *delta=NULL)
 calculates the distance between a line segment and a point More...
 
double mitk::DistanceBetweenLines (const cv::Point3d &P0, const cv::Point3d &u, const cv::Point3d &Q0, const cv::Point3d &v, cv::Point3d &midpoint)
 calculates the shortest distance between two lines More...
 
double mitk::DistanceBetweenLineAndSegment (const cv::Point3d &P0, const cv::Point3d &u, const cv::Point3d &x0, const cv::Point3d &x1, cv::Point3d &closestPointOnSecondLine)
 calculates the shortest distance between a line and a segment the point must lie on the segment More...
 
std::pair< cv::Point3d,
cv::Point3d > 
mitk::TwoPointsToPLambda (const std::pair< cv::Point3d, cv::Point3d > &twoPointLine)
 converts a line defined by two points on the line to the same line defined by a single point and it's unit vector More...
 
cv::Point3d mitk::CrossProduct (const cv::Point3d &p1, const cv::Point3d &p2)
 Calculates the cross product of two vectors (cv::Point3D) More...
 
double mitk::DotProduct (const cv::Point3d &p1, const cv::Point3d &p2)
 Calculates the dot product of two vectors (cv::Point3D) More...
 
double mitk::Norm (const cv::Point3d &p1)
 Calculates the norm product of a vectors (cv::Point3D) More...
 
unsigned int mitk::RemoveOutliers (std::vector< cv::Point3d > &points, const double &xLow, const double &xHigh, const double &yLow, const double &yHigh, const double &zLow, const double &zHigh)
 Removes points outside the passed limits. More...
 
unsigned int mitk::RemoveOutliers (std::vector< std::pair< cv::Point3d, double > > &points, const double &xLow, const double &xHigh, const double &yLow, const double &yHigh, const double &zLow, const double &zHigh)
 Removes points outside the passed limits. More...
 
void mitk::ExtractRigidBodyParameters (const vtkMatrix4x4 &matrix, mitk::Point3D &outputRodriguesRotationParameters, mitk::Point3D &outputTranslationParameters)
 Decomposes a rigid body matrix into Rodrigues Rotations and Translations. More...