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/01/10 08:04:35 $
00007   Version:   $Revision: 1.32 $
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 "itkTransform.h"
00021 #include "itkImageFunction.h"
00022 #include "itkImageRegionIterator.h"
00023 #include "itkImageToImageFilter.h"
00024 #include "itkInterpolateImageFunction.h"
00025 #include "itkFixedArray.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::Pointer 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   itkSetObjectMacro( Transform, TransformType ); 
00125 
00127   itkGetObjectMacro( Transform, TransformType );
00128 
00135   itkSetObjectMacro( Interpolator, InterpolatorType );
00136 
00138   itkGetObjectMacro( 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 
00193   unsigned long GetMTime( void ) const;
00194 
00195 protected:
00196   ResampleImageFilter();
00197   ~ResampleImageFilter() {};
00198   void PrintSelf(std::ostream& os, Indent indent) const;
00199 
00208   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00209                             int threadId );
00210 
00211 private:
00212   ResampleImageFilter(const Self&); //purposely not implemented
00213   void operator=(const Self&); //purposely not implemented
00214 
00215   SizeType                m_Size;       // Size of the output image
00216   TransformPointerType    m_Transform;  // Coordinate transform to use
00217   InterpolatorPointerType m_Interpolator;
00218   // Image function for interpolation
00219   PixelType               m_DefaultPixelValue; 
00220   // default pixel value if the point 
00221   // is outside the image
00222   SpacingType             m_OutputSpacing; // output image spacing
00223   PointType               m_OutputOrigin;  // output image origin
00224   IndexType               m_OutputStartIndex; // output image start index
00225 
00226 };
00227 
00228   
00229 } // end namespace itk
00230   
00231 #ifndef ITK_MANUAL_INSTANTIATION
00232 #include "itkResampleImageFilter.txx"
00233 #endif
00234   
00235 #endif

Generated at Sun Jan 25 13:19:43 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000