ITK  5.3.0
Insight Toolkit
itkConstantBoundaryCondition.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 itkConstantBoundaryCondition_h
19 #define itkConstantBoundaryCondition_h
20 
21 #include "itkNumericTraits.h"
23 
24 namespace itk
25 {
26 // Forward reference for VariableLengthVector
27 template <typename TValue>
29 
67 template <typename TInputImage, typename TOutputImage = TInputImage>
68 class ITK_TEMPLATE_EXPORT ConstantBoundaryCondition : public ImageBoundaryCondition<TInputImage, TOutputImage>
69 {
70 public:
74 
76  using typename Superclass::PixelType;
77  using typename Superclass::PixelPointerType;
78  using typename Superclass::OutputPixelType;
79  using typename Superclass::RegionType;
80  using typename Superclass::IndexType;
81  using typename Superclass::SizeType;
82  using typename Superclass::OffsetType;
83  using typename Superclass::NeighborhoodType;
84 
86 
88  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
89 
92 
94  const char *
95  GetNameOfClass() const override
96  {
97  return "itkConstantBoundaryCondition";
98  }
99 
101  void
102  Print(std::ostream & os, Indent i = 0) const override;
103 
106  template <typename TPixel>
107  void
108  Initialize(const VariableLengthVector<TPixel> *);
109 
112  OutputPixelType
113  operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *) const override;
114 
117  OutputPixelType
118  operator()(const OffsetType &,
119  const OffsetType &,
120  const NeighborhoodType *,
121  const NeighborhoodAccessorFunctorType &) const override;
122 
124  void
125  SetConstant(const OutputPixelType & c);
126 
128  const OutputPixelType &
129  GetConstant() const;
130 
134  bool
136  {
137  return false;
138  }
139 
149  RegionType
150  GetInputRequestedRegion(const RegionType & inputLargestPossibleRegion,
151  const RegionType & outputRequestedRegion) const override;
152 
160  OutputPixelType
161  GetPixel(const IndexType & index, const TInputImage * image) const override;
162 
163 private:
164  OutputPixelType m_Constant;
165 };
166 } // end namespace itk
167 
168 #ifndef ITK_MANUAL_INSTANTIATION
169 # include "itkConstantBoundaryCondition.hxx"
170 #endif
171 
172 #endif
itk::ImageBoundaryCondition< InputImageType, InputImageType >::OutputPixelType
typename InputImageType ::PixelType OutputPixelType
Definition: itkImageBoundaryCondition.h:67
itk::ImageBoundaryCondition< InputImageType, InputImageType >::PixelType
typename InputImageType ::PixelType PixelType
Definition: itkImageBoundaryCondition.h:65
itk::ConstantBoundaryCondition::m_Constant
OutputPixelType m_Constant
Definition: itkConstantBoundaryCondition.h:164
itk::Neighborhood
A light-weight container object for storing an N-dimensional neighborhood of values.
Definition: itkNeighborhood.h:54
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ConstantBoundaryCondition::GetNameOfClass
const char * GetNameOfClass() const override
Definition: itkConstantBoundaryCondition.h:95
itk::ImageBoundaryCondition
A virtual base object that defines an interface to a class of boundary condition objects for use by n...
Definition: itkImageBoundaryCondition.h:52
itk::ImageBoundaryCondition< InputImageType, InputImageType >::NeighborhoodAccessorFunctorType
typename InputImageType ::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
Definition: itkImageBoundaryCondition.h:77
itkImageBoundaryCondition.h
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ConstantBoundaryCondition
This boundary condition returns a constant value for out-of-bounds image pixels.
Definition: itkConstantBoundaryCondition.h:68
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::VariableLengthVector
Represents an array whose length can be defined at run-time.
Definition: itkConstantBoundaryCondition.h:28
itk::Offset< ImageDimension >
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkNumericTraits.h
itk::ImageBoundaryCondition< InputImageType, InputImageType >::PixelPointerType
typename InputImageType ::InternalPixelType * PixelPointerType
Definition: itkImageBoundaryCondition.h:66
itk::ConstantBoundaryCondition::RequiresCompleteNeighborhood
bool RequiresCompleteNeighborhood() override
Definition: itkConstantBoundaryCondition.h:135