OTB  9.0.0
Orfeo Toolbox
otbBinaryImageToDensityImageFilter.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 otbBinaryImageToDensityImageFilter_h
22 #define otbBinaryImageToDensityImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "itkDataObject.h"
26 #include "itkConstNeighborhoodIterator.h"
27 
28 namespace otb
29 {
36 template <class TInputImage, class TOutputImage, class TCountFunction>
37 class ITK_EXPORT BinaryImageToDensityImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
38 {
39 public:
42  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
43  typedef itk::SmartPointer<Self> Pointer;
44  typedef itk::SmartPointer<const Self> ConstPointer;
45 
47  itkNewMacro(Self);
48 
50  itkTypeMacro(BinaryImageToDensityImageFilter, itk::ImageToImageFilter);
51 
53  typedef TInputImage InputImageType;
54  typedef typename InputImageType::RegionType InputImageRegionType;
55  typedef typename InputImageType::Pointer InputImagePointerType;
56  typedef typename InputImageType::SizeType InputImageSizeType;
57 
58  typedef TOutputImage OutputImageType;
59  typedef typename OutputImageType::Pointer OutputImagePointerType;
60 
61  typedef TCountFunction CountFunctionType;
62  typedef typename CountFunctionType::Pointer CountFunctionPointerType;
63 
64  typedef itk::ConstNeighborhoodIterator<TInputImage> NeighborhoodIteratorType;
65  typedef typename NeighborhoodIteratorType::RadiusType RadiusType;
66 
68  itkSetMacro(NeighborhoodRadius, RadiusType);
69  itkGetMacro(NeighborhoodRadius, RadiusType);
71 
72  void SetNeighborhoodRadius(unsigned int rad)
73  {
74  m_NeighborhoodRadius.Fill(rad);
75  this->Modified();
76  }
77 
79  void ThreadedGenerateData(const InputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
80  void BeforeThreadedGenerateData() override;
81  void GenerateInputRequestedRegion() override;
83 
84 protected:
87 
90 
92  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
93 
94 private:
95  BinaryImageToDensityImageFilter(const Self&) = delete;
96  void operator=(const Self&) = delete;
97 
99 
102 };
103 } // End namespace otb
104 
105 #ifndef OTB_MANUAL_INSTANTIATION
107 #endif
108 
109 #endif
otb::BinaryImageToDensityImageFilter::CountFunctionPointerType
CountFunctionType::Pointer CountFunctionPointerType
Definition: otbBinaryImageToDensityImageFilter.h:62
otb::BinaryImageToDensityImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbBinaryImageToDensityImageFilter.h:42
otb::BinaryImageToDensityImageFilter::m_NeighborhoodRadius
RadiusType m_NeighborhoodRadius
Definition: otbBinaryImageToDensityImageFilter.h:101
otb::BinaryImageToDensityImageFilter::CountFunctionType
TCountFunction CountFunctionType
Definition: otbBinaryImageToDensityImageFilter.h:61
otb::BinaryImageToDensityImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbBinaryImageToDensityImageFilter.h:58
otb::BinaryImageToDensityImageFilter::m_CountFunction
CountFunctionPointerType m_CountFunction
Definition: otbBinaryImageToDensityImageFilter.h:98
otb::BinaryImageToDensityImageFilter::NeighborhoodIteratorType
itk::ConstNeighborhoodIterator< TInputImage > NeighborhoodIteratorType
Definition: otbBinaryImageToDensityImageFilter.h:64
otbBinaryImageToDensityImageFilter.hxx
otb::BinaryImageToDensityImageFilter::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbBinaryImageToDensityImageFilter.h:59
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::BinaryImageToDensityImageFilter
This class performs a streaming isotropic shrinking operation without smoothing.
Definition: otbBinaryImageToDensityImageFilter.h:37
otb::BinaryImageToDensityImageFilter::Self
BinaryImageToDensityImageFilter Self
Definition: otbBinaryImageToDensityImageFilter.h:41
otb::BinaryImageToDensityImageFilter::InputImageType
TInputImage InputImageType
Definition: otbBinaryImageToDensityImageFilter.h:50
otb::BinaryImageToDensityImageFilter::InputImagePointerType
InputImageType::Pointer InputImagePointerType
Definition: otbBinaryImageToDensityImageFilter.h:55
otb::BinaryImageToDensityImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbBinaryImageToDensityImageFilter.h:54
otb::BinaryImageToDensityImageFilter::RadiusType
NeighborhoodIteratorType::RadiusType RadiusType
Definition: otbBinaryImageToDensityImageFilter.h:65
otb::BinaryImageToDensityImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbBinaryImageToDensityImageFilter.h:44
otb::BinaryImageToDensityImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbBinaryImageToDensityImageFilter.h:43
otb::BinaryImageToDensityImageFilter::SetNeighborhoodRadius
void SetNeighborhoodRadius(unsigned int rad)
Definition: otbBinaryImageToDensityImageFilter.h:72
otb::BinaryImageToDensityImageFilter::InputImageSizeType
InputImageType::SizeType InputImageSizeType
Definition: otbBinaryImageToDensityImageFilter.h:56