ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor_h
00019 #define __itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor_h
00020 
00021 #include "itkTransformParametersAdaptor.h"
00022 
00023 namespace itk
00024 {
00063 template<class TTransform>
00064 class ITK_EXPORT TimeVaryingBSplineVelocityFieldTransformParametersAdaptor
00065 : public TransformParametersAdaptor<TTransform>
00066 {
00067 public:
00068 
00070   typedef TimeVaryingBSplineVelocityFieldTransformParametersAdaptor   Self;
00071   typedef TransformParametersAdaptor<TTransform>                      Superclass;
00072   typedef SmartPointer<Self>                                          Pointer;
00073   typedef SmartPointer<const Self>                                    ConstPointer;
00074 
00076   itkNewMacro( Self );
00077 
00079   itkTypeMacro( TimeVaryingBSplineVelocityFieldTransformParametersAdaptor, TransformParametersAdaptor );
00080 
00082   typedef TTransform                                     TransformType;
00083   typedef typename TransformType::Pointer                TransformPointer;
00084   typedef typename TransformType::ParametersType         ParametersType;
00085   typedef typename TransformType::ParametersValueType    ParametersValueType;
00086 
00087   typedef ParametersValueType                            RealType;
00088 
00089   typedef typename TransformType::TimeVaryingVelocityFieldControlPointLatticeType   TimeVaryingVelocityFieldControlPointLatticeType;
00090   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::Pointer         TimeVaryingVelocityFieldControlPointLatticePointer;
00091   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::RegionType      RegionType;
00092   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::IndexType       IndexType;
00093   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PixelType       VectorType;
00094   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::PointType       OriginType;
00095   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SpacingType     PhysicalDimensionsType;
00096   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SizeType        SizeType;
00097   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SizeValueType   SizeValueType;
00098   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SizeType        MeshSizeType;
00099   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::DirectionType   DirectionType;
00100   typedef typename TimeVaryingVelocityFieldControlPointLatticeType::SpacingType     SpacingType;
00101 
00103   itkStaticConstMacro( TotalDimension, unsigned int, TransformType::Dimension + 1 );
00104 
00106   void SetRequiredTransformDomainMeshSize( const MeshSizeType & );
00107 
00109   itkGetConstReferenceMacro( RequiredTransformDomainMeshSize, MeshSizeType );
00110 
00112   void SetRequiredTransformDomainPhysicalDimensions( const PhysicalDimensionsType & );
00113 
00115   itkGetConstReferenceMacro( RequiredTransformDomainPhysicalDimensions, PhysicalDimensionsType );
00116 
00118   void SetRequiredTransformDomainOrigin( const OriginType & );
00119 
00121   itkGetConstReferenceMacro( RequiredTransformDomainOrigin, OriginType );
00122 
00124   void SetRequiredTransformDomainDirection( const DirectionType & );
00125 
00127   itkGetConstReferenceMacro( RequiredTransformDomainDirection, DirectionType );
00128 
00130   const OriginType GetRequiredControlPointLatticeOrigin() const
00131     {
00132     OriginType requiredLatticeOrigin;
00133     for( SizeValueType i = 0; i < TotalDimension; i++ )
00134       {
00135       requiredLatticeOrigin[i] = this->m_RequiredFixedParameters[TotalDimension + i];
00136       }
00137     return requiredLatticeOrigin;
00138     }
00140 
00142   const SpacingType GetRequiredControlPointLatticeSpacing() const
00143     {
00144     SpacingType requiredLatticeSpacing;
00145     for( SizeValueType i = 0; i < TotalDimension; i++ )
00146       {
00147       requiredLatticeSpacing[i] = this->m_RequiredFixedParameters[2 * TotalDimension + i];
00148       }
00149     return requiredLatticeSpacing;
00150     }
00152 
00154   const SizeType GetRequiredControlPointLatticeSize() const
00155     {
00156     SizeType requiredLatticeSize;
00157     for( SizeValueType i = 0; i < TotalDimension; i++ )
00158       {
00159       requiredLatticeSize[i] = static_cast<SizeValueType>( this->m_RequiredFixedParameters[i] );
00160       }
00161     return requiredLatticeSize;
00162     }
00164 
00166   const DirectionType GetRequiredControlPointLatticeDirection() const
00167     {
00168     DirectionType requiredLatticeDirection;
00169     for( SizeValueType i = 0; i < TotalDimension; i++ )
00170       {
00171       for( SizeValueType j = 0; j < TotalDimension; j++ )
00172         {
00173         requiredLatticeDirection[i][j] = this->m_RequiredFixedParameters[3 * TotalDimension + ( i * TotalDimension + j )];
00174         }
00175       }
00176     return requiredLatticeDirection;
00177     }
00179 
00181   virtual void AdaptTransformParameters();
00182 
00183   virtual void SetRequiredFixedParameters( const ParametersType );
00184 
00185 protected:
00186   TimeVaryingBSplineVelocityFieldTransformParametersAdaptor();
00187   ~TimeVaryingBSplineVelocityFieldTransformParametersAdaptor();
00188 
00189   void PrintSelf( std::ostream& os, Indent indent ) const;
00190 
00191 private:
00192   TimeVaryingBSplineVelocityFieldTransformParametersAdaptor( const Self & ); //purposely not implemented
00193   void operator=( const Self & );             //purposely not implemented
00194 
00196   void UpdateRequiredFixedParameters();
00197 
00198   MeshSizeType                               m_RequiredTransformDomainMeshSize;
00199   OriginType                                 m_RequiredTransformDomainOrigin;
00200   DirectionType                              m_RequiredTransformDomainDirection;
00201   PhysicalDimensionsType                     m_RequiredTransformDomainPhysicalDimensions;
00202 
00203 }; //class TimeVaryingBSplineVelocityFieldTransformParametersAdaptor
00204 }  // namespace itk
00205 
00206 #ifndef ITK_MANUAL_INSTANTIATION
00207 #include "itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.hxx"
00208 #endif
00209 
00210 #endif /* __itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor_h */
00211