Medical Imaging Interaction Toolkit  2018.4.99-c4b6bb11
Medical Imaging Interaction Toolkit
mitkPlaneFit.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #if !defined(MITK_PLANEFIT_H__INCLUDED_)
14 #define MITK_PLANEFIT_H__INCLUDED_
15 
17 #include "mitkGeometryDataSource.h"
18 #include "mitkPlaneGeometry.h"
19 #include "mitkPointSet.h"
20 #include "mitkTimeGeometry.h"
21 
22 namespace mitk
23 {
25  // kind regards to dr. math!
26  // function [x0, a, d, normd] = lsplane(X)
27  // ---------------------------------------------------------------------
28  // LSPLANE.M Least-squares plane (orthogonal distance
29  // regression).
30  //
31  // Version 1.0
32  // Last amended I M Smith 27 May 2002.
33  // Created I M Smith 08 Mar 2002
34  // ---------------------------------------------------------------------
35  // Input
36  // X Array [x y z] where x = vector of x-coordinates,
37  // y = vector of y-coordinates and z = vector of
38  // z-coordinates.
39  // Dimension: m x 3.
40  //
41  // Output
42  // x0 Centroid of the data = point on the best-fit plane.
43  // Dimension: 3 x 1.
44  //
45  // a Direction cosines of the normal to the best-fit
46  // plane.
47  // Dimension: 3 x 1.
48  //
49  // <Optional...
50  // d Residuals.
51  // Dimension: m x 1.
52  //
53  // normd Norm of residual errors.
54  // Dimension: 1 x 1.
55  // ...>
56  //
57  // [x0, a <, d, normd >] = lsplane(X)
58  // ---------------------------------------------------------------------
59 
61  {
62  public:
64  itkNewMacro(Self);
65 
68 
69  void GenerateOutputInformation() override;
70 
71  void GenerateData() override;
72 
76  const mitk::PointSet *GetInput();
77 
81  using mitk::GeometryDataSource::SetInput;
82  virtual void SetInput(const mitk::PointSet *ps);
83 
87  virtual const mitk::Point3D &GetCentroid(int t = 0) const;
88 
92  virtual mitk::PlaneGeometry::Pointer GetPlaneGeometry(int t = 0);
93 
97  virtual const mitk::Vector3D &GetPlaneNormal(int t = 0) const;
98 
99  protected:
100  PlaneFit();
101  ~PlaneFit() override;
102 
106  void CalculateCentroid(int t = 0);
107 
115  void ProcessPointSet(int t = 0);
116 
120  void InitializePlane(int t = 0);
121 
122  private:
124  const mitk::PointSet *m_PointSet;
125 
126  /* output object - a time sliced geometry.*/
127  mitk::TimeGeometry::Pointer m_TimeGeometry;
128 
129  std::vector<mitk::PlaneGeometry::Pointer> m_Planes;
130 
132  std::vector<mitk::Point3D> m_Centroids;
133 
134  /* the normal vector to descrie a plane gemoetry.*/
135  std::vector<mitk::Vector3D> m_PlaneVectors;
136  };
137 } // namespace mitk
138 #endif // MITK_PLANFIT_INCLUDE_
Superclass of all classes generating GeometryData (instances of class GeometryData) as output...
mitk::PointSet::PointDataType PointDataType
Definition: mitkPlaneFit.h:64
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
struct for data of a point
Definition: mitkPointSet.h:93
mitk::PointSet::PointDataIterator PointDataIterator
Definition: mitkPlaneFit.h:67
#define MITKALGORITHMSEXT_EXPORT
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:75
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
DataType::PointDataContainerIterator PointDataIterator
Definition: mitkPointSet.h:138