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 __clitkShapedBLUTSpatioTemporalDeformableTransformInitializer_h
19 #define __clitkShapedBLUTSpatioTemporalDeformableTransformInitializer_h
20 #include "clitkResampleBSplineDeformableTransformImageFilter.h"
22 #include "itkObject.h"
23 #include "itkObjectFactory.h"
24 #include "itkImageFileReader.h"
31 template < class TTransform, class TImage >
32 class ITK_EXPORT ShapedBLUTSpatioTemporalDeformableTransformInitializer : public itk::Object
35 /** Standard class typedefs. */
36 typedef ShapedBLUTSpatioTemporalDeformableTransformInitializer Self;
37 typedef itk::Object Superclass;
38 typedef itk::SmartPointer<Self> Pointer;
39 typedef itk::SmartPointer<const Self> ConstPointer;
41 /** New macro for creation of through a Smart Pointer. */
44 /** Run-time type information (and related methods). */
45 itkTypeMacro( ShapedBLUTSpatioTemporalDeformableTransformInitializer, Object );
48 typedef TTransform TransformType;
49 typedef typename TransformType::Pointer TransformPointer;
50 typedef typename TransformType::RegionType RegionType;
51 typedef typename TransformType::OriginType OriginType;
52 typedef typename TransformType::DirectionType DirectionType;
53 typedef typename RegionType::SizeType SizeType;
54 typedef typename TransformType::SpacingType SpacingType;
55 itkStaticConstMacro(InputDimension, unsigned int, TransformType::InputDimension);
56 typedef TImage ImageType;
57 typedef typename ImageType::ConstPointer ImagePointer;
58 typedef typename TransformType::CoefficientImageType CoefficientImageType;
59 typedef typename TransformType::ParametersType ParametersType;
62 itkBooleanMacro(Verbose);
63 itkSetMacro( Verbose, bool);
64 itkGetConstReferenceMacro( Verbose, bool);
65 itkSetObjectMacro( Transform, TransformType );
66 itkGetConstObjectMacro( Transform, TransformType );
67 itkSetObjectMacro( Image, ImageType );
68 itkGetConstObjectMacro( Image, ImageType );
70 void SetSplineOrder(const unsigned int & splineOrder)
74 this->SetSplineOrders(s);
76 void SetSplineOrders(const SizeType & splineOrders)
78 m_SplineOrders=splineOrders;
80 void SetNumberOfControlPointsInsideTheImage( SizeType & n )
82 m_NumberOfControlPointsInsideTheImage=n;
83 m_NumberOfControlPointsIsGiven=true;
86 void SetNumberOfControlPointsInsideTheImage( int * n)
89 for (unsigned int i=0;i<InputDimension;i++)
91 this->SetNumberOfControlPointsInsideTheImage( s );
93 void SetNumberOfControlPointsInsideTheImage( unsigned int & n )
97 this->SetNumberOfControlPointsInsideTheImage( s );
99 void SetControlPointSpacing( SpacingType n )
101 m_ControlPointSpacing= n;
102 m_ControlPointSpacingIsGiven=true;
105 void SetControlPointSpacing( double*& n )
108 this->SetControlPointSpacing(s);
110 void SetControlPointSpacing( double n )
114 this->SetControlPointSpacing(s);
116 void SetSamplingFactors( SizeType n )
119 m_SamplingFactorIsGiven=true;
122 void SetSamplingFactors( int *& n)
125 for (unsigned int i=0;i<InputDimension;i++)
127 this-> SetSamplingFactors( s );
129 void SetSamplingFactors( unsigned int n )
133 this-> SetSamplingFactors( s );
135 virtual void InitializeTransform();
136 void SetInitialParameters(const typename CoefficientImageType::Pointer coefficientImage, ParametersType& params);
137 void SetInitialParameters(const std::string & s, ParametersType& params);
138 // void SetInitialPaddedParameters(const typename CoefficientImageType::Pointer coefficientImage, ParametersType& params);
139 // void SetInitialPaddedParameters(const std::string & s, ParametersType& params);
141 // For easy acces, declared public
142 std::vector<SizeType> m_NumberOfControlPointsInsideTheImageArray;
143 std::vector<SizeType> m_SamplingFactorsArray;
144 std::vector<SpacingType> m_ControlPointSpacingArray;
146 SpacingType m_ControlPointSpacing;
147 SizeType m_SamplingFactors;
148 SizeType m_SplineOrders;
149 SpacingType m_ChosenSpacing;
150 SizeType m_NumberOfControlPointsInsideTheImage;
151 bool m_NumberOfControlPointsIsGiven;
152 bool m_ControlPointSpacingIsGiven;
153 bool m_SamplingFactorIsGiven;
154 bool m_TransformRegionIsGiven;
155 unsigned int m_TrajectoryShape;
157 typename TransformType::ParametersType* m_Parameters;
160 ShapedBLUTSpatioTemporalDeformableTransformInitializer();
161 ~ShapedBLUTSpatioTemporalDeformableTransformInitializer(){};
164 ShapedBLUTSpatioTemporalDeformableTransformInitializer(const Self&); //purposely not implemented
165 void operator=(const Self&); //purposely not implemented
168 TransformPointer m_Transform;
169 ImagePointer m_Image;
173 }; //class ShapedBLUTSpatioTemporalDeformableTransformInitializer
179 #ifndef ITK_MANUAL_INSTANTIATION
180 #include "clitkShapedBLUTSpatioTemporalDeformableTransformInitializer.txx"
183 #endif /* __clitkShapedBLUTSpatioTemporalDeformableTransformInitializer_h */