ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkRigid3DTransform_h 00019 #define __itkRigid3DTransform_h 00020 00021 #include <iostream> 00022 #include "itkMatrixOffsetTransformBase.h" 00023 #include "itkVersor.h" 00024 00025 namespace itk 00026 { 00047 template< class TScalarType = double > 00048 // type for scalars (float or double) 00049 class ITK_EXPORT Rigid3DTransform: 00050 public MatrixOffsetTransformBase< TScalarType, 3, 3 > 00051 { 00052 public: 00054 typedef Rigid3DTransform Self; 00055 typedef MatrixOffsetTransformBase< TScalarType, 3, 3 > Superclass; 00056 typedef SmartPointer< Self > Pointer; 00057 typedef SmartPointer< const Self > ConstPointer; 00058 00059 #ifdef ITKV3_COMPATIBILITY 00060 00061 itkNewMacro(Self); 00062 #endif 00063 00065 itkTypeMacro(Rigid3DTransform, MatrixOffsetTransformBase); 00066 00068 itkStaticConstMacro(SpaceDimension, unsigned int, 3); 00069 itkStaticConstMacro(InputSpaceDimension, unsigned int, 3); 00070 itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3); 00071 itkStaticConstMacro(ParametersDimension, unsigned int, 12); 00073 00074 typedef typename Superclass::ParametersType ParametersType; 00075 typedef typename Superclass::ParametersValueType ParametersValueType; 00076 typedef typename Superclass::JacobianType JacobianType; 00077 typedef typename Superclass::ScalarType ScalarType; 00078 typedef typename Superclass::InputVectorType InputVectorType; 00079 typedef typename Superclass::OutputVectorType OutputVectorType; 00080 typedef typename Superclass::OutputVectorValueType OutputVectorValueType; 00081 typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType; 00082 typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType; 00083 typedef typename Superclass::InputVnlVectorType InputVnlVectorType; 00084 typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; 00085 typedef typename Superclass::InputPointType InputPointType; 00086 typedef typename Superclass::OutputPointType OutputPointType; 00087 typedef typename Superclass::MatrixType MatrixType; 00088 typedef typename Superclass::InverseMatrixType InverseMatrixType; 00089 typedef typename Superclass::MatrixValueType MatrixValueType; 00090 typedef typename Superclass::CenterType CenterType; 00091 typedef typename Superclass::TranslationType TranslationType; 00092 typedef typename Superclass::OffsetType OffsetType; 00093 00096 typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType; 00097 typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer; 00098 00109 virtual void SetParameters(const ParametersType & parameters); 00110 00116 virtual void SetMatrix(const MatrixType & matrix); 00117 00126 const MatrixType & GetRotationMatrix() const 00127 { return this->GetMatrix(); } 00128 00139 virtual void SetRotationMatrix(const MatrixType & matrix) 00140 { this->SetMatrix(matrix); } 00141 00149 void Translate(const OffsetType & offset, bool pre = false); 00150 00151 #ifdef ITKV3_COMPATIBILITY 00152 00153 bool GetInverse(Self *inverse) const 00154 { 00155 return this->Superclass::GetInverse(inverse); 00156 } 00157 00159 virtual InverseTransformBasePointer GetInverseTransform() const 00160 { 00161 Pointer inv = New(); 00162 return this->GetInverse(inv) ? inv.GetPointer() : NULL; 00163 } 00164 #endif 00165 00166 00178 InputPointType BackTransform(const OutputPointType 00179 & point) const; 00180 00181 InputVectorType BackTransform(const OutputVectorType 00182 & vector) const; 00183 00184 InputVnlVectorType BackTransform(const OutputVnlVectorType 00185 & vector) const; 00186 00187 InputCovariantVectorType BackTransform(const OutputCovariantVectorType 00188 & vector) const; 00189 00194 bool MatrixIsOrthogonal(const MatrixType & matrix, double tol = 1e-10); 00195 00196 protected: 00197 Rigid3DTransform(const MatrixType & matrix, 00198 const OutputVectorType & offset); 00199 Rigid3DTransform(unsigned int paramDim); 00200 Rigid3DTransform(); 00201 ~Rigid3DTransform(); 00202 00206 void PrintSelf(std::ostream & os, Indent indent) const; 00207 00208 private: 00209 Rigid3DTransform(const Self &); //purposely not implemented 00210 void operator=(const Self &); //purposely not implemented 00211 }; //class Rigid3DTransform 00212 } // namespace itk 00213 00214 // Define instantiation macro for this template. 00215 #define ITK_TEMPLATE_Rigid3DTransform(_, EXPORT, TypeX, TypeY) \ 00216 namespace itk \ 00217 { \ 00218 _( 1 ( class EXPORT Rigid3DTransform< ITK_TEMPLATE_1 TypeX > ) ) \ 00219 namespace Templates \ 00220 { \ 00221 typedef Rigid3DTransform< ITK_TEMPLATE_1 TypeX > Rigid3DTransform##TypeY; \ 00222 } \ 00223 } 00224 00225 #if ITK_TEMPLATE_EXPLICIT 00226 #include "Templates/itkRigid3DTransform+-.h" 00227 #endif 00228 00229 #if ITK_TEMPLATE_TXX 00230 #include "itkRigid3DTransform.hxx" 00231 #endif 00232 00233 #endif /* __itkRigid3DTransform_h */ 00234