OTB  9.0.0
Orfeo Toolbox
otbResetMarginFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbResetMarginFilter_h
22 #define otbResetMarginFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 
26 namespace otb
27 {
43 template <typename TImage>
44 class ResetMarginFilter : public itk::ImageToImageFilter<TImage, TImage>
45 {
46 public:
47 
50  using InputImageType = TImage;
51  using OutputImageType = TImage;
53 
56  itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
57  itkStaticConstMacro(OutputImageDimension, unsigned int, OutputImageType::ImageDimension);
59 
63  using Superclass = itk::ImageToImageFilter<InputImageType, OutputImageType>;
64  using Pointer = itk::SmartPointer<Self>;
65  using ConstPointer = itk::SmartPointer<const Self>;
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(ResetMarginFilter, unused);
73 
76  using InputPixelType = typename InputImageType::PixelType;
77  using OutputPixelType = typename OutputImageType::PixelType;
78  using InternalPixelType = typename OutputImageType::InternalPixelType;
79  using InputRealType = typename itk::NumericTraits<InputPixelType>::RealType;
80  using InputImageRegionType = typename InputImageType::RegionType;
81  using OutputImageRegionType = typename OutputImageType::RegionType;
82  using InputIndexType = typename InputImageType::IndexType;
83  using InputSizeType = typename InputImageType::SizeType;
84  using OutputIndexType = typename OutputImageType::IndexType;
85  using OutputSizeType = typename OutputImageType::SizeType;
86 
87  static_assert(InputImageDimension == OutputImageDimension, "Images have the same number of components");
89 
90  void SetROI(const InputImageRegionType& roi)
91  {
92  m_ROI = roi;
93  }
94 
96  {
97  return m_ROI;
98  }
99 
101  {
102  m_Pad = val;
103  }
104 
106  {
107  return m_Pad;
108  }
109 
110 protected:
112  ResetMarginFilter() = default;
113 
114  InputImageType * GetInputImage() { return const_cast<InputImageType*>(this->GetInput()); }
115  InputImageType const* GetInputImage() const { return this->GetInput(); }
116 
122  InputImageRegionType & destRegion,
123  OutputImageRegionType const& srcRegion) override
124  {
125  destRegion = OutputRegionToInputRegion(srcRegion);
126  }
127 
132  OutputImageRegionType const& srcRegion);
133 
137  void GenerateOutputInformation() override;
138 
145  OutputImageRegionType const& outputRegionForThread,
146  itk::ThreadIdType threadId) override;
147 
148 private:
149 
151 
153 };
154 
155 } // otb namespace
156 
157 #ifndef OTB_MANUAL_INSTANTIATION
158 #include "otbResetMarginFilter.hxx"
159 #endif
160 
161 #endif // otbResetMarginFilter_h
otb::ResetMarginFilter::CallCopyOutputRegionToInputRegion
void CallCopyOutputRegionToInputRegion(InputImageRegionType &destRegion, OutputImageRegionType const &srcRegion) override
Definition: otbResetMarginFilter.h:121
otb::ResetMarginFilter::GetInputImage
InputImageType * GetInputImage()
Hidden constructor.
Definition: otbResetMarginFilter.h:114
otb::ResetMarginFilter::SetPaddingValue
void SetPaddingValue(InternalPixelType val)
Hidden constructor.
Definition: otbResetMarginFilter.h:100
otbResetMarginFilter.hxx
otb::ResetMarginFilter::GetInputImage
InputImageType const * GetInputImage() const
Hidden constructor.
Definition: otbResetMarginFilter.h:115
otb::ResetMarginFilter::InputImageDimension
static const unsigned int InputImageDimension
Definition: otbResetMarginFilter.h:56
otb::ResetMarginFilter::GetROI
const InputImageRegionType & GetROI() const
Hidden constructor.
Definition: otbResetMarginFilter.h:95
otb::ResetMarginFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbResetMarginFilter.h:64
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ResetMarginFilter::OutputRegionToInputRegion
InputImageRegionType OutputRegionToInputRegion(OutputImageRegionType const &srcRegion)
Definition: otbResetMarginFilter.hxx:175
otb::ResetMarginFilter::m_ROI
InputImageRegionType m_ROI
Hidden constructor.
Definition: otbResetMarginFilter.h:150
otb::ResetMarginFilter::InputRealType
typename itk::NumericTraits< InputPixelType >::RealType InputRealType
Hidden constructor.
Definition: otbResetMarginFilter.h:79
otb::ResetMarginFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbResetMarginFilter.h:65
otb::ResetMarginFilter::GenerateOutputInformation
void GenerateOutputInformation() override
Definition: otbResetMarginFilter.hxx:38
otb::ResetMarginFilter::OutputImageType
TImage OutputImageType
Definition: otbResetMarginFilter.h:51
otb::ResetMarginFilter::m_Pad
InternalPixelType m_Pad
Hidden constructor.
Definition: otbResetMarginFilter.h:152
otb::ResetMarginFilter::InputSizeType
typename InputImageType::SizeType InputSizeType
Hidden constructor.
Definition: otbResetMarginFilter.h:83
otb::ResetMarginFilter::InputImageType
TImage InputImageType
Definition: otbResetMarginFilter.h:50
otb::ResetMarginFilter::InputIndexType
typename InputImageType::IndexType InputIndexType
Hidden constructor.
Definition: otbResetMarginFilter.h:82
otb::ResetMarginFilter::SetROI
void SetROI(const InputImageRegionType &roi)
Hidden constructor.
Definition: otbResetMarginFilter.h:90
otb::ResetMarginFilter::ThreadedGenerateData
void ThreadedGenerateData(OutputImageRegionType const &outputRegionForThread, itk::ThreadIdType threadId) override
Definition: otbResetMarginFilter.hxx:49
otb::ResetMarginFilter::InputPixelType
typename InputImageType::PixelType InputPixelType
Hidden constructor.
Definition: otbResetMarginFilter.h:76
otb::ResetMarginFilter::ResetMarginFilter
ResetMarginFilter()=default
Hidden constructor.
otb::ResetMarginFilter::Superclass
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass
Definition: otbResetMarginFilter.h:63
otb::ResetMarginFilter::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Hidden constructor.
Definition: otbResetMarginFilter.h:81
otb::ResetMarginFilter::OutputImageDimension
static const unsigned int OutputImageDimension
Definition: otbResetMarginFilter.h:57
otb::ResetMarginFilter
Definition: otbResetMarginFilter.h:44
otb::ResetMarginFilter::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Hidden constructor.
Definition: otbResetMarginFilter.h:77
otb::ResetMarginFilter::InternalPixelType
typename OutputImageType::InternalPixelType InternalPixelType
Hidden constructor.
Definition: otbResetMarginFilter.h:78
otb::ResetMarginFilter::GetPaddingValue
InternalPixelType GetPaddingValue() const
Hidden constructor.
Definition: otbResetMarginFilter.h:105
otb::ResetMarginFilter::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Hidden constructor.
Definition: otbResetMarginFilter.h:84
otb::ResetMarginFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Hidden constructor.
Definition: otbResetMarginFilter.h:80
otb::ResetMarginFilter::OutputSizeType
typename OutputImageType::SizeType OutputSizeType
Hidden constructor.
Definition: otbResetMarginFilter.h:85