Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkWarpImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkWarpImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-10-29 11:19:00 $
00007   Version:   $Revision: 1.31 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkWarpImageFilter_h
00018 #define __itkWarpImageFilter_h
00019 #include "itkImageBase.h"
00020 #include "itkImageToImageFilter.h"
00021 #include "itkInterpolateImageFunction.h"
00022 #include "itkLinearInterpolateImageFunction.h"
00023 #include "itkPoint.h"
00024 #include "itkFixedArray.h"
00025 
00026 namespace itk
00027 {
00028 
00081 template <
00082   class TInputImage,
00083   class TOutputImage,
00084   class TDeformationField
00085   >
00086 class ITK_EXPORT WarpImageFilter :
00087     public ImageToImageFilter<TInputImage, TOutputImage>
00088 {
00089 public:
00091   typedef WarpImageFilter                              Self;
00092   typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00093   typedef SmartPointer<Self>                           Pointer;
00094   typedef SmartPointer<const Self>                     ConstPointer;
00095 
00097   itkNewMacro(Self);
00098 
00100   itkTypeMacro( WarpImageFilter, ImageToImageFilter );
00101 
00103   typedef typename TOutputImage::RegionType OutputImageRegionType;
00104 
00106   typedef typename Superclass::InputImageType         InputImageType;
00107   typedef typename Superclass::InputImagePointer      InputImagePointer;
00108   typedef typename Superclass::OutputImageType        OutputImageType;
00109   typedef typename Superclass::OutputImagePointer     OutputImagePointer;
00110   typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00111   typedef typename OutputImageType::IndexType         IndexType;
00112   typedef typename OutputImageType::IndexValueType    IndexValueType;
00113   typedef typename OutputImageType::SizeType          SizeType;
00114   typedef typename OutputImageType::PixelType         PixelType;
00115   typedef typename OutputImageType::SpacingType       SpacingType;
00116 
00118   itkStaticConstMacro(ImageDimension, unsigned int,
00119                       TOutputImage::ImageDimension );
00120   itkStaticConstMacro(InputImageDimension, unsigned int,
00121                       TInputImage::ImageDimension );
00122   itkStaticConstMacro(DeformationFieldDimension, unsigned int,
00123                       TDeformationField::ImageDimension );
00124 
00126   typedef ImageBase<itkGetStaticConstMacro(ImageDimension)> ImageBaseType;
00127 
00129   typedef TDeformationField                        DeformationFieldType;
00130   typedef typename DeformationFieldType::Pointer   DeformationFieldPointer;
00131   typedef typename DeformationFieldType::PixelType DisplacementType;
00132 
00134   typedef double                                                CoordRepType;
00135   typedef InterpolateImageFunction<InputImageType,CoordRepType> InterpolatorType;
00136   typedef typename InterpolatorType::Pointer                    InterpolatorPointer;
00137   typedef LinearInterpolateImageFunction<InputImageType,CoordRepType>
00138                                                                 DefaultInterpolatorType;
00139 
00141   typedef Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
00142 
00144   typedef typename TOutputImage::DirectionType     DirectionType;
00145 
00147   void SetDeformationField( const DeformationFieldType * field );
00148 
00150   DeformationFieldType * GetDeformationField(void);
00151 
00153   itkSetObjectMacro( Interpolator, InterpolatorType );
00154 
00156   itkGetObjectMacro( Interpolator, InterpolatorType );
00157 
00159   itkSetMacro(OutputSpacing, SpacingType);
00160   virtual void SetOutputSpacing( const double* values);
00162 
00164   itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00165 
00167   itkSetMacro(OutputOrigin, PointType);
00168   virtual void SetOutputOrigin( const double* values);
00170 
00172   itkGetConstReferenceMacro(OutputOrigin, PointType);
00173 
00175   itkSetMacro(OutputDirection, DirectionType );
00176   itkGetConstReferenceMacro(OutputDirection, DirectionType );
00178 
00180   void SetOutputParametersFromImage ( const ImageBaseType *image );
00181 
00184   itkSetMacro( OutputStartIndex, IndexType );
00185 
00187   itkGetConstReferenceMacro( OutputStartIndex, IndexType );
00188 
00190   itkSetMacro( OutputSize, SizeType );
00191 
00193   itkGetConstReferenceMacro( OutputSize, SizeType );
00194 
00196   itkSetMacro( EdgePaddingValue, PixelType );
00197 
00199   itkGetConstMacro( EdgePaddingValue, PixelType );
00200 
00206   virtual void GenerateOutputInformation();
00207 
00214   virtual void GenerateInputRequestedRegion();
00215 
00218   virtual void BeforeThreadedGenerateData();
00219 
00222   virtual void AfterThreadedGenerateData();
00223 
00224 #ifdef ITK_USE_CONCEPT_CHECKING
00225 
00226   itkConceptMacro(SameDimensionCheck1,
00227     (Concept::SameDimension<ImageDimension, InputImageDimension>));
00228   itkConceptMacro(SameDimensionCheck2,
00229     (Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
00230   itkConceptMacro(InputHasNumericTraitsCheck,
00231     (Concept::HasNumericTraits<typename TInputImage::PixelType>));
00232   itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
00233     (Concept::HasNumericTraits<typename TDeformationField::PixelType::ValueType>));
00234 
00236 #endif
00237 
00238 protected:
00239   WarpImageFilter();
00240   ~WarpImageFilter() {};
00241   void PrintSelf(std::ostream& os, Indent indent) const;
00242 
00246   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00247                             int threadId );
00248 
00249 private:
00250   WarpImageFilter(const Self&); //purposely not implemented
00251   void operator=(const Self&); //purposely not implemented
00252 
00256   DisplacementType EvaluateDeformationAtPhysicalPoint(const PointType &p);
00257 
00258   PixelType                  m_EdgePaddingValue;
00259   SpacingType                m_OutputSpacing;
00260   PointType                  m_OutputOrigin;
00261   DirectionType              m_OutputDirection;
00262 
00263   InterpolatorPointer        m_Interpolator;
00264   SizeType                   m_OutputSize;        // Size of the output image
00265   IndexType                  m_OutputStartIndex;  // output image start index
00266   bool                       m_DefFieldSizeSame;
00267   // variables for deffield interpoator
00268   IndexType m_StartIndex,m_EndIndex;
00269 
00270 
00271 };
00272 
00273 } // end namespace itk
00274 
00275 #ifndef ITK_MANUAL_INSTANTIATION
00276 #include "itkWarpImageFilter.txx"
00277 #endif
00278 
00279 #endif
00280 

Generated at Fri Apr 16 20:02:10 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000