ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkInterpolateImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkInterpolateImageFilter_h
00019 #define __itkInterpolateImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkLinearInterpolateImageFunction.h"
00023 
00024 namespace itk
00025 {
00043 template< class TInputImage, class TOutputImage >
00044 class ITK_EXPORT InterpolateImageFilter:
00045   public ImageToImageFilter< TInputImage, TOutputImage >
00046 {
00047 public:
00049   typedef InterpolateImageFilter                          Self;
00050   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00051   typedef SmartPointer< Self >                            Pointer;
00052   typedef SmartPointer< const Self >                      ConstPointer;
00053 
00055   itkNewMacro(Self);
00056 
00058   itkTypeMacro(InterpolateImageFilter, ImageToImageFilter);
00059 
00061   typedef typename Superclass::InputImageType        InputImageType;
00062   typedef typename Superclass::InputImagePointer     InputImagePointer;
00063   typedef typename Superclass::OutputImageType       OutputImageType;
00064   typedef typename Superclass::OutputImagePointer    OutputImagePointer;
00065   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00066 
00068   itkStaticConstMacro(ImageDimension, unsigned int,
00069                       TOutputImage::ImageDimension);
00070   itkStaticConstMacro(IntermediateImageDimension, unsigned int,
00071                       TOutputImage::ImageDimension + 1);
00073 
00075   typedef typename TInputImage::PixelType                                             InputPixelType;
00076   typedef Image< InputPixelType, itkGetStaticConstMacro(IntermediateImageDimension) > IntermediateImageType;
00077   typedef InterpolateImageFunction< IntermediateImageType >                           InterpolatorType;
00078 
00080   void SetInput1(const InputImageType *image)
00081   { this->SetInput(image); }
00082   const InputImageType * GetInput1()
00083   { return this->GetInput(); }
00085 
00087   void SetInput2(const InputImageType *image);
00088 
00089   const InputImageType * GetInput2();
00090 
00093   itkSetClampMacro(Distance, double, 0.0, 1.0);
00094   itkGetConstMacro(Distance, double);
00096 
00098   itkSetObjectMacro(Interpolator, InterpolatorType)
00099 
00100 
00101   itkGetObjectMacro(Interpolator, InterpolatorType);
00102 
00105   void BeforeThreadedGenerateData();
00106 
00108   void AfterThreadedGenerateData();
00109 
00110 #ifdef ITK_USE_CONCEPT_CHECKING
00111 
00112   itkConceptMacro( InputHasNumericTraitsCheck,
00113                    ( Concept::HasNumericTraits< InputPixelType > ) );
00114 
00116 #endif
00117 protected:
00118   InterpolateImageFilter();
00119   ~InterpolateImageFilter() {}
00120   void PrintSelf(std::ostream & os, Indent indent) const;
00122 
00124   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00125                             ThreadIdType threadId);
00126 
00127 private:
00128   InterpolateImageFilter(const Self &); //purposely not implemented
00129   void operator=(const Self &);         //purposely not implemented
00130 
00131   typename InterpolatorType::Pointer m_Interpolator;
00132 
00133   typename IntermediateImageType::Pointer m_IntermediateImage;
00134 
00135   double m_Distance;
00136 };
00137 } // end namespace itk
00138 
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkInterpolateImageFilter.hxx"
00141 #endif
00142 
00143 #endif
00144