ITK  5.2.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  * http://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 
65 
67  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
68  using InputImageRegionType = typename Superclass::InputImageRegionType;
69 
71  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
72  using InputImagePixelType = typename Superclass::InputImagePixelType;
73 
75  using OutputImageIndexType = typename Superclass::OutputImageIndexType;
76  using InputImageIndexType = typename Superclass::InputImageIndexType;
77  using OutputImageSizeType = typename Superclass::OutputImageSizeType;
78  using InputImageSizeType = 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  }
100 
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:636
itk::ConstantPadImageFilter
Increase the image size by padding with a constant value.
Definition: itkConstantPadImageFilter.h:49
itk::ConstantPadImageFilter::OutputImageIndexType
typename Superclass::OutputImageIndexType OutputImageIndexType
Definition: itkConstantPadImageFilter.h:75
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
itk::ConstantPadImageFilter::m_InternalBoundaryCondition
ConstantBoundaryCondition< TInputImage, TOutputImage > m_InternalBoundaryCondition
Definition: itkConstantPadImageFilter.h:117
itkConstantBoundaryCondition.h
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
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::ConstantPadImageFilter::InputImageIndexType
typename Superclass::InputImageIndexType InputImageIndexType
Definition: itkConstantPadImageFilter.h:76
itk::ConstantPadImageFilter::InputImageSizeType
typename Superclass::InputImageSizeType InputImageSizeType
Definition: itkConstantPadImageFilter.h:78
itk::PadImageFilter
Increase the image size by padding. Superclass for filters that fill in extra pixels.
Definition: itkPadImageFilter.h:48
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkPadImageFilter.h
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::ConstantPadImageFilter::OutputImageSizeType
typename Superclass::OutputImageSizeType OutputImageSizeType
Definition: itkConstantPadImageFilter.h:77
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::ConstantPadImageFilter::GetConstant
OutputImagePixelType GetConstant() const
Definition: itkConstantPadImageFilter.h:95
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itkMath.h
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:306