Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkToFProcessingCommon.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 mitkToFProcessingCommon_h
14 #define mitkToFProcessingCommon_h
15 
16 #include <MitkToFProcessingExports.h>
17 #include <mitkCameraIntrinsics.h>
18 #include "mitkNumericTypes.h"
19 #include <vnl/vnl_math.h>
20 
21 namespace mitk
22 {
38  class MITKTOFPROCESSING_EXPORT ToFProcessingCommon
39  {
40  public:
41  typedef double ToFScalarType;
42  typedef itk::Point<ToFScalarType, 2> ToFPoint2D;
43  typedef itk::Point<ToFScalarType, 3> ToFPoint3D;
44  typedef itk::Vector<ToFScalarType, 2> ToFVector2D;
45  typedef itk::Vector<ToFScalarType, 3> ToFVector3D;
46 
58  static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
59  ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY);
60 
70  static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
71  ToFPoint2D focalLength, ToFPoint2D principalPoint)
72  {
73  return IndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
74  }
75 
85  ToFPoint2D focalLength, ToFPoint2D principalPoint)
86  {
87  return IndexToCartesianCoordinates(index[0],index[1],distance,focalLength[0],focalLength[1],principalPoint[0], principalPoint[1]);
88  }
98  static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
99  ToFScalarType focalLength[2], ToFScalarType principalPoint[2])
100  {
101  return IndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
102  }
103 
104 
117  static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
118  ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY, ToFScalarType principalPointX, ToFScalarType principalPointY);
119 
130  static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
131  ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
132  {
133  return IndexToCartesianCoordinatesWithInterpixdist(i,j,distance,focalLength,interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1]);
134  }
145  ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
146  {
147  return IndexToCartesianCoordinatesWithInterpixdist(index[0],index[1],distance,focalLength,interPixelDistance[0], interPixelDistance[1],principalPoint[0], principalPoint[1]);
148  }
159  static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
160  ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2])
161  {
162  return IndexToCartesianCoordinatesWithInterpixdist(i,j,distance,focalLength,interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1]);
163  }
164 
165 
178  static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,ToFScalarType cartesianPointZ,
179  ToFScalarType focalLengthX, ToFScalarType focalLengthY,
180  ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true);
181 
190  static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPoint[3], ToFScalarType focalLength[2],
191  ToFScalarType principalPoint[2], bool calculateDistance=true)
192  {
193  return CartesianToIndexCoordinates(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength[0], focalLength[1],
194  principalPoint[0],principalPoint[1],calculateDistance);
195  }
204  static ToFPoint3D CartesianToIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength,
205  ToFPoint2D principalPoint, bool calculateDistance=true)
206  {
207  return CartesianToIndexCoordinates(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength[0], focalLength[1],
208  principalPoint[0],principalPoint[1],calculateDistance);
209  }
210 
211 
225  static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,ToFScalarType cartesianPointZ,
226  ToFScalarType focalLength, ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY,
227  ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true);
228 
239  ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2],
240  bool calculateDistance=true)
241  {
242  return CartesianToIndexCoordinatesWithInterpixdist(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength,
243  interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1],calculateDistance);
244  }
255  ToFPoint2D interPixelDistance, ToFPoint2D principalPoint, bool calculateDistance=true)
256  {
257  return CartesianToIndexCoordinatesWithInterpixdist(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength,
258  interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1],calculateDistance);
259  }
260 
272  static ToFProcessingCommon::ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY);
273 
274  static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
275  ToFScalarType focalLength[2], ToFScalarType principalPoint[2])
276  {
277  return KinectIndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
278  }
279 
280  static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
281  ToFPoint2D focalLength, ToFPoint2D principalPoint)
282  {
283  return KinectIndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
284  }
285 
287  {
288  return KinectIndexToCartesianCoordinates(index[0],index[1],distance,focalLength[0],focalLength[1],principalPoint[0], principalPoint[1]);
289  }
290 
303  static ToFPoint3D CartesianToKinectIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,
304  ToFScalarType cartesianPointZ, ToFScalarType focalLengthX,
305  ToFScalarType focalLengthY, ToFScalarType principalPointX,
306  ToFScalarType principalPointY, bool calculateDistance=true);
307 
308  static ToFProcessingCommon::ToFPoint3D CartesianToKinectIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength, ToFPoint2D principalPoint, bool calculateDistance=true)
309  {
310  return CartesianToKinectIndexCoordinates( cartesianPoint[0], cartesianPoint[1], cartesianPoint[2], focalLength[0], focalLength[1], principalPoint[0], principalPoint[1], calculateDistance);
311  }
312 
326  static ToFProcessingCommon::ToFPoint3D ContinuousKinectIndexToCartesianCoordinates(mitk::Point2D continuousIndex, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY);
327 
335  static ToFScalarType CalculateViewAngle(mitk::CameraIntrinsics::Pointer intrinsics, unsigned int dimX);
336  };
337 }
338 #endif
mitk::ToFProcessingCommon::ToFPoint3D
itk::Point< ToFScalarType, 3 > ToFPoint3D
Definition: mitkToFProcessingCommon.h:43
mitk::ToFProcessingCommon::IndexToCartesianCoordinatesWithInterpixdist
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(itk::Index< 3 > index, ToFScalarType distance, ToFScalarType focalLength, ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
Definition: mitkToFProcessingCommon.h:144
mitk::ToFProcessingCommon
Helper class providing functions which are useful for multiple usage.
Definition: mitkToFProcessingCommon.h:38
mitkCameraIntrinsics.h
mitk::ToFProcessingCommon::IndexToCartesianCoordinates
static ToFPoint3D IndexToCartesianCoordinates(itk::Index< 3 > index, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
Definition: mitkToFProcessingCommon.h:84
mitk::ToFProcessingCommon::IndexToCartesianCoordinates
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength[2], ToFScalarType principalPoint[2])
Convenience method to convert index based distances to cartesian coordinates using array as input.
Definition: mitkToFProcessingCommon.h:98
mitk::ToFProcessingCommon::ToFVector2D
itk::Vector< ToFScalarType, 2 > ToFVector2D
Definition: mitkToFProcessingCommon.h:44
mitk::ToFProcessingCommon::CartesianToIndexCoordinatesWithInterpixdist
static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFScalarType cartesianPoint[3], ToFScalarType focalLength, ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2], bool calculateDistance=true)
Convenience method to convert cartesian coordinates to index based distances using arrays.
Definition: mitkToFProcessingCommon.h:238
mitk::ToFProcessingCommon::KinectIndexToCartesianCoordinates
static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
Definition: mitkToFProcessingCommon.h:280
mitk::ToFProcessingCommon::KinectIndexToCartesianCoordinates
static ToFPoint3D KinectIndexToCartesianCoordinates(itk::Index< 3 > index, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
Definition: mitkToFProcessingCommon.h:286
mitk::ToFProcessingCommon::CartesianToIndexCoordinatesWithInterpixdist
static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFPoint3D cartesianPoint, ToFScalarType focalLength, ToFPoint2D interPixelDistance, ToFPoint2D principalPoint, bool calculateDistance=true)
Convert cartesian coordinates to index based distances.
Definition: mitkToFProcessingCommon.h:254
mitk::ToFProcessingCommon::ToFPoint2D
itk::Point< ToFScalarType, 2 > ToFPoint2D
Definition: mitkToFProcessingCommon.h:42
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ToFProcessingCommon::CartesianToIndexCoordinates
static ToFPoint3D CartesianToIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength, ToFPoint2D principalPoint, bool calculateDistance=true)
Convert cartesian coordinates to index based distances.
Definition: mitkToFProcessingCommon.h:204
mitk::ToFProcessingCommon::KinectIndexToCartesianCoordinates
static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength[2], ToFScalarType principalPoint[2])
Definition: mitkToFProcessingCommon.h:274
mitk::Point< ScalarType, 2 >
mitk::ToFProcessingCommon::CartesianToIndexCoordinates
static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPoint[3], ToFScalarType focalLength[2], ToFScalarType principalPoint[2], bool calculateDistance=true)
Convenience method to convert cartesian coordinates to index based distances using arrays.
Definition: mitkToFProcessingCommon.h:190
mitk::ToFProcessingCommon::CartesianToKinectIndexCoordinates
static ToFProcessingCommon::ToFPoint3D CartesianToKinectIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength, ToFPoint2D principalPoint, bool calculateDistance=true)
Definition: mitkToFProcessingCommon.h:308
mitkNumericTypes.h
mitk::ToFProcessingCommon::IndexToCartesianCoordinatesWithInterpixdist
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength, ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2])
Convenience method to convert index based distances to cartesian coordinates using array as input.
Definition: mitkToFProcessingCommon.h:159
mitk::ToFProcessingCommon::IndexToCartesianCoordinates
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
Definition: mitkToFProcessingCommon.h:70
mitk::ToFProcessingCommon::ToFVector3D
itk::Vector< ToFScalarType, 3 > ToFVector3D
Definition: mitkToFProcessingCommon.h:45
itk::Index< 3 >
mitk::ToFProcessingCommon::ToFScalarType
double ToFScalarType
Definition: mitkToFProcessingCommon.h:41
mitk::ToFProcessingCommon::IndexToCartesianCoordinatesWithInterpixdist
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength, ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
Definition: mitkToFProcessingCommon.h:130