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 __clitkPointListTransform_h
19 #define __clitkPointListTransform_h
20 #include "clitkList.h"
21 #include "clitkLists.h"
24 #include "itkTransform.h"
25 #include "itkVectorInterpolateImageFunction.h"
30 template < class TScalarType=double, unsigned int NDimensions=4,unsigned int NOutputDimensions=4 >
31 class ITK_EXPORT PointListTransform : public itk::Transform< TScalarType, NDimensions, NOutputDimensions >
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;
40 /** New macro for creation of through the object factory. */
43 /** Run-time type information (and related methods). */
44 itkTypeMacro( PointListTransform, Transform );
46 /** Dimension of the domain space. */
47 itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions-1);
48 itkStaticConstMacro(ImageDimension, unsigned int, NDimensions);
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;
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;}
63 /** Standard coordinate point type for this class. */
64 typedef itk::Point<TScalarType, itkGetStaticConstMacro(ImageDimension)> InputPointType;
65 typedef itk::Point<TScalarType, itkGetStaticConstMacro(ImageDimension)> OutputPointType;
68 PointListType GetCorrespondingPointList(const InputPointType &inputPoint) const;
69 OutputPointType TransformPoint(const InputPointType &point ) const;
71 // Methods needed to inherit from an itk::Transform which should not be used
73 /** Type of the input parameters. */
74 typedef typename Superclass::ParametersType ParametersType;
75 typedef typename Superclass::ParametersValueType ParametersValueType;
77 /** Type of the Jacobian matrix. */
78 typedef typename Superclass::JacobianType JacobianType;
80 /** Standard vector type for this class. */
81 typedef typename Superclass::InputVectorType InputVectorType;
82 typedef typename Superclass::OutputVectorType OutputVectorType;
84 /** Standard covariant vector type for this class */
85 typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
86 typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
88 /** Standard vnl_vector type for this class. */
89 typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
90 typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
92 void SetParameters(const ParametersType&)
94 itkExceptionMacro( << "PointListTransform doesn't declare SetParameters" );
97 void SetFixedParameters(const ParametersType&)
99 itkExceptionMacro( << "PointListTransform doesn't declare SetFixedParameters" );
102 virtual OutputVectorType TransformVector(const InputVectorType &) const
104 itkExceptionMacro(<< "Method not applicable for deformable transform." );
105 return OutputVectorType();
108 virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
110 itkExceptionMacro(<< "Method not applicable for deformable transform. ");
111 return OutputVnlVectorType();
114 virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
116 itkExceptionMacro(<< "Method not applicable for deformable transfrom. ");
117 return OutputCovariantVectorType();
120 #if ITK_VERSION_MAJOR >= 4
121 virtual void ComputeJacobianWithRespectToParameters (const InputPointType &p, JacobianType &jacobian) const
123 itkExceptionMacro( << "PointListTransform doesn't declare ComputeJacobianWithRespectToParameters" );
125 virtual void ComputeJacobianWithRespectToPosition (const InputPointType &p, JacobianType &jacobian) const
127 itkExceptionMacro( << "PointListTransform doesn't declare ComputeJacobianWithRespectToPosition" );
130 virtual const JacobianType& GetJacobian(const InputPointType &point ) const
132 itkExceptionMacro( << "PointListTransform doesn't declare GetJacobian" );
133 return this->m_Jacobian;
138 PointListTransform();
139 ~PointListTransform(){;}
142 PointListTransform(const Self&); //purposely not implemented
143 void operator=(const Self&); //purposely not implemented
145 PointListsType m_PointLists;
146 mutable PointListType m_PointList;
147 typename InterpolatorType::Pointer m_Interpolator;
150 }; //class PointListTransform
157 #ifndef ITK_MANUAL_INSTANTIATION
158 #include "clitkPointListTransform.txx"
161 #endif /* __clitkPointListTransform_h */