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