go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkGridScheduleComputer.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 
00015 #ifndef __itkGridScheduleComputer_H__
00016 #define __itkGridScheduleComputer_H__
00017 
00018 #include "itkObject.h"
00019 #include "itkImageBase.h"
00020 #include "itkTransform.h"
00021 
00022 namespace itk
00023 {
00024 
00037 template < typename TTransformScalarType, unsigned int VImageDimension >
00038 class ITK_EXPORT GridScheduleComputer
00039   : public Object
00040 {
00041 public:
00042 
00044   typedef GridScheduleComputer                Self;
00045   typedef Object                              Superclass;
00046   typedef SmartPointer< Self >                Pointer;
00047   typedef SmartPointer< const Self >          ConstPointer;
00048 
00050   itkNewMacro( Self );
00051 
00053   itkTypeMacro( GridScheduleComputer, Object );
00054 
00056   itkStaticConstMacro( Dimension, unsigned int, VImageDimension );
00057 
00059   typedef TTransformScalarType                  TransformScalarType;
00060   typedef ImageBase<
00061     itkGetStaticConstMacro( Dimension ) >       ImageBaseType;
00062   typedef typename ImageBaseType::PointType     PointType;
00063   typedef typename ImageBaseType::PointType     OriginType;
00064   typedef typename ImageBaseType::SpacingType   SpacingType;
00065   typedef typename ImageBaseType::DirectionType DirectionType;
00066   typedef typename ImageBaseType::SizeType      SizeType;
00067   typedef typename ImageBaseType::SizeValueType SizeValueType;
00068   typedef typename ImageBaseType::RegionType    RegionType;
00069   typedef SpacingType                           GridSpacingFactorType;
00070   typedef std::vector< OriginType >             VectorOriginType;
00071   typedef std::vector< SpacingType >            VectorSpacingType;
00072   typedef std::vector< DirectionType >          VectorDirectionType;
00073   typedef std::vector< RegionType >             VectorRegionType;
00074   typedef std::vector< GridSpacingFactorType >  VectorGridSpacingFactorType;
00075 
00077   typedef Transform<
00078     TransformScalarType,
00079     itkGetStaticConstMacro( Dimension ),
00080     itkGetStaticConstMacro( Dimension ) >       TransformType;
00081   typedef typename TransformType::Pointer       TransformPointer;
00082   typedef typename TransformType::ConstPointer  TransformConstPointer;
00083 
00085   itkSetMacro( ImageOrigin, OriginType );
00086 
00088   itkGetConstMacro( ImageOrigin, OriginType );
00089 
00091   itkSetMacro( ImageSpacing, SpacingType );
00092 
00094   itkGetConstMacro( ImageSpacing, SpacingType );
00095 
00097   itkSetMacro( ImageDirection, DirectionType );
00098 
00100   itkGetConstMacro( ImageDirection, DirectionType );
00101 
00103   itkSetMacro( ImageRegion, RegionType );
00104 
00106   itkGetConstMacro( ImageRegion, RegionType );
00107 
00109   itkSetClampMacro( BSplineOrder, unsigned int, 0, 5 );
00110 
00112   itkGetConstMacro( BSplineOrder, unsigned int );
00113 
00115   itkSetMacro( FinalGridSpacing, SpacingType );
00116 
00118   itkGetConstMacro( FinalGridSpacing, SpacingType );
00119 
00121   virtual void SetDefaultSchedule(
00122     unsigned int levels,
00123     double upsamplingFactor );
00124 
00126   virtual void SetSchedule(
00127     const VectorGridSpacingFactorType & schedule );
00128 
00130   virtual void GetSchedule( VectorGridSpacingFactorType & schedule ) const;
00131 
00133   itkSetConstObjectMacro( InitialTransform, TransformType );
00134 
00136   virtual void ComputeBSplineGrid( void );
00137 
00139   virtual void GetBSplineGrid( unsigned int level,
00140     RegionType & gridRegion,
00141     SpacingType & gridSpacing,
00142     OriginType & gridOrigin,
00143     DirectionType & gridDirection );
00144 
00145 protected:
00146 
00148   GridScheduleComputer();
00149 
00151   virtual ~GridScheduleComputer() {};
00152 
00154   VectorSpacingType     m_GridSpacings;
00155   VectorOriginType      m_GridOrigins;
00156   VectorDirectionType   m_GridDirections;
00157   VectorRegionType      m_GridRegions;
00158   TransformConstPointer m_InitialTransform;
00159   VectorGridSpacingFactorType m_GridSpacingFactors;
00160 
00162   void PrintSelf( std::ostream& os, Indent indent ) const;
00163 
00165   itkGetConstMacro( NumberOfLevels, unsigned int );
00166 
00168   virtual void ApplyInitialTransform(
00169     OriginType & imageOrigin,
00170     SpacingType & imageSpacing,
00171     DirectionType & imageDirection,
00172     SpacingType & finalGridSpacing ) const;
00173 
00174 private:
00175 
00176   GridScheduleComputer( const Self& );  // purposely not implemented
00177   void operator=( const Self& );        // purposely not implemented
00178 
00180   OriginType            m_ImageOrigin;
00181   SpacingType           m_ImageSpacing;
00182   RegionType            m_ImageRegion;
00183   DirectionType         m_ImageDirection;
00184   unsigned int          m_BSplineOrder;
00185   unsigned int          m_NumberOfLevels;
00186   SpacingType           m_FinalGridSpacing;
00187 
00189   itkSetClampMacro( UpsamplingFactor, float, 1.0, NumericTraits<float>::max() );
00190 
00192   float                 m_UpsamplingFactor;
00193 
00194 }; // end class GridScheduleComputer
00195 
00196 } // end namespace itk
00197 
00198 #ifndef ITK_MANUAL_INSTANTIATION
00199 #include "itkGridScheduleComputer.txx"
00200 #endif
00201 
00202 #endif // end #ifndef __itkGridScheduleComputer_H__
00203 


Generated on 24-05-2012 for elastix by doxygen 1.7.6.1 elastix logo