ITK  6.0.0
Insight Toolkit
itkConstantPadImageFilter.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 itkConstantPadImageFilter_h
19 #define itkConstantPadImageFilter_h
20 
21 #include "itkPadImageFilter.h"
22 
23 #include "itkMath.h"
25 
26 namespace itk
27 {
48 template <typename TInputImage, typename TOutputImage>
49 class ITK_TEMPLATE_EXPORT ConstantPadImageFilter : public PadImageFilter<TInputImage, TOutputImage>
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_MOVE(ConstantPadImageFilter);
53 
59 
61  itkNewMacro(Self);
62 
64  itkOverrideGetNameOfClassMacro(ConstantPadImageFilter);
65 
67  using typename Superclass::OutputImageRegionType;
68  using typename Superclass::InputImageRegionType;
69 
71  using typename Superclass::OutputImagePixelType;
72  using typename Superclass::InputImagePixelType;
73 
75  using typename Superclass::OutputImageIndexType;
76  using typename Superclass::InputImageIndexType;
77  using typename Superclass::OutputImageSizeType;
78  using typename Superclass::InputImageSizeType;
79 
81  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
82  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
83 
85  void
87  {
88  if (Math::NotExactlyEquals(constant, m_InternalBoundaryCondition.GetConstant()))
89  {
90  m_InternalBoundaryCondition.SetConstant(constant);
91  this->Modified();
92  }
93  }
94  OutputImagePixelType
95  GetConstant() const
96  {
97  return m_InternalBoundaryCondition.GetConstant();
98  }
101 #ifdef ITK_USE_CONCEPT_CHECKING
102  // Begin concept checking
103  itkConceptMacro(OutputEqualityComparableCheck, (Concept::EqualityComparable<OutputImagePixelType>));
107  // End concept checking
108 #endif
109 
110 protected:
112  ~ConstantPadImageFilter() override = default;
113  void
114  PrintSelf(std::ostream & os, Indent indent) const override;
115 
116 private:
118 };
119 } // end namespace itk
120 
121 #ifndef ITK_MANUAL_INSTANTIATION
122 # include "itkConstantPadImageFilter.hxx"
123 #endif
124 
125 #endif
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:639
itk::ConstantPadImageFilter
Increase the image size by padding with a constant value.
Definition: itkConstantPadImageFilter.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Math::NotExactlyEquals
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:733
itkConstantBoundaryCondition.h
itk::Concept::SameDimension
Definition: itkConceptChecking.h:697
itk::ConstantPadImageFilter::SetConstant
void SetConstant(OutputImagePixelType constant)
Definition: itkConstantPadImageFilter.h:86
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ConstantBoundaryCondition
This boundary condition returns a constant value for out-of-bounds image pixels.
Definition: itkConstantBoundaryCondition.h:68
itk::PadImageFilter
Increase the image size by padding. Superclass for filters that fill in extra pixels.
Definition: itkPadImageFilter.h:48
itkPadImageFilter.h
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::Concept::Convertible
Definition: itkConceptChecking.h:217
itk::ConstantPadImageFilter::GetConstant
OutputImagePixelType GetConstant() const
Definition: itkConstantPadImageFilter.h:95
itkMath.h
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:307