]> Creatis software - clitk.git/blob - registration/clitkDeformationFieldTransform.h
Debug RTStruct conversion with empty struc
[clitk.git] / registration / clitkDeformationFieldTransform.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
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"
22
23 // itk
24 #include "itkTransform.h"
25 #include "itkVectorInterpolateImageFunction.h"
26 #include "itkVectorLinearInterpolateImageFunction.h"
27
28 namespace clitk
29 {
30
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 >
33   {
34   public:
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;
40       
41     /** New macro for creation of through the object factory. */
42     itkNewMacro( Self );
43
44     /** Run-time type information (and related methods). */
45     itkTypeMacro( DeformationFieldTransform, Transform );
46
47     /** Standard coordinate point type for this class. */
48     typedef itk::Point<TScalarType, InputDimension> InputPointType;
49     typedef itk::Point<TScalarType, OutputDimension> OutputPointType;
50
51     // typedef 
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;
57
58     // Members
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;
62
63     // Methods needed to inherit from an itk::Transform which should not be used
64     // in this class
65     /** Type of the input parameters. */
66     typedef typename Superclass::ParametersType        ParametersType;
67     typedef typename Superclass::ParametersValueType   ParametersValueType;
68
69     /** Type of the Jacobian matrix. */
70     typedef typename Superclass::JacobianType           JacobianType;
71
72     /** Standard vector type for this class. */
73     typedef typename Superclass::InputVectorType InputVectorType;
74     typedef typename Superclass::OutputVectorType OutputVectorType;
75
76     /** Standard covariant vector type for this class */
77     typedef typename Superclass::InputCovariantVectorType       InputCovariantVectorType;
78     typedef typename Superclass::OutputCovariantVectorType      OutputCovariantVectorType;
79
80     /** Standard vnl_vector type for this class. */
81     typedef typename Superclass::InputVnlVectorType     InputVnlVectorType;
82     typedef typename Superclass::OutputVnlVectorType    OutputVnlVectorType;
83
84     void SetParameters(const ParametersType&)
85     {
86       itkExceptionMacro( << "DeformationFieldTransform doesn't declare SetParameters" );
87     }
88
89     void SetFixedParameters(const ParametersType&)
90     {
91       itkExceptionMacro( << "DeformationFieldTransform doesn't declare SetFixedParameters" );
92     }
93
94     virtual OutputVectorType TransformVector(const InputVectorType &) const
95     {
96       itkExceptionMacro(<< "Method not applicable for deformable transform." );
97       return OutputVectorType();
98     }
99
100     virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
101     {
102       itkExceptionMacro(<< "Method not applicable for deformable transform. ");
103       return OutputVnlVectorType();
104     }
105
106     virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
107     {
108       itkExceptionMacro(<< "Method not applicable for deformable transfrom. ");
109       return OutputCovariantVectorType();
110     }
111
112     virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const
113     {
114       itkExceptionMacro( << "DeformationFieldTransform doesn't declare ComputeJacobianWithRespectToParameters" );
115     }
116     virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
117     {
118       itkExceptionMacro( << "DeformationFieldTransform doesn't declare ComputeJacobianWithRespectToPosition" );
119     }
120
121   protected:
122     DeformationFieldTransform();
123     ~DeformationFieldTransform(){;}
124
125   private:
126     DeformationFieldTransform(const Self&); //purposely not implemented
127     void operator=(const Self&); //purposely not implemented
128
129     typename DeformationFieldType::Pointer m_DeformationField;
130     typename InterpolatorType::Pointer m_Interpolator;
131
132
133   }; //class DeformationFieldTransform
134
135
136
137 }  // namespace itk
138
139
140 #ifndef ITK_MANUAL_INSTANTIATION
141 #include "clitkDeformationFieldTransform.txx"
142 #endif
143
144 #endif /* __clitkDeformationFieldTransform_h */