ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkConstantPadImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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:
50  public PadImageFilter< TInputImage, TOutputImage >
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_ASSIGN(ConstantPadImageFilter);
54 
60 
62  itkNewMacro(Self);
63 
66 
68  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
69  using InputImageRegionType = typename Superclass::InputImageRegionType;
70 
72  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
73  using InputImagePixelType = typename Superclass::InputImagePixelType;
74 
76  using OutputImageIndexType = typename Superclass::OutputImageIndexType;
77  using InputImageIndexType = typename Superclass::InputImageIndexType;
78  using OutputImageSizeType = typename Superclass::OutputImageSizeType;
79  using InputImageSizeType = typename Superclass::InputImageSizeType;
80 
82  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
83  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
84 
87  {
88  if ( Math::NotExactlyEquals(constant, m_InternalBoundaryCondition.GetConstant()) )
89  {
90  m_InternalBoundaryCondition.SetConstant( constant );
91  this->Modified();
92  }
93  }
95  {
96  return m_InternalBoundaryCondition.GetConstant();
97  }
99 
100 #ifdef ITK_USE_CONCEPT_CHECKING
101  // Begin concept checking
102  itkConceptMacro( OutputEqualityComparableCheck,
104  itkConceptMacro( InputConvertibleToOutputCheck,
106  itkConceptMacro( SameDimensionCheck,
108  itkConceptMacro( OutputOStreamWritableCheck,
110  // End concept checking
111 #endif
112 
113 protected:
115  ~ConstantPadImageFilter() override = default;
116  void PrintSelf(std::ostream & os, Indent indent) const override;
117 
118 private:
120 };
121 } // end namespace itk
122 
123 #ifndef ITK_MANUAL_INSTANTIATION
124 #include "itkConstantPadImageFilter.hxx"
125 #endif
126 
127 #endif
Increase the image size by padding with a constant value.
typename Superclass::InputImageIndexType InputImageIndexType
This boundary condition returns a constant value for out-of-bounds image pixels.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
OutputImagePixelType GetConstant() const
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
typename Superclass::OutputImageSizeType OutputImageSizeType
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:718
void SetConstant(OutputImagePixelType constant)
typename InputImageType::RegionType InputImageRegionType
ConstantBoundaryCondition< TInputImage, TOutputImage > m_InternalBoundaryCondition
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::InputImageSizeType InputImageSizeType
Increase the image size by padding. Superclass for filters that fill in extra pixels.
#define itkConceptMacro(name, concept)
typename Superclass::OutputImageIndexType OutputImageIndexType