go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxBSplineStackTransform.h
Go to the documentation of this file.
00001 /*======================================================================
00002 
00003   This file is part of the elastix software.
00004 
00005   Copyright (c) University Medical Center Utrecht. All rights reserved.
00006   See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007   details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE. See the above copyright notices for more information.
00012 
00013 ======================================================================*/
00014 #ifndef __elxBSplineStackTransform_h
00015 #define __elxBSplineStackTransform_h
00016 
00018 #include "itkAdvancedCombinationTransform.h"
00019 #include "itkAdvancedBSplineDeformableTransform.h"
00020 #include "itkStackTransform.h"
00021 
00023 #include "itkGridScheduleComputer.h"
00024 #include "itkUpsampleBSplineParametersFilter.h"
00025 
00026 #include "elxIncludes.h"
00027 
00028 
00029 namespace elastix
00030 {
00031 using namespace itk;
00032 
00107 template < class TElastix >
00108 class BSplineStackTransform
00109   : public
00110   AdvancedCombinationTransform<
00111   ITK_TYPENAME elx::TransformBase<TElastix>::CoordRepType,
00112   elx::TransformBase<TElastix>::FixedImageDimension > ,
00113   public
00114   TransformBase<TElastix>
00115 {
00116 public:
00117 
00119   typedef BSplineStackTransform                   Self;
00120   typedef AdvancedCombinationTransform<
00121     typename elx::TransformBase<TElastix>::CoordRepType,
00122     elx::TransformBase<TElastix>::FixedImageDimension > Superclass1;
00123   typedef elx::TransformBase<TElastix>            Superclass2;
00124   typedef SmartPointer<Self>                      Pointer;
00125   typedef SmartPointer<const Self>                ConstPointer;
00126 
00128   itkNewMacro( Self );
00129 
00131   itkTypeMacro( BSplineStackTransform, AdvancedCombinationTransform );
00132 
00137   elxClassNameMacro( "BSplineStackTransform" );
00138 
00140   itkStaticConstMacro( SpaceDimension, unsigned int, Superclass2::FixedImageDimension );
00141   itkStaticConstMacro( ReducedSpaceDimension, unsigned int, Superclass2::FixedImageDimension - 1 );
00142 
00146   typedef itk::AdvancedBSplineDeformableTransformBase<
00147     typename elx::TransformBase<TElastix>::CoordRepType,
00148     itkGetStaticConstMacro( SpaceDimension ) >              BSplineTransformBaseType;
00149   typedef typename BSplineTransformBaseType::Pointer        BSplineTransformBasePointer;
00150 
00152   typedef itk::AdvancedBSplineDeformableTransformBase<
00153     typename elx::TransformBase<TElastix>::CoordRepType,
00154     itkGetStaticConstMacro( ReducedSpaceDimension ) >                  ReducedDimensionBSplineTransformBaseType;
00155   typedef typename ReducedDimensionBSplineTransformBaseType::Pointer   ReducedDimensionBSplineTransformBasePointer;
00156 
00158   typedef itk::StackTransform<
00159     typename elx::TransformBase<TElastix>::CoordRepType,
00160     itkGetStaticConstMacro( SpaceDimension ),
00161     itkGetStaticConstMacro( SpaceDimension ) >            BSplineStackTransformType;
00162   typedef typename BSplineStackTransformType::Pointer     BSplineStackTransformPointer;
00163 
00165   typedef itk::AdvancedBSplineDeformableTransform<
00166     typename elx::TransformBase<TElastix>::CoordRepType,
00167     itkGetStaticConstMacro( ReducedSpaceDimension ),
00168     1 >                                                   BSplineTransformLinearType;
00169   typedef itk::AdvancedBSplineDeformableTransform<
00170     typename elx::TransformBase<TElastix>::CoordRepType,
00171     itkGetStaticConstMacro( ReducedSpaceDimension ),
00172     2 >                                                   BSplineTransformQuadraticType;
00173   typedef itk::AdvancedBSplineDeformableTransform<
00174     typename elx::TransformBase<TElastix>::CoordRepType,
00175     itkGetStaticConstMacro( ReducedSpaceDimension ),
00176     3 >                                                   BSplineTransformCubicType;
00177 
00179   typedef typename Superclass1::ParametersType            ParametersType;
00180 
00182   typedef typename BSplineTransformBaseType::PixelType        PixelType;
00183   typedef typename BSplineTransformBaseType::ImageType        ImageType;
00184   typedef typename BSplineTransformBaseType::ImagePointer     ImagePointer;
00185   typedef typename BSplineTransformBaseType::RegionType       RegionType;
00186   typedef typename BSplineTransformBaseType::IndexType        IndexType;
00187   typedef typename BSplineTransformBaseType::SizeType         SizeType;
00188   typedef typename BSplineTransformBaseType::SpacingType      SpacingType;
00189   typedef typename BSplineTransformBaseType::OriginType       OriginType;
00190   typedef typename BSplineTransformBaseType::DirectionType    DirectionType;
00191 
00193   typedef typename Superclass2::ElastixType               ElastixType;
00194   typedef typename Superclass2::ElastixPointer            ElastixPointer;
00195   typedef typename Superclass2::ConfigurationType         ConfigurationType;
00196   typedef typename Superclass2::ConfigurationPointer      ConfigurationPointer;
00197   typedef typename Superclass2::RegistrationType          RegistrationType;
00198   typedef typename Superclass2::RegistrationPointer       RegistrationPointer;
00199   typedef typename Superclass2::CoordRepType              CoordRepType;
00200   typedef typename Superclass2::FixedImageType            FixedImageType;
00201   typedef typename Superclass2::MovingImageType           MovingImageType;
00202   typedef typename Superclass2::ITKBaseType               ITKBaseType;
00203   typedef typename Superclass2::CombinationTransformType  CombinationTransformType;
00204 
00206   typedef Image< PixelType,
00207     itkGetStaticConstMacro( ReducedSpaceDimension )>         ReducedDimensionImageType;
00208   typedef ImageRegion<
00209     itkGetStaticConstMacro( ReducedSpaceDimension ) >        ReducedDimensionRegionType;
00210   typedef typename ReducedDimensionRegionType::SizeType      ReducedDimensionSizeType;
00211   typedef typename ReducedDimensionRegionType::IndexType     ReducedDimensionIndexType;
00212   typedef typename ReducedDimensionImageType::SpacingType    ReducedDimensionSpacingType;
00213   typedef typename ReducedDimensionImageType::DirectionType  ReducedDimensionDirectionType;
00214   typedef typename ReducedDimensionImageType::PointType      ReducedDimensionOriginType;
00215 
00217   typedef GridScheduleComputer<
00218     CoordRepType, ReducedSpaceDimension >                 GridScheduleComputerType;
00219   typedef typename GridScheduleComputerType::Pointer      GridScheduleComputerPointer;
00220   typedef typename GridScheduleComputerType
00221     ::VectorGridSpacingFactorType                         GridScheduleType;
00222   typedef UpsampleBSplineParametersFilter<
00223     ParametersType, ReducedDimensionImageType >           GridUpsamplerType;
00224   typedef typename GridUpsamplerType::Pointer             GridUpsamplerPointer;
00225 
00231   virtual int BeforeAll( void );
00232 
00246   virtual void BeforeRegistration( void );
00247 
00252   virtual void BeforeEachResolution( void );
00253 
00259   virtual void InitializeTransform( void );
00260 
00267   virtual void IncreaseScale( void );
00268 
00270   virtual void ReadFromFile( void );
00271 
00273   virtual void WriteToFile( const ParametersType & param ) const;
00274 
00276   virtual void SetOptimizerScales( const unsigned int edgeWidth );
00277 
00278 protected:
00279 
00281   BSplineStackTransform();
00282 
00284   virtual ~BSplineStackTransform() {}
00285 
00287   virtual void PreComputeGridInformation( void );
00288 
00289 private:
00290 
00292   BSplineStackTransform( const Self& );  // purposely not implemented
00293   void operator=( const Self& );         // purposely not implemented
00294 
00296   BSplineStackTransformPointer  m_BSplineStackTransform;
00298   ReducedDimensionBSplineTransformBasePointer  m_BSplineDummySubTransform;
00299 
00301   GridScheduleComputerPointer   m_GridScheduleComputer;
00302   GridUpsamplerPointer          m_GridUpsampler;
00303 
00305   unsigned int m_SplineOrder;
00306 
00308   unsigned int m_NumberOfSubTransforms;
00309   double m_StackOrigin, m_StackSpacing;
00310 
00312   unsigned int InitializeBSplineTransform();
00313 
00314 }; // end class BSplineStackTransform
00315 
00316 
00317 } // end namespace elastix
00318 
00319 #ifndef ITK_MANUAL_INSTANTIATION
00320 #include "elxBSplineStackTransform.hxx"
00321 #endif
00322 
00323 #endif // end #ifndef __elxBSplineStackTransform_h
00324 


Generated on 24-10-2011 for elastix by doxygen 1.7.4 elastix logo