ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkPadImageFilter.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 __itkPadImageFilter_h
00019 #define __itkPadImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 #include "itkImageBoundaryCondition.h"
00024 
00025 namespace itk
00026 {
00046 template< class TInputImage, class TOutputImage >
00047 class ITK_EXPORT PadImageFilter:
00048   public ImageToImageFilter< TInputImage, TOutputImage >
00049 {
00050 public:
00052   typedef PadImageFilter                                  Self;
00053   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00054   typedef SmartPointer< Self >                            Pointer;
00055   typedef SmartPointer< const Self >                      ConstPointer;
00056 
00058   itkNewMacro(Self);
00059 
00061   typedef typename TOutputImage::RegionType OutputImageRegionType;
00062   typedef typename TInputImage::RegionType  InputImageRegionType;
00063 
00065   typedef typename TOutputImage::PixelType OutputImagePixelType;
00066   typedef typename TInputImage::PixelType  InputImagePixelType;
00067 
00069   typedef typename TOutputImage::IndexType    OutputImageIndexType;
00070   typedef typename TInputImage::IndexType     InputImageIndexType;
00071   typedef typename TOutputImage::SizeType     OutputImageSizeType;
00072   typedef typename TInputImage::SizeType      InputImageSizeType;
00073   typedef typename TInputImage::SizeType      SizeType;
00074   typedef typename TInputImage::SizeValueType SizeValueType;
00075 
00077   typedef ImageBoundaryCondition< TInputImage, TOutputImage > BoundaryConditionType;
00078   typedef BoundaryConditionType *                             BoundaryConditionPointerType;
00079 
00081   itkTypeMacro(PadImageFilter, ImageToImageFilter);
00082 
00084   itkStaticConstMacro(ImageDimension, unsigned int,
00085                       TInputImage::ImageDimension);
00086 
00089   itkSetMacro(PadLowerBound, SizeType);
00090   itkSetMacro(PadUpperBound, SizeType);
00091   itkGetConstReferenceMacro(PadLowerBound, SizeType);
00092   itkGetConstReferenceMacro(PadUpperBound, SizeType);
00093   itkSetVectorMacro(PadLowerBound, const SizeValueType, ImageDimension);
00094   itkSetVectorMacro(PadUpperBound, const SizeValueType, ImageDimension);
00096 
00097   void SetPadBound(const InputImageSizeType & bound)
00098   {
00099     this->SetPadLowerBound(bound);
00100     this->SetPadUpperBound(bound);
00101   }
00102 
00104   itkSetMacro(BoundaryCondition, BoundaryConditionPointerType);
00105   itkGetConstMacro(BoundaryCondition, BoundaryConditionPointerType);
00107 
00108 protected:
00109   PadImageFilter();
00110   ~PadImageFilter() {}
00111   void PrintSelf(std::ostream & os, Indent indent) const;
00112 
00119   virtual void GenerateOutputInformation();
00120 
00126   virtual void GenerateInputRequestedRegion();
00127 
00129   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00130                             ThreadIdType threadId);
00131 
00133   void InternalSetBoundaryCondition( const BoundaryConditionPointerType boundaryCondition );
00134 
00135 private:
00136   PadImageFilter(const Self &); //purposely not implemented
00137   void operator=(const Self &); //purposely not implemented
00138 
00139   SizeType m_PadLowerBound;
00140   SizeType m_PadUpperBound;
00141 
00142   BoundaryConditionPointerType m_BoundaryCondition;
00143 };
00144 } // end namespace itk
00145 
00146 #ifndef ITK_MANUAL_INSTANTIATION
00147 #include "itkPadImageFilter.hxx"
00148 #endif
00149 
00150 #endif
00151