ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkImageBoundaryCondition.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkImageBoundaryCondition_h
19 #define itkImageBoundaryCondition_h
20 
21 #include "itkIndex.h"
22 #include "itkNeighborhood.h"
23 #include "itkImageRegion.h"
24 
25 namespace itk
26 {
51 template< typename TInputImage, typename TOutputImage = TInputImage >
52 class ITK_TEMPLATE_EXPORT ImageBoundaryCondition
53 {
54 public:
55 
57  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
58 
61 
63  using InputImageType = TInputImage;
64  using OutputImageType = TOutputImage;
65  using PixelType = typename TInputImage::PixelType;
66  using PixelPointerType = typename TInputImage::InternalPixelType *;
67  using OutputPixelType = typename TOutputImage::PixelType;
72 
75 
77  using NeighborhoodAccessorFunctorType = typename TInputImage::NeighborhoodAccessorFunctorType;
78 
80  ImageBoundaryCondition() = default;
81 
83  virtual const char * GetNameOfClass() const
84  {
85  return "itkImageBoundaryCondition";
86  }
87 
89  virtual void Print( std::ostream & os, Indent i = 0 ) const
90  {
91  os << i << this->GetNameOfClass() << " (" << this << ")" << std::endl;
92  }
93 
98  virtual OutputPixelType operator()(const OffsetType & point_index,
99  const OffsetType & boundary_offset,
100  const NeighborhoodType *data) const = 0;
101 
104  virtual OutputPixelType operator()(
105  const OffsetType & point_index,
106  const OffsetType & boundary_offset,
107  const NeighborhoodType *data,
108  const NeighborhoodAccessorFunctorType & neighborhoodAccessorFunctor) const = 0;
109 
110  virtual ~ImageBoundaryCondition() = default;
111 
118  virtual bool RequiresCompleteNeighborhood() { return true; }
119 
129  virtual RegionType GetInputRequestedRegion( const RegionType & inputLargestPossibleRegion,
130  const RegionType & outputRequestedRegion ) const
131  {
132  (void) outputRequestedRegion;
133  return inputLargestPossibleRegion;
134  }
136 
145  virtual OutputPixelType GetPixel( const IndexType & index,
146  const TInputImage * image ) const = 0;
147 
148 };
149 } // end namespace itk
150 
151 #endif
virtual const char * GetNameOfClass() const
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:66
virtual RegionType GetInputRequestedRegion(const RegionType &inputLargestPossibleRegion, const RegionType &outputRequestedRegion) const
A light-weight container object for storing an N-dimensional neighborhood of values.
An image region represents a structured region of data.
virtual void Print(std::ostream &os, Indent i=0) const
A virtual base object that defines an interface to a class of boundary condition objects for use by n...
typename itk::Image::InternalPixelType * PixelPointerType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename itk::Image::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
Templated n-dimensional image class.
Definition: itkImage.h:75