Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
Medical Imaging Interaction Toolkit
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 
17 #include <mitkCameraIntrinsics.h>
18 #include "mitkNumericTypes.h"
19 #include <vnl/vnl_math.h>
20 
21 namespace mitk
22 {
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 
84  static ToFPoint3D IndexToCartesianCoordinates(itk::Index<3> index, ToFScalarType distance,
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  }
144  static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(itk::Index<3> index, ToFScalarType distance, ToFScalarType focalLength,
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 
238  static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFScalarType cartesianPoint[3], ToFScalarType focalLength,
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  }
254  static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFPoint3D cartesianPoint, ToFScalarType focalLength,
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 
286  static ToFPoint3D KinectIndexToCartesianCoordinates(itk::Index<3> index, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
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
itk::Vector< ToFScalarType, 3 > ToFVector3D
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(itk::Index< 3 > index, ToFScalarType distance, ToFScalarType focalLength, ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
DataCollection - Class to facilitate loading/accessing structured data.
static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength[2], ToFScalarType principalPoint[2])
static ToFPoint3D KinectIndexToCartesianCoordinates(itk::Index< 3 > index, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
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...
#define MITKTOFPROCESSING_EXPORT
itk::Point< ToFScalarType, 2 > ToFPoint2D
itk::Point< ToFScalarType, 3 > ToFPoint3D
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...
Helper class providing functions which are useful for multiple usage.
static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFPoint3D cartesianPoint, ToFScalarType focalLength, ToFPoint2D interPixelDistance, ToFPoint2D principalPoint, bool calculateDistance=true)
Convert cartesian coordinates to index based distances.
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...
static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
itk::Vector< ToFScalarType, 2 > ToFVector2D
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength, ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
static ToFProcessingCommon::ToFPoint3D CartesianToKinectIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength, ToFPoint2D principalPoint, bool calculateDistance=true)
static ToFPoint3D IndexToCartesianCoordinates(itk::Index< 3 > index, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
Convert index based distances to cartesian coordinates.
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...
static ToFPoint3D CartesianToIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength, ToFPoint2D principalPoint, bool calculateDistance=true)
Convert cartesian coordinates to index based distances.