ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkScaleTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkScaleTransform_h
19 #define itkScaleTransform_h
20 
22 #include "itkMacro.h"
23 #include "itkMatrix.h"
24 
25 namespace itk
26 {
40 template<typename TParametersValueType=float,
41  unsigned int NDimensions=3>
42 class ITK_TEMPLATE_EXPORT ScaleTransform : public MatrixOffsetTransformBase<TParametersValueType,
43  NDimensions,
44  NDimensions>
45 {
46 public:
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(ScaleTransform, Transform);
58 
60  itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
61  itkStaticConstMacro(ParametersDimension, unsigned int, NDimensions);
63 
65  typedef typename Superclass::ScalarType ScalarType;
66 
68  typedef typename Superclass::FixedParametersType FixedParametersType;
69  typedef typename Superclass::ParametersType ParametersType;
70 
72  typedef typename Superclass::JacobianType JacobianType;
73 
76 
80 
84 
86  typedef vnl_vector_fixed<TParametersValueType, NDimensions> InputVnlVectorType;
87  typedef vnl_vector_fixed<TParametersValueType, NDimensions> OutputVnlVectorType;
88 
92 
95  typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
96  typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
97 
98  typedef typename Superclass::MatrixType MatrixType;
99 
104  virtual void SetParameters(const ParametersType & parameters) ITK_OVERRIDE;
105 
110  virtual const ParametersType & GetParameters() const ITK_OVERRIDE;
111 
112 
113 #if !defined( ITK_LEGACY_REMOVE )
114 
118  virtual void SetFixedParameters(const FixedParametersType &params) ITK_OVERRIDE
119  {
120  if (params.GetSize() != NDimensions)
121  {
122  itkWarningMacro(<< "The ScaleTransform now has " << NDimensions << " fixed parameters for the Center. Ignoring fixed parameters provided.");
123  return;
124  }
125  Superclass::SetFixedParameters(params);
126  }
127 #endif
128 
129 
131  virtual void ComputeJacobianWithRespectToParameters(const InputPointType & point, JacobianType & j) const ITK_OVERRIDE;
132 
137  virtual void ComputeJacobianWithRespectToPosition(const InputPointType & x, JacobianType & jac) const ITK_OVERRIDE;
138 
147  void SetScale(const ScaleType & scale);
148 
149  virtual void ComputeMatrix(void) ITK_OVERRIDE;
150 
152  void Compose(const Self *other, bool pre = false);
153 
157  void Scale(const ScaleType & scale, bool pre = false);
158 
163  OutputPointType TransformPoint(const InputPointType & point) const ITK_OVERRIDE;
164 
165  using Superclass::TransformVector;
166  OutputVectorType TransformVector(const InputVectorType & vector) const ITK_OVERRIDE;
167 
168  OutputVnlVectorType TransformVector(const InputVnlVectorType & vector) const ITK_OVERRIDE;
169 
170  using Superclass::TransformCovariantVector;
171  OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType & vector) const ITK_OVERRIDE;
172 
177  inline InputPointType BackTransform(const OutputPointType & point) const;
178 
179  inline InputVectorType BackTransform(const OutputVectorType & vector) const;
180 
181  inline InputVnlVectorType BackTransform(const OutputVnlVectorType & vector) const;
182 
183  inline InputCovariantVectorType BackTransform(const OutputCovariantVectorType & vector) const;
184 
189  bool GetInverse(Self *inverse) const;
190 
192  virtual InverseTransformBasePointer GetInverseTransform() const ITK_OVERRIDE;
193 
197  void SetIdentity() ITK_OVERRIDE;
198 
200  itkGetConstReferenceMacro(Scale, ScaleType);
201 
202 protected:
204  ScaleTransform();
205 
207  ~ScaleTransform() ITK_OVERRIDE;
208 
210  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
211 
212 private:
213  ITK_DISALLOW_COPY_AND_ASSIGN(ScaleTransform);
214 
215  ScaleType m_Scale; // Scales of the transformation
216 
217 }; // class ScaleTransform
218 
219 } // end namespace itk
220 
221 #ifndef ITK_MANUAL_INSTANTIATION
222 #include "itkScaleTransform.hxx"
223 #endif
224 
225 #endif /* itkScaleTransform_h */
Superclass::InverseTransformBaseType InverseTransformBaseType
CovariantVector< TParametersValueType, NDimensions > OutputCovariantVectorType
Light weight base class for most itk classes.
Superclass::FixedParametersType FixedParametersType
Point< TParametersValueType, NDimensions > InputPointType
Matrix and Offset transformation of a vector space (e.g. space coordinates)
Vector< TParametersValueType, NDimensions > OutputVectorType
Point< TParametersValueType, NDimensions > OutputPointType
SmartPointer< const Self > ConstPointer
MatrixOffsetTransformBase< TParametersValueType, NDimensions, NDimensions > Superclass
Superclass::ScalarType ScalarType
vnl_vector_fixed< TParametersValueType, NDimensions > OutputVnlVectorType
SmartPointer< Self > Pointer
Superclass::MatrixType MatrixType
CovariantVector< TParametersValueType, NDimensions > InputCovariantVectorType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
Superclass::ParametersType ParametersType
FixedArray< TParametersValueType, NDimensions > ScaleType
InverseTransformBaseType::Pointer InverseTransformBasePointer
Scale transformation of a vector space (e.g. space coordinates)
vnl_vector_fixed< TParametersValueType, NDimensions > InputVnlVectorType
Superclass::JacobianType JacobianType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Vector< TParametersValueType, NDimensions > InputVectorType
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
A templated class holding a n-Dimensional covariant vector.