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://oncora1.lyon.fnclcc.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 __clitkBSplineDeformableTransformInitializer_h
19 #define __clitkBSplineDeformableTransformInitializer_h
20 #include "clitkResampleBSplineDeformableTransformImageFilter.h"
22 #include "itkObject.h"
23 #include "itkObjectFactory.h"
30 template < class TTransform, class TImage >
31 class ITK_EXPORT BSplineDeformableTransformInitializer : public itk::Object
34 /** Standard class typedefs. */
35 typedef BSplineDeformableTransformInitializer Self;
36 typedef itk::Object Superclass;
37 typedef itk::SmartPointer<Self> Pointer;
38 typedef itk::SmartPointer<const Self> ConstPointer;
40 /** New macro for creation of through a Smart Pointer. */
43 /** Run-time type information (and related methods). */
44 itkTypeMacro( BSplineDeformableTransformInitializer, Object );
47 typedef TTransform TransformType;
48 typedef typename TransformType::Pointer TransformPointer;
49 typedef typename TransformType::RegionType RegionType;
50 typedef typename RegionType::SizeType SizeType;
51 typedef typename TransformType::SpacingType SpacingType;
52 itkStaticConstMacro(InputDimension, unsigned int, TransformType::InputDimension);
53 typedef TImage ImageType;
54 typedef typename ImageType::ConstPointer ImagePointer;
55 typedef typename TransformType::CoefficientImageType CoefficientImageType;
56 typedef typename TransformType::ParametersType ParametersType;
59 itkBooleanMacro(Verbose);
60 itkSetMacro( Verbose, bool);
61 itkGetConstReferenceMacro( Verbose, bool);
62 itkSetObjectMacro( Transform, TransformType );
63 itkGetConstObjectMacro( Transform, TransformType );
64 itkSetObjectMacro( Image, ImageType );
65 itkGetConstObjectMacro( Image, ImageType );
66 void SetSplineOrder(const unsigned int & splineOrder)
70 this->SetSplineOrders(s);
72 void SetSplineOrders(const SizeType & splineOrders)
74 m_SplineOrders=splineOrders;
76 void SetNumberOfControlPointsInsideTheImage( SizeType & n )
78 m_NumberOfControlPointsInsideTheImage=n;
79 m_NumberOfControlPointsIsGiven=true;
82 void SetNumberOfControlPointsInsideTheImage( int * n)
85 for (unsigned int i=0;i<InputDimension;i++)
87 this->SetNumberOfControlPointsInsideTheImage( s );
89 void SetNumberOfControlPointsInsideTheImage( unsigned int & n )
93 this->SetNumberOfControlPointsInsideTheImage( s );
95 void SetControlPointSpacing( SpacingType n )
97 m_ControlPointSpacing= n;
98 m_ControlPointSpacingIsGiven=true;
101 void SetControlPointSpacing( double*& n )
104 this->SetControlPointSpacing(s);
106 void SetControlPointSpacing( double n )
110 this->SetControlPointSpacing(s);
112 void SetSamplingFactors( SizeType n )
115 m_SamplingFactorIsGiven=true;
118 void SetSamplingFactors( int *& n)
121 for (unsigned int i=0;i<InputDimension;i++)
123 this-> SetSamplingFactors( s );
125 void SetSamplingFactors( unsigned int n )
129 this-> SetSamplingFactors( s );
131 virtual void InitializeTransform();
132 void SetInitialParameters(const typename CoefficientImageType::Pointer coefficientImage, ParametersType& params);
133 void SetInitialParameters(const std::string & s, ParametersType& params);
135 // For easy acces, declared public
136 std::vector<SizeType> m_NumberOfControlPointsInsideTheImageArray;
137 std::vector<SizeType> m_SamplingFactorsArray;
138 std::vector<SpacingType> m_ControlPointSpacingArray;
140 SpacingType m_ControlPointSpacing;
141 SizeType m_SamplingFactors;
142 SizeType m_SplineOrders;
143 SpacingType m_ChosenSpacing;
144 SizeType m_NumberOfControlPointsInsideTheImage;
145 bool m_NumberOfControlPointsIsGiven;
146 bool m_ControlPointSpacingIsGiven;
147 bool m_SamplingFactorIsGiven;
148 bool m_TransformRegionIsGiven;
150 typename TransformType::ParametersType* m_Parameters;
153 BSplineDeformableTransformInitializer();
154 ~BSplineDeformableTransformInitializer(){};
157 BSplineDeformableTransformInitializer(const Self&); //purposely not implemented
158 void operator=(const Self&); //purposely not implemented
161 TransformPointer m_Transform;
162 ImagePointer m_Image;
164 }; //class BSplineDeformableTransformInitializer
170 #ifndef ITK_MANUAL_INSTANTIATION
171 #include "clitkBSplineDeformableTransformInitializer.txx"
174 #endif /* __clitkBSplineDeformableTransformInitializer_h */