Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 #ifndef mitkPlaneFit_h
14 #define mitkPlaneFit_h
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 describe a plane geometry.*/
135  std::vector<mitk::Vector3D> m_PlaneVectors;
136  };
137 } // namespace mitk
138 #endif
mitk::PointSet::PointDataType
struct for data of a point
Definition: mitkPointSet.h:89
itk::SmartPointer< Self >
MitkAlgorithmsExtExports.h
mitkTimeGeometry.h
MITKALGORITHMSEXT_EXPORT
#define MITKALGORITHMSEXT_EXPORT
Definition: MitkAlgorithmsExtExports.h:15
mitk::GeometryDataSource
Superclass of all classes generating GeometryData (instances of class GeometryData) as output.
Definition: mitkGeometryDataSource.h:34
mitkPointSet.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::BaseDataSource
Superclass of all classes generating some kind of mitk::BaseData.
Definition: mitkBaseDataSource.h:71
mitk::PlaneFit::PointDataType
mitk::PointSet::PointDataType PointDataType
Definition: mitkPlaneFit.h:64
mitk::Vector< ScalarType, 3 >
mitk::Point< ScalarType, 3 >
mitk::PointSet::PointDataIterator
DataType::PointDataContainerIterator PointDataIterator
Definition: mitkPointSet.h:134
mitk::PlaneFit::PointDataIterator
mitk::PointSet::PointDataIterator PointDataIterator
Definition: mitkPlaneFit.h:67
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::PointSet
Data structure which stores a set of points.
Definition: mitkPointSet.h:71
mitk::PlaneFit
Definition: mitkPlaneFit.h:60
mitkGeometryDataSource.h
mitkPlaneGeometry.h