ITK  4.8.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 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 
66 
70 
73 
76 
80 
84 
86  typedef vnl_vector_fixed<TParametersValueType, NDimensions> InputVnlVectorType;
87  typedef vnl_vector_fixed<TParametersValueType, NDimensions> OutputVnlVectorType;
88 
92 
96  typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
97 
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  }
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 
166  OutputVectorType TransformVector(const InputVectorType & vector) const ITK_OVERRIDE;
167 
168  OutputVnlVectorType TransformVector(const InputVnlVectorType & vector) const ITK_OVERRIDE;
169 
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 
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();
208 
210  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
211 
212 private:
213  ScaleTransform(const Self & other); // purposely not implemented
214  const Self & operator=(const Self &); // purposely not implemented
215 
216  ScaleType m_Scale; // Scales of the transformation
217 
218 }; // class ScaleTransform
219 
220 } // end namespace itk
221 
222 #ifndef ITK_MANUAL_INSTANTIATION
223 #include "itkScaleTransform.hxx"
224 #endif
225 
226 #endif /* itkScaleTransform_h */
virtual void SetParameters(const ParametersType &parameters) override
virtual void SetFixedParameters(const FixedParametersType &) override
Superclass::InverseTransformBaseType InverseTransformBaseType
virtual void ComputeJacobianWithRespectToParameters(const InputPointType &point, JacobianType &j) const override
CovariantVector< TParametersValueType, NDimensions > OutputCovariantVectorType
Matrix< TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType
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
void Compose(const Self *other, bool pre=false)
InputPointType BackTransform(const OutputPointType &point) const
MatrixOffsetTransformBase< TParametersValueType, NDimensions, NDimensions > Superclass
OutputPointType TransformPoint(const InputPointType &point) const override
Superclass::ScalarType ScalarType
OutputVectorType TransformVector(const InputVectorType &vector) const override
vnl_vector_fixed< TParametersValueType, NDimensions > OutputVnlVectorType
virtual const ParametersType & GetParameters() const override
virtual InverseTransformBasePointer GetInverseTransform() const override
SmartPointer< Self > Pointer
Superclass::MatrixType MatrixType
void Scale(const ScaleType &scale, bool pre=false)
CovariantVector< TParametersValueType, NDimensions > InputCovariantVectorType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
void SetScale(const ScaleType &scale)
Superclass::ParametersType ParametersType
virtual void ComputeJacobianWithRespectToPosition(const InputPointType &x, JacobianType &jac) const override
FixedArray< TParametersValueType, NDimensions > ScaleType
InverseTransformBaseType::Pointer InverseTransformBasePointer
Scale transformation of a vector space (e.g. space coordinates)
vnl_vector_fixed< TParametersValueType, NDimensions > InputVnlVectorType
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
Superclass::JacobianType JacobianType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
static const unsigned int SpaceDimension
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Vector< TParametersValueType, NDimensions > InputVectorType
bool GetInverse(Self *inverse) const
virtual void ComputeMatrix(void) override
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:51
static const unsigned int ParametersDimension
A templated class holding a n-Dimensional covariant vector.
void SetIdentity() override