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

itkResampleImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkResampleImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/04/22 16:14:32 $
00007   Version:   $Revision: 1.35 $
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 __itkResampleImageFilter_h
00018 #define __itkResampleImageFilter_h
00019 
00020 #include "itkFixedArray.h"
00021 #include "itkTransform.h"
00022 #include "itkImageFunction.h"
00023 #include "itkImageRegionIterator.h"
00024 #include "itkImageToImageFilter.h"
00025 #include "itkInterpolateImageFunction.h"
00026 #include "itkSize.h"
00027 
00028 namespace itk
00029 {
00030 
00061 template <class TInputImage, class TOutputImage, class TInterpolatorPrecisionType=double>
00062 class ITK_EXPORT ResampleImageFilter:
00063     public ImageToImageFilter<TInputImage, TOutputImage>
00064 {
00065 public:
00067   typedef ResampleImageFilter         Self;
00068   typedef ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
00069   typedef SmartPointer<Self>        Pointer;
00070   typedef SmartPointer<const Self>  ConstPointer;
00071   typedef TInputImage InputImageType;
00072   typedef TOutputImage OutputImageType;
00073   typedef typename InputImageType::Pointer InputImagePointer;
00074   typedef typename OutputImageType::Pointer OutputImagePointer;
00075   typedef typename InputImageType::RegionType InputImageRegionType;
00076 
00078   itkNewMacro(Self);  
00079 
00081   itkTypeMacro(ResampleImageFilter, ImageToImageFilter);
00082 
00084   itkStaticConstMacro(ImageDimension, unsigned int,
00085                       TOutputImage::ImageDimension);
00086 
00092   typedef Transform<TInterpolatorPrecisionType, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> TransformType;
00093   typedef typename TransformType::ConstPointer TransformPointerType;
00094 
00096   typedef InterpolateImageFunction<InputImageType, TInterpolatorPrecisionType> InterpolatorType;
00097   typedef typename InterpolatorType::Pointer  InterpolatorPointerType;
00098 
00100   typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType;
00101 
00103   typedef typename TOutputImage::IndexType IndexType;
00104 
00106   typedef typename InterpolatorType::PointType    PointType;
00107   //typedef typename TOutputImage::PointType    PointType;
00108 
00110   typedef typename TOutputImage::PixelType   PixelType;
00111 
00113   typedef typename TOutputImage::RegionType OutputImageRegionType;
00114 
00116   typedef typename TOutputImage::SpacingType SpacingType;
00117   typedef typename TOutputImage::PointType   OriginPointType;
00118   
00124   itkSetConstObjectMacro( Transform, TransformType ); 
00125 
00127   itkGetConstObjectMacro( Transform, TransformType );
00128 
00135   itkSetObjectMacro( Interpolator, InterpolatorType );
00136 
00138   itkGetConstObjectMacro( Interpolator, InterpolatorType );
00139 
00141   itkSetMacro( Size, SizeType );
00142 
00144   itkGetConstReferenceMacro( Size, SizeType );
00145      
00148   itkSetMacro(DefaultPixelValue,PixelType);
00149 
00151   itkGetMacro(DefaultPixelValue,PixelType);
00152 
00154   itkSetMacro(OutputSpacing, SpacingType);
00155   virtual void SetOutputSpacing( const double values[ImageDimension] );
00156 
00158   itkGetConstReferenceMacro( OutputSpacing, SpacingType );
00159 
00161   itkSetMacro(OutputOrigin, PointType);
00162   virtual void SetOutputOrigin( const double values[ImageDimension] );
00163 
00165   itkGetConstReferenceMacro( OutputOrigin, PointType );
00166 
00169   itkSetMacro( OutputStartIndex, IndexType );
00170 
00172   itkGetConstReferenceMacro( OutputStartIndex, IndexType );
00173 
00179   virtual void GenerateOutputInformation();
00180 
00186   virtual void GenerateInputRequestedRegion();
00187 
00190   virtual void BeforeThreadedGenerateData();
00191 
00194   virtual void AfterThreadedGenerateData();
00195 
00197   unsigned long GetMTime( void ) const;
00198 
00199 protected:
00200   ResampleImageFilter();
00201   ~ResampleImageFilter() {};
00202   void PrintSelf(std::ostream& os, Indent indent) const;
00203 
00212   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00213                             int threadId );
00214 
00215 private:
00216   ResampleImageFilter(const Self&); //purposely not implemented
00217   void operator=(const Self&); //purposely not implemented
00218 
00219   SizeType                m_Size;       // Size of the output image
00220   TransformPointerType    m_Transform;  // Coordinate transform to use
00221   InterpolatorPointerType m_Interpolator; // Image function for interpolation
00222   PixelType               m_DefaultPixelValue; // default pixel value if the point 
00223                                                // is outside the image
00224   SpacingType             m_OutputSpacing; // output image spacing
00225   PointType               m_OutputOrigin;  // output image origin
00226   IndexType               m_OutputStartIndex; // output image start index
00227 
00228 };
00229 
00230   
00231 } // end namespace itk
00232   
00233 #ifndef ITK_MANUAL_INSTANTIATION
00234 #include "itkResampleImageFilter.txx"
00235 #endif
00236   
00237 #endif

Generated at Wed Mar 30 00:09:04 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000