NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
mitkTriangulate2DPointPairsTo3D.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 mitkTriangulate2DPointPairsTo3D_h
16 #define mitkTriangulate2DPointPairsTo3D_h
17 
18 #include "niftkOpenCVExports.h"
19 #include <string>
20 #include <itkObject.h>
21 #include <itkObjectFactory.h>
22 #include <mitkCommon.h>
23 #include <cv.h>
24 
25 namespace mitk {
26 
36 {
37 
38 public:
39 
40  mitkClassMacroItkParent(Triangulate2DPointPairsTo3D, itk::Object)
41  itkNewMacro(Triangulate2DPointPairsTo3D)
42 
43  itkSetMacro (Input2DPointPairsFileName, std::string);
44  itkSetMacro (IntrinsicLeftFileName, std::string);
45  itkSetMacro (IntrinsicRightFileName, std::string);
46  itkSetMacro (RightToLeftExtrinsics, std::string);
47  itkSetMacro (OutputFileName, std::string);
48  itkSetMacro (LeftMaskFileName, std::string);
49  itkSetMacro (RightMaskFileName, std::string);
50  itkSetMacro (OutputMaskImagePrefix, std::string);
51  itkSetMacro (UndistortBeforeTriangulation, bool);
52  itkSetMacro (TrackingMatrixFileName, std::string);
53  itkSetMacro (HandeyeMatrixFileName, std::string);
54  itkSetMacro (MinimumDistanceFromLens, double);
55  itkSetMacro (MaximumDistanceFromLens, double);
56 
57  bool Triangulate();
58 
59 protected:
60 
62  virtual ~Triangulate2DPointPairsTo3D();
63 
64  Triangulate2DPointPairsTo3D(const Triangulate2DPointPairsTo3D&); // Purposefully not implemented.
65  Triangulate2DPointPairsTo3D& operator=(const Triangulate2DPointPairsTo3D&); // Purposefully not implemented.
66 
67 private:
68 
69  std::string m_LeftMaskFileName; // the left mask image
70  std::string m_RightMaskFileName; // the right mask image
71  std::string m_LeftLensToWorldFileName; // the transform to put the triangulated points in world coordinates
72 
73  std::string m_Input2DPointPairsFileName; //the input file name
74  std::string m_IntrinsicLeftFileName; // the left camera intrinsic parameters
75  std::string m_IntrinsicRightFileName; // the right camera intrinsic parameters
76  std::string m_RightToLeftExtrinsics; // the right to left camera transformation
77  std::string m_OutputFileName; // the output file name
78  std::string m_OutputMaskImagePrefix; // optional prefix to write out masking images
79  std::string m_TrackingMatrixFileName; // the optional tracking matrix name
80  std::string m_HandeyeMatrixFileName; // the optional handeye (leftLensToTracker) matrix file name
81 
82  bool m_UndistortBeforeTriangulation; //optionally undistort point pairs before triangulation
83  std::vector< std::pair<cv::Point2d, cv::Point2d> > m_PointPairs;
84  std::vector< std::pair < cv::Point3d, double > > m_PointsIn3D;
85 
86  unsigned int m_BlankValue; // the value used by the mask for blanking
87  void ApplyMasks ();
88  void CullOnDistance ();
89  void WritePointsAsImage (const std::string& prefix, const cv::Mat& templateMat );
90 
91  double m_MinimumDistanceFromLens; //reconstructed points closer to the lens than this will be removed
92  double m_MaximumDistanceFromLens; //reconstructed points further from the lens than this will be removed
93 
94 
95 }; // end class
96 
97 } // end namespace
98 
99 #endif
Definition: ReceptorMemberCommandTest.cxx:25
#define NIFTKOPENCV_EXPORT
Definition: niftkSequentialCpuQds.h:27
Takes an input file containing 4 numbers on each line corresponding to the x and y image coordinates ...
Definition: mitkTriangulate2DPointPairsTo3D.h:35
std::vector< mitk::WorldPoint > Triangulate(const std::vector< mitk::ProjectedPointPair > &onScreenPointPairs, const cv::Mat &leftIntrinsicMatrix, const cv::Mat &leftDistortionVector, const cv::Mat &rightIntrinsicMatrix, const cv::Mat &rightDistortionVector, const cv::Mat &rightToLeftRotationMatrix, const cv::Mat &rightToLeftTranslationVector, const bool &cropPointsToScreen, const double &xLow, const double &xHigh, const double &yLow, const double &yHigh, const double &cropValue)
Wrapper to triangulate vector of mitk::ProjectedPointPair to vector of mitk::WorldPoint.
Definition: mitkCameraCalibrationFacade.cxx:1933
GLsizei const GLcharARB ** string
Definition: glew.h:5194