| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkCenteredRigid2DTransform.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:33 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
|
|
| 18 |
|
#ifndef __itkCenteredRigid2DTransform_h |
| 19 |
|
#define __itkCenteredRigid2DTransform_h |
| 20 |
|
|
| 21 |
|
#include <iostream> |
| 22 |
|
#include "itkRigid2DTransform.h" |
| 23 |
|
|
| 24 |
|
namespace itk |
| 25 |
|
{ |
| 26 |
|
|
| 27 |
|
/** \brief CenteredRigid2DTransform of a vector space (e.g. space coordinates) |
| 28 |
|
* |
| 29 |
|
* This transform applies a rigid transformation is 2D space. |
| 30 |
|
* The transform is specified as a rotation around arbitrary center |
| 31 |
|
* and is followed by a translation. |
| 32 |
|
* |
| 33 |
|
* The main difference between this class and its superclass |
| 34 |
|
* Rigid2DTransform is that the center of rotation is exposed |
| 35 |
|
* for optimization. |
| 36 |
|
* |
| 37 |
|
* The serialization of the optimizable parameters is an array of 5 elements |
| 38 |
|
* ordered as follows: |
| 39 |
|
* p[0] = angle |
| 40 |
|
* p[1] = x coordinate of the center |
| 41 |
|
* p[2] = y coordinate of the center |
| 42 |
|
* p[3] = x component of the translation |
| 43 |
|
* p[4] = y component of the translation |
| 44 |
|
* |
| 45 |
|
* There are no fixed parameters. |
| 46 |
|
* |
| 47 |
|
* \sa Rigid2DTransform |
| 48 |
|
* |
| 49 |
|
* \ingroup Transforms |
| 50 |
|
*/ |
| 51 |
LEN |
template < class TScalarType=double > // Data type for scalars (float or double) |
| 52 |
MCM |
class ITK_EXPORT CenteredRigid2DTransform : |
| 53 |
IND |
************public Rigid2DTransform< TScalarType > |
| 54 |
|
{ |
| 55 |
|
public: |
| 56 |
|
/** Standard class typedefs. */ |
| 57 |
|
typedef CenteredRigid2DTransform Self; |
| 58 |
TDA |
typedef Rigid2DTransform< TScalarType > Superclass; |
| 59 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 60 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 61 |
|
|
| 62 |
|
/** New macro for creation of through a Smart Pointer. */ |
| 63 |
|
itkNewMacro( Self ); |
| 64 |
|
|
| 65 |
|
/** Run-time type information (and related methods). */ |
| 66 |
|
itkTypeMacro( CenteredRigid2DTransform, Rigid2DTransform ); |
| 67 |
|
|
| 68 |
|
/** Dimension of parameters. */ |
| 69 |
|
itkStaticConstMacro(SpaceDimension, unsigned int, 2); |
| 70 |
|
itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2); |
| 71 |
|
itkStaticConstMacro(ParametersDimension, unsigned int, 5); |
| 72 |
|
|
| 73 |
|
/** Scalar type. */ |
| 74 |
|
typedef typename Superclass::ScalarType ScalarType; |
| 75 |
|
|
| 76 |
|
/** Parameters type. */ |
| 77 |
|
typedef typename Superclass::ParametersType ParametersType; |
| 78 |
|
|
| 79 |
|
/** Jacobian type. */ |
| 80 |
|
typedef typename Superclass::JacobianType JacobianType; |
| 81 |
|
|
| 82 |
|
/** Offset type. */ |
| 83 |
|
typedef typename Superclass::OffsetType OffsetType; |
| 84 |
|
|
| 85 |
|
/** Point type. */ |
| 86 |
|
typedef typename Superclass::InputPointType InputPointType; |
| 87 |
|
typedef typename Superclass::OutputPointType OutputPointType; |
| 88 |
|
|
| 89 |
|
/** Vector type. */ |
| 90 |
|
typedef typename Superclass::InputVectorType InputVectorType; |
| 91 |
|
typedef typename Superclass::OutputVectorType OutputVectorType; |
| 92 |
|
|
| 93 |
|
/** CovariantVector type. */ |
| 94 |
LEN |
typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType; |
| 95 |
LEN |
typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType; |
| 96 |
|
|
| 97 |
|
/** VnlVector type. */ |
| 98 |
|
typedef typename Superclass::InputVnlVectorType InputVnlVectorType; |
| 99 |
|
typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; |
| 100 |
|
|
| 101 |
|
/** Set the transformation from a container of parameters |
| 102 |
|
* This is typically used by optimizers. |
| 103 |
|
* There are 5 parameters. The first one represents the |
| 104 |
|
* rotation, the next two the center of rotation and |
| 105 |
|
* the last two represents the offset. |
| 106 |
|
* |
| 107 |
|
* \sa Transform::SetParameters() |
| 108 |
|
* \sa Transform::SetFixedParameters() */ |
| 109 |
|
void SetParameters( const ParametersType & parameters ); |
| 110 |
|
|
| 111 |
|
/** Get the parameters that uniquely define the transform |
| 112 |
|
* This is typically used by optimizers. |
| 113 |
|
* There are 3 parameters. The first one represents the |
| 114 |
|
* rotation, the next two the center of rotation and |
| 115 |
|
* the last two represents the offset. |
| 116 |
|
* |
| 117 |
|
* \sa Transform::GetParameters() |
| 118 |
|
* \sa Transform::GetFixedParameters() */ |
| 119 |
|
const ParametersType & GetParameters( void ) const; |
| 120 |
|
|
| 121 |
|
/** This method computes the Jacobian matrix of the transformation |
| 122 |
|
* at a given input point. |
| 123 |
|
* |
| 124 |
|
* \sa Transform::GetJacobian() */ |
| 125 |
|
const JacobianType & GetJacobian(const InputPointType &point ) const; |
| 126 |
|
|
| 127 |
|
/** Set the fixed parameters and update internal transformation. |
| 128 |
|
* This is a null function as there are no fixed parameters. */ |
| 129 |
|
virtual void SetFixedParameters( const ParametersType & ); |
| 130 |
|
|
| 131 |
|
/** Get the Fixed Parameters. An empty array is returned |
| 132 |
|
* as there are no fixed parameters. */ |
| 133 |
|
virtual const ParametersType& GetFixedParameters(void) const; |
| 134 |
|
|
| 135 |
|
/** |
| 136 |
|
* This method creates and returns a new CenteredRigid2DTransform object |
| 137 |
|
* which is the inverse of self. |
| 138 |
|
**/ |
| 139 |
|
void CloneInverseTo( Pointer & newinverse ) const; |
| 140 |
|
|
| 141 |
|
/** |
| 142 |
|
* This method creates and returns a new CenteredRigid2DTransform object |
| 143 |
|
* which has the same parameters as self. |
| 144 |
|
**/ |
| 145 |
|
void CloneTo( Pointer & clone ) const; |
| 146 |
|
|
| 147 |
|
protected: |
| 148 |
|
CenteredRigid2DTransform(); |
| 149 |
|
~CenteredRigid2DTransform(){}; |
| 150 |
|
|
| 151 |
|
CenteredRigid2DTransform( unsigned int outputSpaceDimension, |
| 152 |
|
unsigned int parametersDimension); |
| 153 |
|
|
| 154 |
|
void PrintSelf(std::ostream &os, Indent indent) const; |
| 155 |
|
|
| 156 |
|
private: |
| 157 |
|
CenteredRigid2DTransform(const Self&); //purposely not implemented |
| 158 |
|
void operator=(const Self&); //purposely not implemented |
| 159 |
|
|
| 160 |
|
}; //class CenteredRigid2DTransform |
| 161 |
|
|
| 162 |
|
|
| 163 |
|
} // namespace itk |
| 164 |
|
|
| 165 |
|
|
| 166 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 167 |
|
#include "itkCenteredRigid2DTransform.txx" |
| 168 |
|
#endif |
| 169 |
|
|
| 170 |
|
#endif /* __itkCenteredRigid2DTransform_h */ |
| 171 |
|
|