]> Creatis software - clitk.git/blob - registration/clitkPointListTransform.h
Debug RTStruct conversion with empty struc
[clitk.git] / registration / clitkPointListTransform.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 __clitkPointListTransform_h
19 #define __clitkPointListTransform_h
20 #include "clitkList.h"
21 #include "clitkLists.h"
22
23 // itk
24 #include "itkTransform.h"
25 #include "itkVectorInterpolateImageFunction.h"
26
27 namespace clitk
28 {
29
30   template < class TScalarType=double, unsigned int NDimensions=4,unsigned int NOutputDimensions=4 >        
31   class ITK_EXPORT PointListTransform : public itk::Transform< TScalarType, NDimensions, NOutputDimensions >
32   {
33   public:
34     /** Standard class typedefs. */
35     typedef PointListTransform                                      Self;
36     typedef itk::Transform< TScalarType, NDimensions, NOutputDimensions > Superclass;
37     typedef itk::SmartPointer<Self>                                 Pointer;
38     typedef itk::SmartPointer<const Self>                           ConstPointer;
39       
40     /** New macro for creation of through the object factory. */
41     itkNewMacro( Self );
42
43     /** Run-time type information (and related methods). */
44     itkTypeMacro( PointListTransform, Transform );
45
46     /** Dimension of the domain space. */
47     itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions-1);
48     itkStaticConstMacro(ImageDimension, unsigned int, NDimensions);
49
50     // typedef 
51     typedef  itk::Point<double, SpaceDimension> SpacePointType;
52     typedef  itk::Point<double, ImageDimension> SpaceTimePointType;
53     typedef clitk::List<SpacePointType> PointListType;
54     typedef clitk::Lists<SpacePointType> PointListsType;
55     typedef itk::Vector<double, SpaceDimension> PointListImagePixelType;
56     typedef itk::Image<PointListImagePixelType, 1> PointListImageType; 
57     typedef itk::VectorInterpolateImageFunction<PointListImageType, double> InterpolatorType;
58
59     void SetPointList (PointListType p){m_PointList=p;}
60     void SetPointLists (PointListsType p){m_PointLists=p;}
61     void SetInterpolator (typename InterpolatorType::Pointer i){ m_Interpolator=i;}
62
63     /** Standard coordinate point type for this class. */
64     typedef itk::Point<TScalarType, itkGetStaticConstMacro(ImageDimension)> InputPointType;
65     typedef itk::Point<TScalarType, itkGetStaticConstMacro(ImageDimension)> OutputPointType;
66
67
68     PointListType GetCorrespondingPointList(const InputPointType &inputPoint) const; 
69     OutputPointType TransformPoint(const InputPointType  &point ) const;
70
71     // Methods needed to inherit from an itk::Transform which should not be used
72     // in this class
73     /** Type of the input parameters. */
74     typedef typename Superclass::ParametersType        ParametersType;
75     typedef typename Superclass::ParametersValueType   ParametersValueType;
76
77     /** Type of the Jacobian matrix. */
78     typedef typename Superclass::JacobianType           JacobianType;
79
80     /** Standard vector type for this class. */
81     typedef typename Superclass::InputVectorType InputVectorType;
82     typedef typename Superclass::OutputVectorType OutputVectorType;
83
84     /** Standard covariant vector type for this class */
85     typedef typename Superclass::InputCovariantVectorType       InputCovariantVectorType;
86     typedef typename Superclass::OutputCovariantVectorType      OutputCovariantVectorType;
87
88     /** Standard vnl_vector type for this class. */
89     typedef typename Superclass::InputVnlVectorType     InputVnlVectorType;
90     typedef typename Superclass::OutputVnlVectorType    OutputVnlVectorType;
91
92     void SetParameters(const ParametersType&)
93     {
94       itkExceptionMacro( << "PointListTransform doesn't declare SetParameters" );
95     }
96
97     void SetFixedParameters(const ParametersType&)
98     {
99       itkExceptionMacro( << "PointListTransform doesn't declare SetFixedParameters" );
100     }
101
102     virtual OutputVectorType TransformVector(const InputVectorType &) const
103     {
104       itkExceptionMacro(<< "Method not applicable for deformable transform." );
105       return OutputVectorType();
106     }
107
108     virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
109     {
110       itkExceptionMacro(<< "Method not applicable for deformable transform. ");
111       return OutputVnlVectorType();
112     }
113
114     virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
115     {
116       itkExceptionMacro(<< "Method not applicable for deformable transfrom. ");
117       return OutputCovariantVectorType();
118     }
119
120     virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const
121     {
122       itkExceptionMacro( << "PointListTransform doesn't declare ComputeJacobianWithRespectToParameters" );
123     }
124     virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
125     {
126       itkExceptionMacro( << "PointListTransform doesn't declare ComputeJacobianWithRespectToPosition" );
127     }
128
129   protected:
130     PointListTransform();
131     ~PointListTransform(){;}
132
133   private:
134     PointListTransform(const Self&); //purposely not implemented
135     void operator=(const Self&); //purposely not implemented
136
137     PointListsType m_PointLists;
138     mutable PointListType m_PointList;
139     typename InterpolatorType::Pointer m_Interpolator;
140
141
142   }; //class PointListTransform
143
144
145
146 }  // namespace itk
147
148
149 #ifndef ITK_MANUAL_INSTANTIATION
150 #include "clitkPointListTransform.txx"
151 #endif
152
153 #endif /* __clitkPointListTransform_h */