ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkConstantImagePointerBoundaryCondition.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 itkConstantImagePointerBoundaryCondition_h
19#define itkConstantImagePointerBoundaryCondition_h
20#include "itkNeighborhood.h"
21#include "itkNumericTraits.h"
23
24namespace itk
25{
26
61template <typename TImage>
62class ITK_TEMPLATE_EXPORT ConstantImagePointerBoundaryCondition : public ImageBoundaryCondition<TImage>
63{
64public:
68
75
77
79 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
80
83 {
84 PixelType imagePtr = nullptr;
85 m_Constant = imagePtr;
86 }
87
90 virtual PixelType
91 operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *) const
92 {
93 return m_Constant;
94 }
95
98 virtual PixelType
100 const OffsetType &,
101 const NeighborhoodType *,
103 {
104 return m_Constant;
105 }
106
108 void
110 {
111 m_Constant = c;
112 }
113
115 const PixelType &
117 {
118 return m_Constant;
119 }
120
124 bool
126 {
127 return false;
128 }
129
130 PixelType
131 GetPixel(const IndexType & index, const TImage * image) const
132 {
133 typename TImage::RegionType imageRegion = image->GetLargestPossibleRegion();
134 if (imageRegion.IsInside(index))
135 {
136 return static_cast<PixelType>(image->GetPixel(index));
137 }
138
139 return m_Constant;
140 }
141
142private:
144};
145
146} // end namespace itk
147
148#endif
virtual PixelType operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *) const
typename Superclass::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
PixelType GetPixel(const IndexType &index, const TImage *image) const
virtual PixelType operator()(const OffsetType &, const OffsetType &, const NeighborhoodType *, const NeighborhoodAccessorFunctorType &) const
typename TImage::NeighborhoodAccessorFunctorType NeighborhoodAccessorFunctorType
typename TImage::InternalPixelType * PixelPointerType
Neighborhood< PixelPointerType, ImageDimension > NeighborhoodType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....