ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkImageBoundaryCondition.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 __itkImageBoundaryCondition_h
00019 #define __itkImageBoundaryCondition_h
00020 
00021 #include "itkIndex.h"
00022 #include "itkNeighborhood.h"
00023 #include "itkImageRegion.h"
00024 
00025 namespace itk
00026 {
00051 template< class TInputImage, class TOutputImage = TInputImage >
00052 class ITK_EXPORT ImageBoundaryCondition
00053 {
00054 public:
00055 
00057   itkStaticConstMacro(ImageDimension, unsigned int,
00058                       TInputImage::ImageDimension);
00059 
00061   typedef ImageBoundaryCondition Self;
00062 
00064   typedef typename TInputImage::PixelType                       PixelType;
00065   typedef typename TInputImage::InternalPixelType *             PixelPointerType;
00066   typedef typename TOutputImage::PixelType                      OutputPixelType;
00067   typedef Index< itkGetStaticConstMacro(ImageDimension) >       IndexType;
00068   typedef Size< itkGetStaticConstMacro(ImageDimension) >        SizeType;
00069   typedef Offset< itkGetStaticConstMacro(ImageDimension) >      OffsetType;
00070   typedef ImageRegion< itkGetStaticConstMacro(ImageDimension) > RegionType;
00072 
00074   typedef Neighborhood< PixelPointerType,
00075                         itkGetStaticConstMacro(ImageDimension) > NeighborhoodType;
00076 
00078   typedef typename TInputImage::NeighborhoodAccessorFunctorType
00079   NeighborhoodAccessorFunctorType;
00080 
00082   ImageBoundaryCondition() {}
00083 
00085   virtual const char * GetNameOfClass() const
00086   {
00087     return "itkImageBoundaryCondition";
00088   }
00089 
00091   virtual void Print( std::ostream & os, Indent i = 0 ) const
00092   {
00093     os << i << this->GetNameOfClass() << " (" << this << ")" << std::endl;
00094   }
00095 
00100   virtual OutputPixelType operator()(const OffsetType & point_index,
00101                                      const OffsetType & boundary_offset,
00102                                      const NeighborhoodType *data) const = 0;
00103 
00106   virtual OutputPixelType operator()(
00107     const OffsetType & point_index,
00108     const OffsetType & boundary_offset,
00109     const NeighborhoodType *data,
00110     const NeighborhoodAccessorFunctorType & neighborhoodAccessorFunctor) const = 0;
00111 
00112   virtual ~ImageBoundaryCondition() {}
00113 
00120   virtual bool RequiresCompleteNeighborhood() { return true; }
00121 
00131   virtual RegionType GetInputRequestedRegion( const RegionType & inputLargestPossibleRegion,
00132                                               const RegionType & outputRequestedRegion ) const
00133   {
00134     (void) outputRequestedRegion;
00135     return inputLargestPossibleRegion;
00136   }
00138 
00147   virtual OutputPixelType GetPixel( const IndexType & index,
00148                                     const TInputImage * image ) const = 0;
00149 
00150 };
00151 } // end namespace itk
00152 
00153 #endif
00154