ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkScalableAffineTransform.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 __itkScalableAffineTransform_h
19 #define __itkScalableAffineTransform_h
20 
21 #include "itkAffineTransform.h"
22 
23 namespace itk
24 {
33 template<
34  class TScalarType = double, // Data type for scalars (e.g. float or double)
35  unsigned int NDimensions = 3 >
36 // Number of dimensions in the input space
37 class ITK_EXPORT ScalableAffineTransform:
38  public AffineTransform< TScalarType, NDimensions >
39 {
40 public:
46 
49 
51  itkNewMacro(Self);
52 
54  itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions);
55  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions);
56  itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
57  itkStaticConstMacro( ParametersDimension, unsigned int,
58  NDimensions * ( NDimensions + 1 ) );
60 
62  typedef typename Superclass::ParametersType ParametersType;
63  typedef typename Superclass::ParametersValueType ParametersValueType;
64  typedef typename Superclass::JacobianType JacobianType;
65  typedef typename Superclass::ScalarType ScalarType;
66  typedef typename Superclass::InputVectorType InputVectorType;
67  typedef typename Superclass::OutputVectorType OutputVectorType;
68  typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
69  typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
70  typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
71  typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
72  typedef typename Superclass::InputPointType InputPointType;
73  typedef typename Superclass::OutputPointType OutputPointType;
74  typedef typename Superclass::MatrixType MatrixType;
75  typedef typename Superclass::MatrixValueType MatrixValueType;
76  typedef typename Superclass::InverseMatrixType InverseMatrixType;
77  typedef typename Superclass::CenterType CenterType;
78  typedef typename Superclass::OffsetType OffsetType;
79  typedef typename Superclass::TranslationType TranslationType;
80 
83  typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
84  typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
85 
89  void SetIdentity(void);
90 
92  virtual void SetScale(const InputVectorType & scale);
93 
94  virtual void SetScaleComponent(const InputVectorType & scale)
95  { this->SetScale(scale); }
96 
98  virtual void SetScale(const double scale[NDimensions]);
99 
100  virtual void SetScaleComponent(const double scale[NDimensions])
101  { this->SetScale(scale); }
102 
104  virtual const double * GetScale() const
105  { return m_Scale; }
106  virtual const double * GetScaleComponent() const
107  { return m_Scale; }
109 
111  bool GetInverse(Self *inverse) const;
112 
114  virtual InverseTransformBasePointer GetInverseTransform() const;
115 
119  itkLegacyMacro(void SetMatrixComponent(const MatrixType & matrix));
120 
123  itkLegacyMacro(const MatrixType & GetMatrixComponent() const);
124 
127  itkLegacyMacro(void SetOffsetComponent(const OffsetType & offset) );
128 
131  itkLegacyMacro(const OffsetType & GetOffsetComponent(void) const );
132 
133 protected:
141  ScalableAffineTransform(const MatrixType & matrix,
142  const OutputVectorType & offset);
143  ScalableAffineTransform(unsigned int outputSpaceDimension,
144  unsigned int parametersDimension);
145  ScalableAffineTransform(unsigned int parametersDimension);
148 
149  void ComputeMatrix();
150 
152  virtual ~ScalableAffineTransform();
153 
155  void PrintSelf(std::ostream & s, Indent indent) const;
156 
157  void SetVarScale(const double *scale)
158  { for ( int i = 0; i < InputSpaceDimension; i++ ) { m_Scale[i] = scale[i]; } }
159 private:
160 
161  ScalableAffineTransform(const Self & other);
162  const Self & operator=(const Self &);
163 
164  double m_Scale[NDimensions];
166 }; //class ScalableAffineTransform
167 } // namespace itk
168 
169 // Define instantiation macro for this template.
170 #define ITK_TEMPLATE_ScalableAffineTransform(_, EXPORT, TypeX, TypeY) \
171  namespace itk \
172  { \
173  _( 2 ( class EXPORT ScalableAffineTransform< ITK_TEMPLATE_2 TypeX > ) ) \
174  namespace Templates \
175  { \
176  typedef ScalableAffineTransform< ITK_TEMPLATE_2 TypeX > \
177  ScalableAffineTransform##TypeY; \
178  } \
179  }
180 
181 #if ITK_TEMPLATE_EXPLICIT
182 #include "Templates/itkScalableAffineTransform+-.h"
183 #endif
184 
185 #if ITK_TEMPLATE_TXX
186 #include "itkScalableAffineTransform.hxx"
187 #endif
188 
189 #endif /* __itkScalableAffineTransform_h */
190