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 __clitkMultipleBSplineDeformableTransformInitializer_h
19 #define __clitkMultipleBSplineDeformableTransformInitializer_h
20 #include "clitkResampleBSplineDeformableTransformImageFilter.h"
22 #include "itkObject.h"
23 #include "itkObjectFactory.h"
29 template < class TTransform, class TImage >
30 class ITK_EXPORT MultipleBSplineDeformableTransformInitializer : public itk::Object
33 /** Standard class typedefs. */
34 typedef MultipleBSplineDeformableTransformInitializer Self;
35 typedef itk::Object Superclass;
36 typedef itk::SmartPointer<Self> Pointer;
37 typedef itk::SmartPointer<const Self> ConstPointer;
39 /** New macro for creation of through a Smart Pointer. */
42 /** Run-time type information (and related methods). */
43 itkTypeMacro( MultipleBSplineDeformableTransformInitializer, Object );
46 typedef TTransform TransformType;
47 typedef typename TransformType::Pointer TransformPointer;
48 typedef typename TransformType::RegionType RegionType;
49 typedef typename RegionType::SizeType SizeType;
50 typedef typename TransformType::SpacingType SpacingType;
51 itkStaticConstMacro(InputDimension, unsigned int, TransformType::InputDimension);
52 typedef TImage ImageType;
53 typedef typename ImageType::ConstPointer ImagePointer;
54 typedef typename TransformType::CoefficientImageType CoefficientImageType;
55 typedef typename TransformType::ParametersType ParametersType;
58 itkBooleanMacro(Verbose);
59 itkSetMacro( Verbose, bool);
60 itkGetConstReferenceMacro( Verbose, bool);
61 itkSetObjectMacro( Transform, TransformType );
62 itkGetConstObjectMacro( Transform, TransformType );
63 itkSetObjectMacro( Image, ImageType );
64 itkGetConstObjectMacro( Image, ImageType );
65 void SetSplineOrder(const unsigned int & splineOrder)
69 this->SetSplineOrders(s);
71 void SetSplineOrders(const SizeType & splineOrders)
73 m_SplineOrders=splineOrders;
75 void SetNumberOfControlPointsInsideTheImage( SizeType & n )
77 m_NumberOfControlPointsInsideTheImage=n;
78 m_NumberOfControlPointsIsGiven=true;
81 void SetNumberOfControlPointsInsideTheImage( int * n)
84 for (unsigned int i=0;i<InputDimension;i++)
86 this->SetNumberOfControlPointsInsideTheImage( s );
88 void SetNumberOfControlPointsInsideTheImage( unsigned int & n )
92 this->SetNumberOfControlPointsInsideTheImage( s );
94 void SetControlPointSpacing( SpacingType n )
96 m_ControlPointSpacing= n;
97 m_ControlPointSpacingIsGiven=true;
100 void SetControlPointSpacing( double*& n )
103 this->SetControlPointSpacing(s);
105 void SetControlPointSpacing( double n )
109 this->SetControlPointSpacing(s);
111 void SetSamplingFactors( SizeType n )
114 m_SamplingFactorIsGiven=true;
117 void SetSamplingFactors( int *& n)
120 for (unsigned int i=0;i<InputDimension;i++)
122 this-> SetSamplingFactors( s );
124 void SetSamplingFactors( unsigned int n )
128 this-> SetSamplingFactors( s );
130 virtual void InitializeTransform();
131 void SetInitialParameters(std::vector<typename CoefficientImageType::Pointer> coefficientImage, ParametersType& params);
132 void SetInitialParameters(const std::string & s, ParametersType& params);
134 // For easy acces, declared public
135 std::vector<SizeType> m_NumberOfControlPointsInsideTheImageArray;
136 std::vector<SizeType> m_SamplingFactorsArray;
137 std::vector<SpacingType> m_ControlPointSpacingArray;
139 SpacingType m_ControlPointSpacing;
140 SizeType m_SamplingFactors;
141 SizeType m_SplineOrders;
142 SpacingType m_ChosenSpacing;
143 SizeType m_NumberOfControlPointsInsideTheImage;
144 bool m_NumberOfControlPointsIsGiven;
145 bool m_ControlPointSpacingIsGiven;
146 bool m_SamplingFactorIsGiven;
147 bool m_TransformRegionIsGiven;
149 typename TransformType::ParametersType* m_Parameters;
152 MultipleBSplineDeformableTransformInitializer();
153 ~MultipleBSplineDeformableTransformInitializer(){};
156 MultipleBSplineDeformableTransformInitializer(const Self&); //purposely not implemented
157 void operator=(const Self&); //purposely not implemented
160 TransformPointer m_Transform;
161 ImagePointer m_Image;
163 }; //class MultipleBSplineDeformableTransformInitializer
169 #ifndef ITK_MANUAL_INSTANTIATION
170 #include "clitkMultipleBSplineDeformableTransformInitializer.txx"
173 #endif /* __clitkMultipleBSplineDeformableTransformInitializer_h */