Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkPoint.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 mitkPoint_h
14 #define mitkPoint_h
15 
16 #include <itkPoint.h>
17 
18 #include "mitkArray.h"
19 #include "mitkEqual.h"
20 #include "mitkNumericConstants.h"
21 
22 namespace mitk
23 {
24  //##Documentation
25  //##@brief enumeration of the type a point can be
27  {
33  };
34 
35  template <class TCoordRep, unsigned int NPointDimension = 3>
36  class Point : public itk::Point<TCoordRep, NPointDimension>
37  {
38  public:
40  explicit Point<TCoordRep, NPointDimension>() : itk::Point<TCoordRep, NPointDimension>() {}
42  template <typename TPointValueType>
43  explicit Point(const Point<TPointValueType, NPointDimension> &r) : itk::Point<TCoordRep, NPointDimension>(r)
44  {
45  }
46 
47  template <typename TPointValueType>
48  explicit Point(const TPointValueType r[NPointDimension]) : itk::Point<TCoordRep, NPointDimension>(r)
49  {
50  }
51 
52  template <typename TPointValueType>
53  explicit Point(const TPointValueType &v) : itk::Point<TCoordRep, NPointDimension>(v)
54  {
55  }
56 
58  : itk::Point<TCoordRep, NPointDimension>(r)
59  {
60  }
61  Point<TCoordRep, NPointDimension>(const TCoordRep r[NPointDimension]) : itk::Point<TCoordRep, NPointDimension>(r) {}
62  Point<TCoordRep, NPointDimension>(const TCoordRep &v) : itk::Point<TCoordRep, NPointDimension>(v) {}
63  Point<TCoordRep, NPointDimension>(const itk::Point<TCoordRep, NPointDimension> &p)
64  : itk::Point<TCoordRep, NPointDimension>(p)
65  {
66  }
67 
74  template <typename ArrayType>
75  void FillPoint(const ArrayType &array)
76  {
77  itk::FixedArray<TCoordRep, NPointDimension> *thisP =
78  dynamic_cast<itk::FixedArray<TCoordRep, NPointDimension> *>(this);
79  mitk::FillArray<ArrayType, TCoordRep, NPointDimension>(*thisP, array);
80  }
81 
87  template <typename ArrayType>
88  void ToArray(ArrayType array) const
89  {
90  mitk::ToArray<ArrayType, TCoordRep, NPointDimension>(array, *this);
91  }
92  };
93 
97 
101 
111  template <typename TCoordRep, unsigned int NPointDimension>
112  inline bool Equal(const itk::Point<TCoordRep, NPointDimension> &point1,
113  const itk::Point<TCoordRep, NPointDimension> &point2,
114  TCoordRep eps = mitk::eps,
115  bool verbose = false)
116  {
117  bool isEqual = true;
118  typename itk::Point<TCoordRep, NPointDimension>::VectorType diff = point1 - point2;
119  for (unsigned int i = 0; i < NPointDimension; i++)
120  {
121  if (DifferenceBiggerOrEqualEps(diff[i], eps))
122  {
123  isEqual = false;
124  break;
125  }
126  }
127 
128  ConditionalOutputOfDifference(point1, point2, eps, verbose, isEqual);
129 
130  return isEqual;
131  }
132 
133 } // namespace mitk
134 
135 #endif
mitk::PTEDGE
@ PTEDGE
Definition: mitkPoint.h:31
mitk::eps
const MITKCORE_EXPORT ScalarType eps
mitk::Point4I
Point< int, 4 > Point4I
Definition: mitkPoint.h:100
mitk::Point::FillPoint
void FillPoint(const ArrayType &array)
Definition: mitkPoint.h:75
mitk::Point::Point
Point(const Point< TPointValueType, NPointDimension > &r)
Definition: mitkPoint.h:43
mitk::PTUNDEFINED
@ PTUNDEFINED
Definition: mitkPoint.h:28
mitk::Equal
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
mitk::Point::Point
Point(const TPointValueType r[NPointDimension])
Definition: mitkPoint.h:48
mitk::Point4D
Point< ScalarType, 4 > Point4D
Definition: mitkPoint.h:96
mitk::Point2I
Point< int, 2 > Point2I
Definition: mitkPoint.h:98
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitkArray.h
mitk::Point::ToArray
void ToArray(ArrayType array) const
Definition: mitkPoint.h:88
mitk::Point
Definition: mitkPoint.h:36
mitk::Point::Point
Point(const TPointValueType &v)
Definition: mitkPoint.h:53
mitk::Point2D
Point< ScalarType, 2 > Point2D
Definition: mitkPoint.h:94
mitk::Point3D
Point< ScalarType, 3 > Point3D
Definition: mitkPoint.h:95
mitkNumericConstants.h
mitk::PTEND
@ PTEND
Definition: mitkPoint.h:32
mitkEqual.h
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
mitk::DifferenceBiggerOrEqualEps
bool DifferenceBiggerOrEqualEps(DifferenceType diff, mitk::ScalarType epsilon=mitk::eps)
Definition: mitkEqual.h:32
mitk::PointSpecificationType
PointSpecificationType
enumeration of the type a point can be
Definition: mitkPoint.h:26
mitk::ConditionalOutputOfDifference
void ConditionalOutputOfDifference(ElementToOutput1 elem1, ElementToOutput2 elem2, mitk::ScalarType eps, bool verbose, bool isEqual)
Definition: mitkEqual.h:48
mitk::Point3I
Point< int, 3 > Point3I
Definition: mitkPoint.h:99
mitk::PTCORNER
@ PTCORNER
Definition: mitkPoint.h:30
mitk::PTSTART
@ PTSTART
Definition: mitkPoint.h:29