ITK  5.4.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  itkOverrideGetNameOfClassMacro(ConstantBoundaryCondition);
77 
79  using typename Superclass::PixelType;
80  using typename Superclass::PixelPointerType;
81  using typename Superclass::OutputPixelType;
82  using typename Superclass::RegionType;
83  using typename Superclass::IndexType;
84  using typename Superclass::SizeType;
85  using typename Superclass::OffsetType;
86  using typename Superclass::NeighborhoodType;
87 
89 
91  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
92 
94  ConstantBoundaryCondition() = default;
95 
97  void
98  Print(std::ostream & os, Indent i = 0) const override;
99 
102  template <typename TPixel>
103  void
104  Initialize(const VariableLengthVector<TPixel> *);
105 
108  OutputPixelType
109  operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *) const override;
110 
113  OutputPixelType
114  operator()(const OffsetType &,
115  const OffsetType &,
116  const NeighborhoodType *,
117  const NeighborhoodAccessorFunctorType &) const override;
118 
120  void
121  SetConstant(const OutputPixelType & c);
122 
124  const OutputPixelType &
125  GetConstant() const;
126 
130  bool
132  {
133  return false;
134  }
135 
145  RegionType
146  GetInputRequestedRegion(const RegionType & inputLargestPossibleRegion,
147  const RegionType & outputRequestedRegion) const override;
148 
156  OutputPixelType
157  GetPixel(const IndexType & index, const TInputImage * image) const override;
158 
159 private:
160  OutputPixelType m_Constant{};
161 };
162 } // end namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 # include "itkConstantBoundaryCondition.hxx"
166 #endif
167 
168 #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::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::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::ConstantBoundaryCondition< InputImageType >::NeighborhoodAccessorFunctorType
typename InputImageType ::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
Definition: itkImageBoundaryCondition.h:77
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:131