Fraxinus  18.10
An IGT application
cxTemporalCalibration.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CXTEMPORALCALIBRATION_H_
12 #define CXTEMPORALCALIBRATION_H_
13 
14 #include "org_custusx_calibration_Export.h"
15 
16 #include <sstream>
17 #include "cxVideoRecorder.h"
18 #include "cxTool.h"
20 #include "cxForwardDeclarations.h"
21 
22 namespace cx
23 {
30 typedef std::map<double,double> TimeSeriesType;
31 
43 class org_custusx_calibration_EXPORT TemporalCalibration
44 {
45 public:
47  void selectData(QString filename);
48  void setDebugFolder(QString path);
49  double calibrate(bool* success);
50 
51 private:
52  vtkImageDataPtr extractLine_y(USFrameDataPtr data, int line_index_x, int frame);
53  double findCorrelation(USFrameDataPtr data, int frame_a, int frame_b, double maxShift, double lastVal);
54  std::vector<double> computeProbeMovement();
55  std::vector<double> resample(std::vector<double> shift, std::vector<TimedPosition> time, double resolution);
56  std::vector<double> computeTrackingMovement();
57  double findCorrelationShift(std::vector<double> frames, std::vector<double> tracking, double resolution) const;
58  double findLeastSquares(std::vector<double> frames, std::vector<double> tracking, int shift) const;
59  double findLSShift(std::vector<double> frames, std::vector<double> tracking, double resolution) const;
60  bool checkFrameMovementQuality(std::vector<double> pos);
61  void writePositions(QString title, std::vector<double> pos, std::vector<TimedPosition> time, double shift);
62 
63  void saveDebugFile();
64 
65  USReconstructInputData mFileData;
66  std::vector<vtkImageDataPtr> mProcessedFrames;
67  QString mDebugFolder;
68  QString mFilename;
69  mutable std::stringstream mDebugStream;
70  bool mAddRawToDebug;
71  vtkImageDataPtr mMask;
72 
73 };
74 
75 
76 typedef boost::shared_ptr<TemporalCalibration> TemporalCalibrationPtr;
77 
81 }
82 
83 #endif /* CXTEMPORALCALIBRATION_H_ */
boost::shared_ptr< class USFrameData > USFrameDataPtr
boost::shared_ptr< TemporalCalibration > TemporalCalibrationPtr
std::map< double, double > TimeSeriesType
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.