1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef __clitkDeformationFieldTransform_h
19 #define __clitkDeformationFieldTransform_h
20 #include "clitkList.h"
21 #include "clitkLists.h"
24 #include "itkTransform.h"
25 #include "itkVectorInterpolateImageFunction.h"
26 #include "itkVectorLinearInterpolateImageFunction.h"
31 template < class TScalarType=double, unsigned int InputDimension=4,unsigned int OutputDimension=4, unsigned int SpaceDimension=3 >
32 class ITK_EXPORT DeformationFieldTransform : public itk::Transform< TScalarType, InputDimension, OutputDimension >
35 /** Standard class typedefs. */
36 typedef DeformationFieldTransform Self;
37 typedef itk::Transform< TScalarType, InputDimension, OutputDimension > Superclass;
38 typedef itk::SmartPointer<Self> Pointer;
39 typedef itk::SmartPointer<const Self> ConstPointer;
41 /** New macro for creation of through the object factory. */
44 /** Run-time type information (and related methods). */
45 itkTypeMacro( DeformationFieldTransform, Transform );
47 /** Standard coordinate point type for this class. */
48 typedef itk::Point<TScalarType, InputDimension> InputPointType;
49 typedef itk::Point<TScalarType, OutputDimension> OutputPointType;
52 typedef itk::Point<double, SpaceDimension> SpacePointType;
53 typedef itk::Vector<double, SpaceDimension> DisplacementType;
54 typedef itk::Image<DisplacementType, InputDimension> DeformationFieldType;
55 typedef itk::VectorInterpolateImageFunction<DeformationFieldType, double> InterpolatorType;
56 typedef itk::VectorLinearInterpolateImageFunction<DeformationFieldType, double> DefaultInterpolatorType;
59 void SetDeformationField (typename DeformationFieldType::Pointer p){m_DeformationField=p; m_Interpolator->SetInputImage(m_DeformationField);}
60 void SetInterpolator (typename InterpolatorType::Pointer i){ m_Interpolator=i; m_Interpolator->SetInputImage(m_DeformationField);}
61 OutputPointType TransformPoint(const InputPointType &point ) const;
63 // Methods needed to inherit from an itk::Transform which should not be used
65 /** Type of the input parameters. */
66 typedef typename Superclass::ParametersType ParametersType;
67 typedef typename Superclass::ParametersValueType ParametersValueType;
69 /** Type of the Jacobian matrix. */
70 typedef typename Superclass::JacobianType JacobianType;
72 /** Standard vector type for this class. */
73 typedef typename Superclass::InputVectorType InputVectorType;
74 typedef typename Superclass::OutputVectorType OutputVectorType;
76 /** Standard covariant vector type for this class */
77 typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
78 typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
80 /** Standard vnl_vector type for this class. */
81 typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
82 typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
84 void SetParameters(const ParametersType&)
86 itkExceptionMacro( << "DeformationFieldTransform doesn't declare SetParameters" );
89 void SetFixedParameters(const ParametersType&)
91 itkExceptionMacro( << "DeformationFieldTransform doesn't declare SetFixedParameters" );
94 virtual OutputVectorType TransformVector(const InputVectorType &) const
96 itkExceptionMacro(<< "Method not applicable for deformable transform." );
97 return OutputVectorType();
100 virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
102 itkExceptionMacro(<< "Method not applicable for deformable transform. ");
103 return OutputVnlVectorType();
106 virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
108 itkExceptionMacro(<< "Method not applicable for deformable transfrom. ");
109 return OutputCovariantVectorType();
112 #if ITK_VERSION_MAJOR >= 4
113 virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const
115 itkExceptionMacro( << "DeformationFieldTransform doesn't declare ComputeJacobianWithRespectToParameters" );
117 virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
119 itkExceptionMacro( << "DeformationFieldTransform doesn't declare ComputeJacobianWithRespectToPosition" );
122 virtual const JacobianType& GetJacobian(const InputPointType &point ) const
124 itkExceptionMacro( << "DeformationFieldTransform doesn't declare GetJacobian" );
125 return this->m_Jacobian;
130 DeformationFieldTransform();
131 ~DeformationFieldTransform(){;}
134 DeformationFieldTransform(const Self&); //purposely not implemented
135 void operator=(const Self&); //purposely not implemented
137 typename DeformationFieldType::Pointer m_DeformationField;
138 typename InterpolatorType::Pointer m_Interpolator;
141 }; //class DeformationFieldTransform
148 #ifndef ITK_MANUAL_INSTANTIATION
149 #include "clitkDeformationFieldTransform.txx"
152 #endif /* __clitkDeformationFieldTransform_h */