ITK  6.0.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
24namespace itk
25{
26// Forward reference for VariableLengthVector
27template <typename TValue>
29
67template <typename TInputImage, typename TOutputImage = TInputImage>
68class ITK_TEMPLATE_EXPORT ConstantBoundaryCondition : public ImageBoundaryCondition<TInputImage, TOutputImage>
69{
70public:
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
95
97 void
98 Print(std::ostream & os, Indent i = 0) const override;
99
102 template <typename TPixel>
103 void
105
109 operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *) const override;
110
115 const OffsetType &,
116 const NeighborhoodType *,
117 const NeighborhoodAccessorFunctorType &) const override;
118
120 void
122
124 const OutputPixelType &
125 GetConstant() const;
126
130 bool
132 {
133 return false;
134 }
135
146 GetInputRequestedRegion(const RegionType & inputLargestPossibleRegion,
147 const RegionType & outputRequestedRegion) const override;
148
157 GetPixel(const IndexType & index, const TInputImage * image) const override;
158
159private:
160 OutputPixelType m_Constant{};
161};
162} // end namespace itk
163
164#ifndef ITK_MANUAL_INSTANTIATION
165# include "itkConstantBoundaryCondition.hxx"
166#endif
167
168#endif
This boundary condition returns a constant value for out-of-bounds image pixels.
const OutputPixelType & GetConstant() const
RegionType GetInputRequestedRegion(const RegionType &inputLargestPossibleRegion, const RegionType &outputRequestedRegion) const override
void SetConstant(const OutputPixelType &c)
OutputPixelType operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *, const NeighborhoodAccessorFunctorType &) const override
OutputPixelType operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *) const override
void Initialize(const VariableLengthVector< TPixel > *)
OutputPixelType GetPixel(const IndexType &index, const TInputImage *image) const override
void Print(std::ostream &os, Indent i=0) const override
A virtual base object that defines an interface to a class of boundary condition objects for use by n...
typename TInputImage::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
typename TInputImage::InternalPixelType * PixelPointerType
An image region represents a structured region of data.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
A light-weight container object for storing an N-dimensional neighborhood of values.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:69