NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
mitkHandeyeCalibrateFromDirectory.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 mitkHandeyeCalibrateFromDirectory_h
16 #define mitkHandeyeCalibrateFromDirectory_h
17 
18 #include "niftkOpenCVExports.h"
19 #include "mitkHandeyeCalibrate.h"
20 #include <string>
21 #include <itkObject.h>
22 #include <itkObjectFactory.h>
23 #include <mitkCommon.h>
24 #include <mitkPoint.h>
25 #include <mitkVector.h>
26 #include <vtkMatrix4x4.h>
27 #include <cv.h>
28 
30 
31 namespace mitk {
32 
40 {
41 
42 public:
43 
44  mitkClassMacroItkParent(HandeyeCalibrateFromDirectory, itk::Object)
46 
47  void InitialiseOutputDirectory();
48  void InitialiseVideo ();
49  void InitialiseTracking();
50 
51  itkSetMacro(FramesToUse, unsigned int);
52  itkSetMacro(FramesToUseFactor, unsigned int);
53  itkSetMacro(StickToFramesToUse, bool);
54  itkSetMacro(TrackerIndex,int);
55  itkSetMacro(AbsTrackerTimingError,long long);
56 
57  itkGetMacro(VideoInitialised, bool);
58  itkGetMacro(TrackingDataInitialised, bool);
59 
60  itkSetMacro(PixelScaleFactor, mitk::Point2D);
61  itkSetMacro(WriteOutChessboards,bool);
62  itkSetMacro(WriteOutCalibrationImages,bool);
63  itkSetMacro(NoVideoSupport,bool);
64  itkSetMacro(SwapVideoChannels, bool);
65  itkSetMacro(Randomise, bool);
66 
67  bool LoadExistingIntrinsicCalibrations (std::string directory);
68  bool LoadExistingRightToLeft(const std::string& directory);
69  void SetInputDirectory(const std::string& inputDir);
70  virtual void SetOutputDirectory(const std::string& outputDir) override;
71  void SetChessBoardToTracker(vtkMatrix4x4* matrix);
72 
73 protected:
74 
77 
78  HandeyeCalibrateFromDirectory(const HandeyeCalibrateFromDirectory&); // Purposefully not implemented.
79  HandeyeCalibrateFromDirectory& operator=(const HandeyeCalibrateFromDirectory&); // Purposefully not implemented.
80 
81 private:
82  unsigned int m_FramesToUse; //target frames to use actual number used will depend on number of good frames
83  unsigned int m_FramesToUseFactor;
84  bool m_StickToFramesToUse;
85  bool m_SaveProcessedVideoData;
86 
87  bool m_VideoInitialised;
88  bool m_TrackingDataInitialised;
89 
90  int m_TrackerIndex;
91  long long m_AbsTrackerTimingError;
92 
93  mitk::Point2D m_PixelScaleFactor;
94  std::string m_InputDirectory;
95  bool m_WriteOutChessboards;
96  bool m_WriteOutCalibrationImages;
97  mitk::VideoTrackerMatching::Pointer m_Matcher;
98 
99  // Not possible to store the frames in memory, will need to process them on the fly
100  // First init videotrackermatching
101  // use this to get the number of frames (stored in the framemap.log
102  // Process frames, either sequencially of more likely by random selection
103  std::vector <cv::Mat> m_LeftCameraVideoFrames;
104  std::vector <cv::Mat> m_RightCameraVideoFrames;
105 
106  void LoadVideoData(std::string filename);
107 
112  std::string CheckForExistingData();
113 
114  bool m_NoVideoSupport; //for testing, enable running
115 
116  bool m_SwapVideoChannels;
117 
118  CvMat* m_IntrinsicMatrixLeft;
119  CvMat* m_IntrinsicMatrixRight;
120  CvMat* m_DistortionCoefficientsLeft;
121  CvMat* m_DistortionCoefficientsRight;
122  CvMat* m_RotationMatrixRightToLeft;
123  CvMat* m_RotationVectorRightToLeft;
124  CvMat* m_TranslationVectorRightToLeft;
125  bool m_OptimiseIntrinsics;
126  bool m_OptimiseRightToLeft;
127  bool m_Randomise;
128  vtkMatrix4x4* m_ChessBoardToTracker;
129 
130 }; // end class
131 
132 } // end namespace
133 
134 #endif
Definition: ReceptorMemberCommandTest.cxx:25
Definition: mitkHandeyeCalibrateFromDirectory.h:39
#define NIFTKOPENCV_EXPORT
Definition: niftkSequentialCpuQds.h:27
GLuint GLenum matrix
Definition: glew.h:12775
Definition: mitkHandeyeCalibrate.h:32
GLsizei const GLcharARB ** string
Definition: glew.h:5194