ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor_h
19 #define __itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor_h
20 
22 
23 namespace itk
24 {
65 template<class TTransform>
67 : public TransformParametersAdaptor<TTransform>
68 {
69 public:
70 
76 
78  itkNewMacro( Self );
79 
82 
84  typedef TTransform TransformType;
85  typedef typename TransformType::Pointer TransformPointer;
86  typedef typename TransformType::ParametersType ParametersType;
87  typedef typename TransformType::ParametersValueType ParametersValueType;
88 
90 
91  typedef typename TransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldControlPointLatticeType;
92  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::Pointer TimeVaryingVelocityFieldControlPointLatticePointer;
93  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::RegionType RegionType;
94  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::IndexType IndexType;
95  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType VectorType;
96  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PointType OriginType;
97  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SpacingType SpacingType;
98  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SizeType SizeType;
100  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SizeType MeshSizeType;
101  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::DirectionType DirectionType;
102 
104  itkStaticConstMacro( TotalDimension, unsigned int, TransformType::Dimension + 1 );
105 
107  itkSetMacro( SplineOrder, SizeValueType );
108 
110  itkGetConstMacro( SplineOrder, SizeValueType );
111 
113  void SetRequiredTransformDomainMeshSize( const MeshSizeType & );
114 
116  itkGetConstReferenceMacro( RequiredTransformDomainMeshSize, MeshSizeType );
117 
119  void SetRequiredTransformDomainSize( const SizeType & );
120 
122  itkGetConstReferenceMacro( RequiredTransformDomainSize, SizeType );
123 
125  void SetRequiredTransformDomainSpacing( const SpacingType & );
126 
128  itkGetConstReferenceMacro( RequiredTransformDomainSpacing, SpacingType );
129 
131  void SetRequiredTransformDomainOrigin( const OriginType & );
132 
134  itkGetConstReferenceMacro( RequiredTransformDomainOrigin, OriginType );
135 
137  void SetRequiredTransformDomainDirection( const DirectionType & );
138 
140  itkGetConstReferenceMacro( RequiredTransformDomainDirection, DirectionType );
141 
143  const OriginType GetRequiredControlPointLatticeOrigin() const
144  {
145  OriginType requiredLatticeOrigin;
146  for( SizeValueType i = 0; i < TotalDimension; i++ )
147  {
148  requiredLatticeOrigin[i] = this->m_RequiredFixedParameters[TotalDimension + i];
149  }
150  return requiredLatticeOrigin;
151  }
153 
155  const SpacingType GetRequiredControlPointLatticeSpacing() const
156  {
157  SpacingType requiredLatticeSpacing;
158  for( SizeValueType i = 0; i < TotalDimension; i++ )
159  {
160  RealType domainPhysicalDimensions = static_cast<RealType>( this->m_RequiredTransformDomainSize[i] - 1.0 ) *
161  this->m_RequiredTransformDomainSpacing[i];
162  requiredLatticeSpacing[i] = domainPhysicalDimensions / static_cast<RealType>( this->m_RequiredTransformDomainMeshSize[i] );
163  }
164  return requiredLatticeSpacing;
165  }
167 
169  const SizeType GetRequiredControlPointLatticeSize() const
170  {
171  SizeType requiredLatticeSize;
172  for( SizeValueType i = 0; i < TotalDimension; i++ )
173  {
174  requiredLatticeSize[i] = static_cast<SizeValueType>( this->m_RequiredFixedParameters[i] );
175  }
176  return requiredLatticeSize;
177  }
179 
181  const DirectionType GetRequiredControlPointLatticeDirection() const
182  {
183  return this->m_RequiredTransformDomainDirection;
184  }
185 
187  virtual void AdaptTransformParameters();
188 
189  virtual void SetRequiredFixedParameters( const ParametersType );
190 
191 protected:
194 
195  void PrintSelf( std::ostream& os, Indent indent ) const;
196 
197 private:
198  TimeVaryingBSplineVelocityFieldTransformParametersAdaptor( const Self & ); //purposely not implemented
199  void operator=( const Self & ); //purposely not implemented
200 
202  void UpdateRequiredFixedParameters();
203 
209 
211 
212 }; //class TimeVaryingBSplineVelocityFieldTransformParametersAdaptor
213 } // namespace itk
214 
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.hxx"
217 #endif
218 
219 #endif /* __itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor_h */
220