PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusLineSegmentationAlgo.h
Go to the documentation of this file.
1 
7 #ifndef __vtkPlusLineSegmentationAlgo_h
8 #define __vtkPlusLineSegmentationAlgo_h
9 
10 #include "itkImage.h"
11 #include "vtkPlusCalibrationExport.h"
12 #include "vtkObject.h"
13 #include <deque>
14 
15 //class igsioTrackedFrame;
16 //class vtkIGSIOTrackedFrameList;
17 
23 class vtkPlusCalibrationExport vtkPlusLineSegmentationAlgo : public vtkObject
24 {
25 public:
27  {
29  double lineOriginPoint_Image[2];
30  double lineDirectionVector_Image[2];
31 
32  double Slope() const { return lineDirectionVector_Image[1] / lineDirectionVector_Image[0]; }
33  };
34 
35  typedef unsigned char CharPixelType;
36  typedef itk::Image<CharPixelType, 2> CharImageType;
37 
38  static vtkPlusLineSegmentationAlgo* New();
39  vtkTypeMacro(vtkPlusLineSegmentationAlgo, vtkObject);
40  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
41 
46  PlusStatus ReadConfiguration(vtkXMLDataElement* aConfig);
47 
49  void SetTrackedFrameList(vtkIGSIOTrackedFrameList& aTrackedFrameList);
50  void SetTrackedFrame(igsioTrackedFrame& aTrackedFrame);
51 
53  void SetSignalTimeRange(double rangeMin, double rangeMax);
54 
56  void SetClipRectangle(int clipRectangleOriginPix[2], int clipRectangleSizePix[2]);
57 
62  PlusStatus Update();
63 
65  void GetDetectedTimestamps(std::deque<double>& timestamps);
66 
68  void GetDetectedPositions(std::deque<double>& positions);
69 
71  void GetDetectedLineParameters(std::vector<LineParameters>& parameters);
72 
74  void SetSaveIntermediateImages(bool saveIntermediateImages);
75 
76  void SetIntermediateFilesOutputDirectory(const std::string& outputDirectory);
77 
78  PlusStatus Reset();
79 
81  vtkGetMacro(PlotIntensityProfile, bool);
82  vtkSetMacro(PlotIntensityProfile, bool);
83 
84 protected:
86  virtual ~vtkPlusLineSegmentationAlgo();
87 
88  PlusStatus VerifyVideoInput();
89 
90  PlusStatus ComputeVideoPositionMetric();
91 
92  PlusStatus FindPeakStart(std::deque<int>& intensityProfile, int maxFromLargestArea, int startOfMaxArea, double& startOfPeak);
93 
94  PlusStatus FindLargestPeak(std::deque<int>& intensityProfile, int& maxFromLargestArea, int& maxFromLargestAreaIndex, int& startOfMaxArea);
95 
96  PlusStatus ComputeCenterOfGravity(std::deque<int>& intensityProfile, int startOfMaxArea, double& centerOfGravity);
97 
98  void ComputeLineParameters(std::vector<itk::Point<double, 2> >& data, LineParameters& outputParameters);
99 
100  void PlotIntArray(const std::deque<int>& intensityValues);
101 
102  void PlotDoubleArray(const std::deque<double>& intensityValues);
103 
104  void SaveIntermediateImage(int frameNumber, CharImageType::Pointer scanlineImage, double x_0, double y_0, double r_x, double r_y, int numOfValidScanlines, const std::vector<itk::Point<double, 2> >& intensityPeakPositions);
105 
107  void LimitToClipRegion(CharImageType::RegionType& region);
108 
109 protected:
110  vtkSmartPointer<vtkIGSIOTrackedFrameList> m_TrackedFrameList;
111 
112  std::deque<double> m_SignalValues;
113  std::deque<double> m_SignalTimestamps;
114  std::vector<LineParameters> m_LineParameters;
115 
118 
121 
124 
127 
129  CharImageType::IndexValueType m_ClipRectangleOrigin[2];
130 
132  CharImageType::SizeValueType m_ClipRectangleSize[2];
133 
134 private:
136  void operator=(const vtkPlusLineSegmentationAlgo&);
137 };
138 
139 #endif // __vtkPlusLineSegmentationAlgo_h
const uint32_t * data
Definition: phidget22.h:3971
itk::Image< CharPixelType, 2 > CharImageType
igsioStatus PlusStatus
Definition: PlusCommon.h:40
std::vector< LineParameters > m_LineParameters
#define VTK_OVERRIDE
Definition: PlusCommon.h:49
vtkSmartPointer< vtkIGSIOTrackedFrameList > m_TrackedFrameList
Detect the position of a line (image of a plane) in an US image sequence.