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: 2002/09/30 15:24:40 $
00007   Version:   $Revision: 1.21 $
00008 
00009   Copyright (c) 2002 Insight 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 "itkSize.h"
00026 
00027 namespace itk
00028 {
00029 
00051 template <class TInputImage, class TOutputImage>
00052 class ITK_EXPORT ResampleImageFilter:
00053     public ImageToImageFilter<TInputImage, TOutputImage>
00054 {
00055 public:
00057   typedef ResampleImageFilter         Self;
00058   typedef ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
00059   typedef SmartPointer<Self>        Pointer;
00060   typedef SmartPointer<const Self>  ConstPointer;
00061   typedef TInputImage InputImageType;
00062   typedef TOutputImage OutputImageType;
00063   typedef typename InputImageType::Pointer InputImagePointer;
00064   typedef typename OutputImageType::Pointer OutputImagePointer;
00065   typedef typename InputImageType::RegionType InputImageRegionType;
00066 
00068   itkNewMacro(Self);  
00069 
00071   itkTypeMacro(ResampleImageFilter, ImageToImageFilter);
00072 
00074   itkStaticConstMacro(ImageDimension, unsigned int,
00075                       TOutputImage::ImageDimension);
00076 
00082   typedef Transform<double, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> TransformType;
00083   typedef typename TransformType::Pointer TransformPointerType;
00084 
00086   typedef InterpolateImageFunction<InputImageType, double> InterpolatorType;
00087   typedef typename InterpolatorType::Pointer  InterpolatorPointerType;
00088 
00090   typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType;
00091 
00093   typedef typename TOutputImage::IndexType IndexType;
00094 
00096   typedef typename InterpolatorType::PointType    PointType;
00097 
00099   typedef typename TOutputImage::PixelType   PixelType;
00100 
00102   typedef typename TOutputImage::RegionType OutputImageRegionType;
00103 
00108   void SetTransform(TransformPointerType transform) 
00109     { m_Transform = transform; }
00110 
00112   itkGetObjectMacro( Transform, TransformType );
00113 
00115   void SetInterpolator(InterpolatorPointerType interpolator) 
00116     { m_Interpolator = interpolator; }
00117 
00119   itkGetObjectMacro( Interpolator, InterpolatorType );
00120 
00122   void SetSize(const SizeType &size) 
00123     { m_Size = size; }
00124 
00126   const SizeType& GetSize()
00127     { return m_Size; }
00128      
00130   itkSetMacro(DefaultPixelValue,PixelType);
00131 
00133   itkGetMacro(DefaultPixelValue,PixelType);
00134 
00136   virtual void SetOutputSpacing( const double values[ImageDimension] );
00137 
00139   const double * GetOutputSpacing()
00140     { return m_OutputSpacing; }
00141 
00143   virtual void SetOutputOrigin( const double values[ImageDimension] );
00144 
00146   const double * GetOutputOrigin()
00147     { return m_OutputSpacing; }
00148 
00149 
00155   virtual void GenerateOutputInformation();
00156 
00162   virtual void GenerateInputRequestedRegion();
00163 
00166   virtual void BeforeThreadedGenerateData();
00167 
00168 
00169 protected:
00170   ResampleImageFilter();
00171   ~ResampleImageFilter() {};
00172   void PrintSelf(std::ostream& os, Indent indent) const;
00173 
00182   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00183                             int threadId );
00184 
00185 private:
00186   ResampleImageFilter(const Self&); //purposely not implemented
00187   void operator=(const Self&); //purposely not implemented
00188 
00189   SizeType m_Size;                      // Size of the output image
00190   TransformPointerType    m_Transform;  // Coordinate transform to use
00191   InterpolatorPointerType m_Interpolator;
00192                                         // Image function for interpolation
00193   PixelType               m_DefaultPixelValue; 
00194                                         // default pixel value if the point 
00195                                         // is outside the image
00196   double                  m_OutputSpacing[ImageDimension]; // output image spacing
00197   double                  m_OutputOrigin[ImageDimension];  // output image origin
00198 
00199 };
00200 
00201   
00202 } // end namespace itk
00203   
00204 #ifndef ITK_MANUAL_INSTANTIATION
00205 #include "itkResampleImageFilter.txx"
00206 #endif
00207   
00208 #endif

Generated at Wed Mar 12 01:13:10 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000