PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
PlusFidLabeling.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef _FIDUCIAL_LABELLING_H
8 #define _FIDUCIAL_LABELLING_H
9 
11 #include "PlusConfigure.h"
12 class vtkXMLDataElement;
13 
20 class vtkPlusCalibrationExport PlusLabelingResults
21 {
22 public:
23  int patternId;//Id of the pattern
24  int wireId;//Id of the wire in the pattern
25  double x, y; //coordinate in the image plane
26 };
27 
28 //-----------------------------------------------------------------------------
29 
36 class vtkPlusCalibrationExport PlusFidLabeling
37 {
38 public:
40  virtual ~PlusFidLabeling();
41 
43  void UpdateParameters();
44 
46  void Clear();
47 
49  PlusStatus ReadConfiguration(vtkXMLDataElement* rootConfigElement, double minThetaRad, double maxThetaRad);
50 
52  void SetFrameSize(const FrameSizeType& frameSize);
53 
55  double ComputeDistancePointLine(PlusFidDot& dot, PlusFidLine& line);
56 
58  double ComputeShift(PlusFidLine& line1, PlusFidLine& line2);
59 
61  double ComputeSlope(PlusFidLine& line);
62 
64  void FindPattern();
65 
68  void UpdateCirsResults(const PlusFidLine& resultLine1, const PlusFidLine& resultLine2, const PlusFidLine& resultLine3);
69 
73  void UpdateNWiresResults(std::vector<PlusFidLine*>& resultLines);
74 
76  void SortRightToLeft(PlusFidLine& line);
77 
79  static bool SortCompare(const std::vector<double>& temporaryLine1, const std::vector<double>& temporaryLine2);
80 
82  PlusFidLine SortPointsByDistanceFromStartPoint(PlusFidLine& fiducials);
83 
84  //Accessors and mutators
86  std::vector<PlusFidDot>& GetDotsVector() {return m_DotsVector; };
87 
89  void SetDotsVector(std::vector<PlusFidDot>& value) { m_DotsVector = value; };
90 
92  std::vector<PlusFidLine>& GetFoundLinesVector() {return m_FoundLines; };
93 
95  void SetLinesVector(std::vector< std::vector<PlusFidLine> >& value) { m_LinesVector = value; };
96 
98  std::vector<PlusFidPattern*>& GetPatterns();
99 
101  void SetPatterns(const std::vector<PlusFidPattern*>& value) { m_Patterns = value; };
102 
104  double GetPatternIntensity() { return m_PatternIntensity; };
105 
107  void SetDotsFound(bool value) { m_DotsFound = value; };
108 
110  bool GetDotsFound() { return m_DotsFound; };
111 
113  std::vector<std::vector<double>> GetFoundDotsCoordinateValue() { return m_FoundDotsCoordinateValue; };
114 
116  std::vector<std::vector<PlusFidLine>> GetLinesVector() { return m_LinesVector; };
117 
119  void SetApproximateSpacingMmPerPixel(double value) { m_ApproximateSpacingMmPerPixel = value; };
120 
122  void SetMaxLinePairDistanceErrorPercent(double value) { m_MaxLinePairDistanceErrorPercent = value; };
123 
125  void SetMaxAngleDifferenceDegrees(double value) { m_MaxAngleDiff = value; };
126 
128  void SetMinThetaDeg(double value);
129 
131  void SetMaxThetaDeg(double value);
132 
134  void SetAngleToleranceDeg(double value);
135 
137  void SetMaxLineShiftMm(double aValue);
138 
140  double GetMaxLineShiftMm();
141 
142  void SetAngleToleranceDegrees(double angleToleranceDegrees);
143 
144  void SetInclinedLineAngleDegrees(double inclinedLineAngleDegrees);
145 
146 protected:
147  std::array<unsigned int, 3> m_FrameSize;
148 
150  double m_MaxAngleDiff; // not used
151  double m_MinLinePairDistMm; // minimum distance between any two lines
152  double m_MaxLinePairDistMm; // maximum distance between any two lines
153  double m_MinLinePairAngleRad; // minimum angle between any two lines
154  double m_MaxLinePairAngleRad; // maximum angle between any two lines
155  double m_MaxLineShiftMm; // maximum in-plane shift of the midpoint of the N fiducials
159 
161 
165 
166  std::vector<PlusFidDot> m_DotsVector;
167  std::vector<PlusFidLine> m_FoundLines;
168  std::vector<PlusFidPattern*> m_Patterns;
169  std::vector<PlusLabelingResults> m_Results;
170  std::vector< std::vector<PlusFidLine> > m_LinesVector;
171  std::vector< std::vector<double> > m_FoundDotsCoordinateValue;
172 };
173 
174 #endif // _FIDUCIAL_LABELLING_H
std::vector< PlusFidLine > m_FoundLines
void SetLinesVector(std::vector< std::vector< PlusFidLine > > &value)
const char int line
Definition: phidget22.h:2458
std::vector< std::vector< PlusFidLine > > GetLinesVector()
double GetPatternIntensity()
void SetMaxLinePairDistanceErrorPercent(double value)
igsioStatus PlusStatus
Definition: PlusCommon.h:40
double m_MaxLinePairDistMm
double m_ApproximateSpacingMmPerPixel
std::vector< std::vector< PlusFidLine > > m_LinesVector
double m_MinLinePairAngleRad
std::vector< PlusFidDot > m_DotsVector
void SetDotsVector(std::vector< PlusFidDot > &value)
std::vector< PlusLabelingResults > m_Results
std::vector< PlusFidPattern * > m_Patterns
double m_InclinedLineAngleRad
std::vector< PlusFidDot > & GetDotsVector()
void SetMaxAngleDifferenceDegrees(double value)
std::vector< std::vector< double > > GetFoundDotsCoordinateValue()
void SetDotsFound(bool value)
int x
Definition: phidget22.h:4265
const char const char * value
Definition: phidget22.h:5111
std::array< unsigned int, 3 > m_FrameSize
double m_MaxLinePairAngleRad
double m_MaxLinePairDistanceErrorPercent
std::vector< PlusFidLine > & GetFoundLinesVector()
std::vector< std::vector< double > > m_FoundDotsCoordinateValue
double m_MinLinePairDistMm
void SetPatterns(const std::vector< PlusFidPattern * > &value)
void SetApproximateSpacingMmPerPixel(double value)
double m_AngleToleranceRad