00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkScaleTransform_h
00019 #define __itkScaleTransform_h
00020
00021 #include <iostream>
00022 #include "itkTransform.h"
00023 #include "itkExceptionObject.h"
00024 #include "itkMatrix.h"
00025
00026 namespace itk
00027 {
00028
00037 template <
00038 class TScalarType=float,
00039 unsigned int NDimensions=3 >
00040 class ITK_EXPORT ScaleTransform : public Transform< TScalarType,
00041 NDimensions,
00042 NDimensions >
00043 {
00044 public:
00046 typedef ScaleTransform Self;
00047 typedef Transform< TScalarType, NDimensions, NDimensions > Superclass;
00048 typedef SmartPointer<Self> Pointer;
00049 typedef SmartPointer<const Self> ConstPointer;
00050
00052 itkNewMacro( Self );
00053
00055 itkTypeMacro( ScaleTransform, Transform );
00056
00058 itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
00059 itkStaticConstMacro(ParametersDimension, unsigned int, NDimensions);
00060
00062 typedef typename Superclass::ScalarType ScalarType;
00063
00065 typedef typename Superclass::ParametersType ParametersType;
00066
00068 typedef typename Superclass::JacobianType JacobianType;
00069
00071 typedef FixedArray<TScalarType, itkGetStaticConstMacro(SpaceDimension)> ScaleType;
00072
00074 typedef Vector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputVectorType;
00075 typedef Vector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputVectorType;
00076
00078 typedef CovariantVector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputCovariantVectorType;
00079 typedef CovariantVector<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputCovariantVectorType;
00080
00082 typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputVnlVectorType;
00083 typedef vnl_vector_fixed<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputVnlVectorType;
00084
00086 typedef Point<TScalarType, itkGetStaticConstMacro(SpaceDimension)> InputPointType;
00087 typedef Point<TScalarType, itkGetStaticConstMacro(SpaceDimension)> OutputPointType;
00088
00093 void SetParameters(const ParametersType & parameters);
00094
00099 const ParametersType & GetParameters( void ) const;
00100
00102 const JacobianType & GetJacobian( const InputPointType & point ) const;
00103
00112 void SetScale( const ScaleType & scale )
00113 { this->Modified(); m_Scale = scale; }
00114
00116 void Compose(const Self * other, bool pre=false);
00117
00121 void Scale(const ScaleType & scale, bool pre=false );
00122
00127 OutputPointType TransformPoint(const InputPointType &point ) const;
00128 OutputVectorType TransformVector(const InputVectorType &vector) const;
00129 OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const;
00130 OutputCovariantVectorType TransformCovariantVector(
00131 const InputCovariantVectorType &vector) const;
00132
00137 inline InputPointType BackTransform(const OutputPointType &point ) const;
00138 inline InputVectorType BackTransform(const OutputVectorType &vector) const;
00139 inline InputVnlVectorType BackTransform(const OutputVnlVectorType &vector) const;
00140 inline InputCovariantVectorType BackTransform(
00141 const OutputCovariantVectorType &vector) const;
00142
00147 bool GetInverse(Self* inverse) const;
00148
00152 void SetIdentity( void )
00153 { m_Scale.Fill( 1.0 ); }
00154
00155
00157 itkSetMacro( Center, InputPointType );
00158 itkGetConstReferenceMacro( Center, InputPointType );
00159
00160
00162 itkGetConstReferenceMacro( Scale, ScaleType );
00163
00164
00165 protected:
00167 ScaleTransform();
00168
00170 ~ScaleTransform();
00171
00173 void PrintSelf(std::ostream &os, Indent indent) const;
00174
00175
00176 private:
00177 ScaleTransform(const Self & other);
00178 const Self & operator=( const Self & );
00179
00180 ScaleType m_Scale;
00181
00182 InputPointType m_Center;
00183
00184 };
00185
00186 }
00187
00188
00189 #ifndef ITK_MANUAL_INSTANTIATION
00190 #include "itkScaleTransform.txx"
00191 #endif
00192
00193 #endif