-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitkSphericalToCartesianTransform.h
170 lines (138 loc) · 6.15 KB
/
itkSphericalToCartesianTransform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//**********************************************************
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//**********************************************************
//
//
#ifndef itkSphericalToCartesianTransform_h
#define itkSphericalToCartesianTransform_h
#include <iostream>
#include "itkTransform.h"
#include "itkExceptionObject.h"
#include "itkMatrix.h"
namespace itk
{
/** \class SphericalToCartesianTransform
*
* \brief Spherical to Cartesian Coordinate Transformation(e.g. space coordinates).
*
* \f[ x_1 = r sin( \phi ) cos( \theta ) \f]
* \f[ x_2 = r sin( \phi ) sin( \theta ) \f]
* \f[ x_3 = r cos( \phi ) \f]
*
* \par
* Radius of the Spherical transform can be specified with SetRadius().
* The default is center of coordinate system < 0, 0, 0 >.
*
* Dimension must be 3.
*
* \phi change from 0 to \pi while \theta change from 0 to 2\pi
*
* \author HaaPut,
*
* \ingroup Transforms
* \ingroup CoordinateTransform
*/
template < typename TParametersValueType=double > // Number of dimensions
class ITK_TEMPLATE_EXPORT SphericalToCartesianTransform:
public Transform< TParametersValueType, 2, 3 >
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(SphericalToCartesianTransform);
/** Standard class type alias. */
using Self = SphericalToCartesianTransform;
using Superclass = Transform< TParametersValueType, 2, 3 >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;
/** New macro for creation of through the object factory.*/
itkNewMacro( Self );
/** Run-time type information (and related methods). */
itkTypeMacro( SphericalToCartesianTransform, Transform );
/** Dimension of the domain space. */
static constexpr unsigned int ParametersDimension = 0;
/** Standard scalar type for this class. */
using ScalarType = typename Superclass::ScalarType;
/** Standard Jacobian container. */
using JacobianType = typename Superclass::JacobianType;
//
/** Standard parameters container. */
using ParametersType = typename Superclass::ParametersType;
/** Fixed Parameter type */
using FixedParametersType = typename Superclass::FixedParametersType;
/** Standard vector type for this class. */
using InputVectorType = Vector<TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)>;
using OutputVectorType = Vector<TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)>;
/** Standard covariant vector type for this class. */
using InputCovariantVectorType = CovariantVector<TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)>;
using OutputCovariantVectorType = CovariantVector<TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)>;
/** Standard vnl_vector type for this class. */
using InputVnlVectorType = vnl_vector_fixed<TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)>;
using OutputVnlVectorType = vnl_vector_fixed<TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)>;
/** Standard coordinate point type for this class. */
using InputPointType = Point<TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)>;
using OutputPointType = Point<TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)>;
/** Method to transform a point.
* This method transforms a point from spherical
* coordinates <\rho, \theta, \phi> to cartesian coordinates.
*/
OutputPointType TransformPoint(const InputPointType &point ) const override;
/** Method to transform a vector - not applicable for this type of transform. */
OutputVectorType TransformVector(const InputVectorType &) const override
{
itkExceptionMacro(<< "Method not applicable for this type of transform.");
return OutputVectorType();
}
/** Method to transform a vnl_vector - not applicable for this type of transform. */
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
{
itkExceptionMacro(<< "Method not applicable for this type of transform.");
return OutputVnlVectorType();
}
/** Method to transform a vector - not applicable for this type of transform. */
typename Superclass::OutputVectorPixelType TransformVector(
const typename Superclass::InputVectorPixelType &, const InputPointType &) const override
{
itkExceptionMacro(<< "Method not applicable for this type of transform.");
return typename Superclass::OutputVectorPixelType();
}
using Superclass::TransformVector;
/** Method to transform a CovariantVector - not applicable for this type of transform */
OutputCovariantVectorType TransformCovariantVector(
const InputCovariantVectorType &) const override
{
itkExceptionMacro(<< "Method not applicable for this type of transform.");
return OutputCovariantVectorType();
}
using Superclass::TransformCovariantVector;
void ComputeJacobianWithRespectToParameters( const InputPointType &, JacobianType & ) const override
{
itkExceptionMacro(<< "Method not implemented yet.");
}
void SetParameters(const ParametersType &) override {}
void SetFixedParameters(const FixedParametersType &) override {}
/** Set the location of the center of the spherical coordinate system. */
itkSetMacro( Radius, TParametersValueType );
itkGetConstReferenceMacro( Radius, TParametersValueType );
protected:
SphericalToCartesianTransform();
~SphericalToCartesianTransform() = default;
/** Print contents of an SphericalToCartesianTransform. */
void PrintSelf(std::ostream &os, Indent indent) const override;
private:
TParametersValueType m_Radius;
}; //class SphericalToCartesianTransform
} // namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkSphericalToCartesianTransform.hxx"
#endif
#endif