]> Creatis software - clitk.git/blob - registration/clitkShapedBLUTSpatioTemporalDeformableTransformInitializer.h
Debug RTStruct conversion with empty struc
[clitk.git] / registration / clitkShapedBLUTSpatioTemporalDeformableTransformInitializer.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://www.centreleonberard.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 __clitkShapedBLUTSpatioTemporalDeformableTransformInitializer_h
19 #define __clitkShapedBLUTSpatioTemporalDeformableTransformInitializer_h
20 #include "clitkResampleBSplineDeformableTransformImageFilter.h"
21
22 #include "itkObject.h"
23 #include "itkObjectFactory.h"
24 #include "itkImageFileReader.h"
25 #include <iostream>
26
27 namespace clitk
28 {
29
30
31 template < class TTransform, class TImage >
32 class ITK_EXPORT ShapedBLUTSpatioTemporalDeformableTransformInitializer : public itk::Object
33 {
34 public:
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;
40
41   /** New macro for creation of through a Smart Pointer. */
42   itkNewMacro( Self );
43
44   /** Run-time type information (and related methods). */
45   itkTypeMacro( ShapedBLUTSpatioTemporalDeformableTransformInitializer, Object );
46
47   // Typedefs
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;
60
61   // Set and Get
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  );
69
70   void SetSplineOrder(const unsigned int & splineOrder)
71   {
72     SizeType s;
73     s.Fill(splineOrder);
74     this->SetSplineOrders(s);
75   }
76   void SetSplineOrders(const SizeType & splineOrders)
77   {
78     m_SplineOrders=splineOrders;
79   }
80   void SetNumberOfControlPointsInsideTheImage(  SizeType & n  )
81   {
82     m_NumberOfControlPointsInsideTheImage=n;
83     m_NumberOfControlPointsIsGiven=true;
84     this->Modified();
85   }
86   void SetNumberOfControlPointsInsideTheImage(  int * n)
87   {
88     SizeType s;
89     for (unsigned int i=0;i<InputDimension;i++) 
90       s[i]=n[i];
91     this->SetNumberOfControlPointsInsideTheImage( s );
92   }
93   void SetNumberOfControlPointsInsideTheImage(  unsigned int & n )
94   {
95     SizeType s;
96     s.Fill( n );;
97     this->SetNumberOfControlPointsInsideTheImage( s );
98   }
99   void SetControlPointSpacing( SpacingType n )
100   {
101     m_ControlPointSpacing= n;
102     m_ControlPointSpacingIsGiven=true;
103     this->Modified();
104   }
105   void SetControlPointSpacing( double*& n )
106   {
107     SpacingType s( n );
108     this->SetControlPointSpacing(s);
109   }
110   void SetControlPointSpacing( double n )
111   {
112     SpacingType s;
113     s.Fill( n );
114     this->SetControlPointSpacing(s);
115   }
116   void SetSamplingFactors(  SizeType n  )
117   {
118     m_SamplingFactors=n;
119     m_SamplingFactorIsGiven=true;
120     this->Modified();
121   }
122   void SetSamplingFactors(  int *& n)
123   {
124     SizeType s;
125     for (unsigned int i=0;i<InputDimension;i++) 
126       s[i]=n[i];
127     this-> SetSamplingFactors( s );
128   }
129   void SetSamplingFactors( unsigned  int n )
130   {
131     SizeType s;
132     s.Fill( n );
133     this-> SetSamplingFactors( s );
134   }
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);
140
141   // For easy acces, declared public
142   std::vector<SizeType> m_NumberOfControlPointsInsideTheImageArray;
143   std::vector<SizeType> m_SamplingFactorsArray;
144   std::vector<SpacingType> m_ControlPointSpacingArray;
145
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;
156
157   typename TransformType::ParametersType* m_Parameters;
158
159 protected:
160   ShapedBLUTSpatioTemporalDeformableTransformInitializer();
161   ~ShapedBLUTSpatioTemporalDeformableTransformInitializer(){};
162
163 private:
164   ShapedBLUTSpatioTemporalDeformableTransformInitializer(const Self&); //purposely not implemented
165   void operator=(const Self&); //purposely not implemented
166   
167   bool m_Verbose;
168   TransformPointer    m_Transform;
169   ImagePointer        m_Image;
170   bool m_BC1;
171   bool m_BC2;
172
173 }; //class ShapedBLUTSpatioTemporalDeformableTransformInitializer
174
175
176 }  // namespace clitk
177
178
179 #ifndef ITK_MANUAL_INSTANTIATION
180 #include "clitkShapedBLUTSpatioTemporalDeformableTransformInitializer.txx"
181 #endif
182
183 #endif /* __clitkShapedBLUTSpatioTemporalDeformableTransformInitializer_h */