22 #include <nlohmann/json.hpp>
47 template <
class TCoordRep,
unsigned int NPo
intDimension = 3>
48 class Point :
public itk::Point<TCoordRep, NPointDimension>
54 template <
typename TPo
intValueType>
59 template <
typename TPo
intValueType>
60 explicit Point(
const TPointValueType r[NPointDimension]) :
itk::
Point<TCoordRep, NPointDimension>(r)
64 template <
typename TPo
intValueType>
65 explicit Point(
const TPointValueType &v) :
itk::
Point<TCoordRep, NPointDimension>(v)
70 :
itk::
Point<TCoordRep, NPointDimension>(r)
74 Point(
const TCoordRep r[NPointDimension]) :
itk::
Point<TCoordRep, NPointDimension>(r) {}
75 Point(
const TCoordRep &v) :
itk::
Point<TCoordRep, NPointDimension>(v) {}
76 Point(
const itk::Point<TCoordRep, NPointDimension> &p)
77 :
itk::
Point<TCoordRep, NPointDimension>(p)
81 template <
typename... Args,
82 typename = std::enable_if_t<(
sizeof...(Args) == NPointDimension)>>
86 ((this->GetDataPointer()[i++] =
static_cast<TCoordRep
>(args)), ...);
96 template <
typename ArrayType>
99 itk::FixedArray<TCoordRep, NPointDimension> *thisP =
100 dynamic_cast<itk::FixedArray<TCoordRep, NPointDimension> *
>(
this);
101 mitk::FillArray<ArrayType, TCoordRep, NPointDimension>(*thisP, array);
109 template <
typename ArrayType>
112 mitk::ToArray<ArrayType, TCoordRep, NPointDimension>(array, *
this);
117 template <
class TCoordRep,
unsigned int NPo
intDimension>
120 j = nlohmann::json::array();
122 for (
size_t i = 0; i < NPointDimension; ++i)
127 template <
class TCoordRep,
unsigned int NPo
intDimension>
130 for (
size_t i = 0; i < NPointDimension; ++i)
131 j.at(i).get_to(p[i]);
152 template <
typename TCoordRep,
unsigned int NPo
intDimension>
153 inline bool Equal(
const itk::Point<TCoordRep, NPointDimension> &point1,
154 const itk::Point<TCoordRep, NPointDimension> &point2,
156 bool verbose =
false)
159 typename itk::Point<TCoordRep, NPointDimension>::VectorType diff = point1 - point2;
160 for (
unsigned int i = 0; i < NPointDimension; i++)
MITK point type extending itk::Point with additional constructors and utility methods.
void ToArray(ArrayType array) const
Copy the values stored in this point into an array.
Point(const TPointValueType r[NPointDimension])
Point(const TCoordRep r[NPointDimension])
Point(const TPointValueType &v)
Point()
Default constructor.
void FillPoint(const ArrayType &array)
Copy elements from an array into this point.
Point(const TCoordRep &v)
Point(const Point< TPointValueType, NPointDimension > &r)
Pass-through constructors for the Array base class.
Point(const itk::Point< TCoordRep, NPointDimension > &p)
Point(const mitk::Point< TCoordRep, NPointDimension > &r)
Point & operator=(const mitk::Point< TCoordRep, NPointDimension > &)=default
Find image slices visible on a given plane.
Point< ScalarType, 3 > Point3D
MITKCORE_EXPORT const ScalarType eps
Epsilon value for floating point comparison (vnl_math::eps * 100).
void from_json(const nlohmann::json &, GenericLookupTable< T > &)
Deserialize a GenericLookupTable from JSON.
Point< ScalarType, 4 > Point4D
void ConditionalOutputOfDifference(ElementToOutput1 elem1, ElementToOutput2 elem2, mitk::ScalarType eps, bool verbose, bool isEqual)
Conditionally output the difference between two elements to the log.
Point< ScalarType, 2 > Point2D
PointSpecificationType
Enumeration of point specification types.
void to_json(nlohmann::json &j, const GenericLookupTable< T > &t)
Serialize a GenericLookupTable to JSON.
bool DifferenceBiggerOrEqualEps(DifferenceType diff, mitk::ScalarType epsilon=mitk::eps)
Check if the absolute difference is bigger than or equal to a given epsilon.
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.