ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSimilarity2DTransform.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkSimilarity2DTransform_h
00019 #define __itkSimilarity2DTransform_h
00020 
00021 #include <iostream>
00022 #include "itkRigid2DTransform.h"
00023 
00024 namespace itk
00025 {
00061 template <class TScalarType = double>
00062 // Data type for scalars (float or double)
00063 class ITK_EXPORT Similarity2DTransform :
00064   public Rigid2DTransform<TScalarType>
00065 {
00066 public:
00068   typedef Similarity2DTransform         Self;
00069   typedef Rigid2DTransform<TScalarType> Superclass;
00070   typedef SmartPointer<Self>            Pointer;
00071   typedef SmartPointer<const Self>      ConstPointer;
00072 
00074   itkNewMacro(Self);
00075 
00077   itkTypeMacro(Similarity2DTransform, Rigid2DTransform);
00078 
00080   itkStaticConstMacro(SpaceDimension,           unsigned int, 2);
00081   itkStaticConstMacro(InputSpaceDimension,      unsigned int, 2);
00082   itkStaticConstMacro(OutputSpaceDimension,     unsigned int, 2);
00083   itkStaticConstMacro(ParametersDimension,      unsigned int, 4);
00085 
00087   typedef typename Superclass::ScalarType ScalarType;
00088   typedef          TScalarType            ScaleType;
00089 
00091   typedef typename Superclass::ParametersType      ParametersType;
00092   typedef typename Superclass::ParametersValueType ParametersValueType;
00093 
00095   typedef typename Superclass::JacobianType JacobianType;
00096 
00098   typedef typename Superclass::OffsetType      OffsetType;
00099   typedef typename Superclass::OffsetValueType OffsetValueType;
00100 
00102   typedef typename Superclass::MatrixType      MatrixType;
00103   typedef typename Superclass::MatrixValueType MatrixValueType;
00104 
00106   typedef typename Superclass::InputPointType  InputPointType;
00107   typedef typename Superclass::OutputPointType OutputPointType;
00108 
00110   typedef typename Superclass::InputVectorType  InputVectorType;
00111   typedef typename Superclass::OutputVectorType OutputVectorType;
00112 
00114   typedef typename Superclass::InputCovariantVectorType  InputCovariantVectorType;
00115   typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
00116 
00118   typedef typename Superclass::InputVnlVectorType  InputVnlVectorType;
00119   typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00120 
00123   typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
00124   typedef typename InverseTransformBaseType::Pointer    InverseTransformBasePointer;
00125 
00127   void SetScale(ScaleType scale);
00128 
00129   itkGetConstReferenceMacro(Scale, ScaleType);
00130 
00140   void SetParameters(const ParametersType & parameters);
00141 
00151   const ParametersType & GetParameters(void) const;
00152 
00156   virtual void ComputeJacobianWithRespectToParameters( const InputPointType  & p, JacobianType & jacobian) const;
00157 
00159   virtual void SetIdentity(void);
00160 
00165   void CloneInverseTo(Pointer & newinverse) const;
00166 
00168   bool GetInverse(Self *inverse) const;
00169 
00171   virtual InverseTransformBasePointer GetInverseTransform() const;
00172 
00177   void CloneTo(Pointer & clone) const;
00178 
00192   virtual void SetMatrix(const MatrixType & matrix);
00193 
00194 protected:
00195   Similarity2DTransform(unsigned int outputSpaceDimension, unsigned int parametersDimension);
00196   Similarity2DTransform(unsigned int parametersDimension);
00197   Similarity2DTransform();
00198 
00199   ~Similarity2DTransform()
00200   {
00201   }
00202   void PrintSelf(std::ostream & os, Indent indent) const;
00203 
00207   virtual void ComputeMatrix(void);
00208 
00213   virtual void ComputeMatrixParameters(void);
00214 
00216   void SetVarScale(ScaleType scale)
00217   {
00218     m_Scale = scale;
00219   }
00220 private:
00221   Similarity2DTransform(const Self &); // purposely not implemented
00222   void operator=(const Self &);        // purposely not implemented
00224 
00225   ScaleType m_Scale;
00226 }; // class Similarity2DTransform
00227 }  // namespace itk
00228 
00229 // Define instantiation macro for this template.
00230 #define ITK_TEMPLATE_Similarity2DTransform(_, EXPORT, TypeX, TypeY)                     \
00231   namespace itk                                                                         \
00232   {                                                                                     \
00233   _( 1 ( class EXPORT Similarity2DTransform<ITK_TEMPLATE_1 TypeX> ) )                 \
00234   namespace Templates                                                                   \
00235   {                                                                                     \
00236   typedef Similarity2DTransform<ITK_TEMPLATE_1 TypeX> Similarity2DTransform##TypeY; \
00237   }                                                                                     \
00238   }
00239 
00240 #if ITK_TEMPLATE_EXPLICIT
00241 #include "Templates/itkSimilarity2DTransform+-.h"
00242 #endif
00243 
00244 #if ITK_TEMPLATE_TXX
00245 #include "itkSimilarity2DTransform.hxx"
00246 #endif
00247 
00248 #endif /* __itkSimilarity2DTransform_h */
00249