ITK  4.2.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 {
63 template<class TTransform>
65 : public TransformParametersAdaptor<TTransform>
66 {
67 public:
68 
74 
76  itkNewMacro( Self );
77 
80 
82  typedef TTransform TransformType;
83  typedef typename TransformType::Pointer TransformPointer;
84  typedef typename TransformType::ParametersType ParametersType;
85  typedef typename TransformType::ParametersValueType ParametersValueType;
86 
88 
89  typedef typename TransformType::TimeVaryingVelocityFieldControlPointLatticeType TimeVaryingVelocityFieldControlPointLatticeType;
90  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::Pointer TimeVaryingVelocityFieldControlPointLatticePointer;
91  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::RegionType RegionType;
92  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::IndexType IndexType;
93  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType VectorType;
94  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PointType OriginType;
95  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SpacingType PhysicalDimensionsType;
96  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SizeType SizeType;
98  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SizeType MeshSizeType;
99  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::DirectionType DirectionType;
100  typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SpacingType SpacingType;
101 
103  itkStaticConstMacro( TotalDimension, unsigned int, TransformType::Dimension + 1 );
104 
106  void SetRequiredTransformDomainMeshSize( const MeshSizeType & );
107 
109  itkGetConstReferenceMacro( RequiredTransformDomainMeshSize, MeshSizeType );
110 
112  void SetRequiredTransformDomainPhysicalDimensions( const PhysicalDimensionsType & );
113 
115  itkGetConstReferenceMacro( RequiredTransformDomainPhysicalDimensions, PhysicalDimensionsType );
116 
118  void SetRequiredTransformDomainOrigin( const OriginType & );
119 
121  itkGetConstReferenceMacro( RequiredTransformDomainOrigin, OriginType );
122 
124  void SetRequiredTransformDomainDirection( const DirectionType & );
125 
127  itkGetConstReferenceMacro( RequiredTransformDomainDirection, DirectionType );
128 
130  const OriginType GetRequiredControlPointLatticeOrigin() const
131  {
132  OriginType requiredLatticeOrigin;
133  for( SizeValueType i = 0; i < TotalDimension; i++ )
134  {
135  requiredLatticeOrigin[i] = this->m_RequiredFixedParameters[TotalDimension + i];
136  }
137  return requiredLatticeOrigin;
138  }
140 
142  const SpacingType GetRequiredControlPointLatticeSpacing() const
143  {
144  SpacingType requiredLatticeSpacing;
145  for( SizeValueType i = 0; i < TotalDimension; i++ )
146  {
147  requiredLatticeSpacing[i] = this->m_RequiredFixedParameters[2 * TotalDimension + i];
148  }
149  return requiredLatticeSpacing;
150  }
152 
154  const SizeType GetRequiredControlPointLatticeSize() const
155  {
156  SizeType requiredLatticeSize;
157  for( SizeValueType i = 0; i < TotalDimension; i++ )
158  {
159  requiredLatticeSize[i] = static_cast<SizeValueType>( this->m_RequiredFixedParameters[i] );
160  }
161  return requiredLatticeSize;
162  }
164 
166  const DirectionType GetRequiredControlPointLatticeDirection() const
167  {
168  DirectionType requiredLatticeDirection;
169  for( SizeValueType i = 0; i < TotalDimension; i++ )
170  {
171  for( SizeValueType j = 0; j < TotalDimension; j++ )
172  {
173  requiredLatticeDirection[i][j] = this->m_RequiredFixedParameters[3 * TotalDimension + ( i * TotalDimension + j )];
174  }
175  }
176  return requiredLatticeDirection;
177  }
179 
181  virtual void AdaptTransformParameters();
182 
183  virtual void SetRequiredFixedParameters( const ParametersType );
184 
185 protected:
188 
189  void PrintSelf( std::ostream& os, Indent indent ) const;
190 
191 private:
192  TimeVaryingBSplineVelocityFieldTransformParametersAdaptor( const Self & ); //purposely not implemented
193  void operator=( const Self & ); //purposely not implemented
194 
196  void UpdateRequiredFixedParameters();
197 
202 
203 }; //class TimeVaryingBSplineVelocityFieldTransformParametersAdaptor
204 } // namespace itk
205 
206 #ifndef ITK_MANUAL_INSTANTIATION
207 #include "itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.hxx"
208 #endif
209 
210 #endif /* __itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor_h */
211