]> Creatis software - clitk.git/blob - registration/clitkPointListTransform.h
small bugs corrections
[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://oncora1.lyon.fnclcc.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   protected:
72     PointListTransform();
73     ~PointListTransform(){;}
74
75   private:
76     PointListTransform(const Self&); //purposely not implemented
77     void operator=(const Self&); //purposely not implemented
78
79     PointListsType m_PointLists;
80     mutable PointListType m_PointList;
81     typename InterpolatorType::Pointer m_Interpolator;
82
83
84   }; //class PointListTransform
85
86
87
88 }  // namespace itk
89
90
91 #ifndef ITK_MANUAL_INSTANTIATION
92 #include "clitkPointListTransform.txx"
93 #endif
94
95 #endif /* __clitkPointListTransform_h */