ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkConstantBoundaryCondition.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 __itkConstantBoundaryCondition_h
00019 #define __itkConstantBoundaryCondition_h
00020 
00021 #include "itkNumericTraits.h"
00022 #include "itkImageBoundaryCondition.h"
00023 #include "itkVariableLengthVector.h"
00024 
00025 namespace itk
00026 {
00064 template< class TInputImage, class TOutputImage = TInputImage >
00065 class ITK_EXPORT ConstantBoundaryCondition:
00066     public ImageBoundaryCondition< TInputImage, TOutputImage >
00067 {
00068 public:
00070   typedef ConstantBoundaryCondition                           Self;
00071   typedef ImageBoundaryCondition< TInputImage, TOutputImage > Superclass;
00072 
00074   typedef typename Superclass::PixelType        PixelType;
00075   typedef typename Superclass::PixelPointerType PixelPointerType;
00076   typedef typename Superclass::OutputPixelType  OutputPixelType;
00077   typedef typename Superclass::RegionType       RegionType;
00078   typedef typename Superclass::IndexType        IndexType;
00079   typedef typename Superclass::SizeType         SizeType;
00080   typedef typename Superclass::OffsetType       OffsetType;
00081   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00082 
00083   typedef typename Superclass::NeighborhoodAccessorFunctorType
00084   NeighborhoodAccessorFunctorType;
00085 
00087   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00088 
00090   ConstantBoundaryCondition();
00091 
00093   virtual const char * GetNameOfClass() const
00094   {
00095     return "itkConstantBoundaryCondition";
00096   }
00097 
00099   virtual void Print( std::ostream & os, Indent i = 0 ) const;
00100 
00103   template < class TPixel >
00104   void Initialize( const VariableLengthVector< TPixel > * );
00105 
00108   virtual OutputPixelType operator()(const OffsetType &,
00109                                      const OffsetType &,
00110                                      const NeighborhoodType *) const;
00111 
00114   virtual OutputPixelType operator()(
00115     const OffsetType &,
00116     const OffsetType &,
00117     const NeighborhoodType *,
00118     const NeighborhoodAccessorFunctorType &) const;
00119 
00121   void SetConstant(const OutputPixelType & c);
00122 
00124   const OutputPixelType & GetConstant() const;
00125 
00129   bool RequiresCompleteNeighborhood() { return false; }
00130 
00140   virtual RegionType GetInputRequestedRegion( const RegionType & inputLargestPossibleRegion,
00141                                               const RegionType & outputRequestedRegion ) const;
00142 
00150   OutputPixelType GetPixel( const IndexType & index, const TInputImage * image ) const;
00151 
00152 private:
00153   OutputPixelType m_Constant;
00154 };
00155 } // end namespace itk
00156 
00157 #if ITK_TEMPLATE_TXX
00158 #include "itkConstantBoundaryCondition.hxx"
00159 #endif
00160 
00161 #endif
00162