OTB  9.0.0
Orfeo Toolbox
otbKeyPointDensityImageFilter.hxx
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 otbKeyPointDensityImageFilter_hxx
22 #define otbKeyPointDensityImageFilter_hxx
23 
25 #include "itkImageRegionIterator.h"
26 
27 namespace otb
28 {
32 template <class TInputImage, class TOutputImage, class TDetector>
34 {
35  this->SetNumberOfRequiredInputs(1);
36  m_NeighborhoodRadius = 1;
37  m_Detector = DetectorType::New();
38  m_PointSetToDensityImageFilter = PointSetToDensityImageType::New();
39 }
41 
42 /*---------------------------------------------------------
43  * Destructor.c
44  ----------------------------------------------------------*/
45 template <class TInputImage, class TOutputImage, class TDetector>
47 {
48 }
49 
57 template <class TInputImage, class TOutputImage, class TDetector>
59 //::GenerateData( const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId )
60 {
61  typename Superclass::OutputImagePointer outputImage = this->GetOutput();
62  InputImagePointerType ptr = const_cast<InputImageType*>(this->GetInput());
63  if (!ptr)
64  return;
66 
68  m_Detector->SetInput(ptr);
69 
71  m_PointSetToDensityImageFilter->SetInput(m_Detector->GetOutput());
72  m_PointSetToDensityImageFilter->SetRadius(m_NeighborhoodRadius);
73  m_PointSetToDensityImageFilter->SetSpacing(ptr->GetSignedSpacing());
74  m_PointSetToDensityImageFilter->SetSize(ptr->GetLargestPossibleRegion().GetSize());
75  m_PointSetToDensityImageFilter->SetOrigin(ptr->GetOrigin());
76  m_PointSetToDensityImageFilter->Update();
78 
80  this->GraftOutput(m_PointSetToDensityImageFilter->GetOutput());
81 }
82 
86 template <class TInputImage, class TOutputImage, class TDetector>
88 {
89  m_Detector = detector;
90 }
91 
95 template <class TInputImage, class TOutputImage, class TDetector>
98 {
99  return m_Detector;
100 }
101 
102 /*----------------------------------------------------------------
103  PrintSelf
104  -----------------------------------------------------------------*/
105 template <class TInputImage, class TOutputImage, class TDetector>
106 void KeyPointDensityImageFilter<TInputImage, TOutputImage, TDetector>::PrintSelf(std::ostream& os, itk::Indent indent) const
107 {
108  Superclass::PrintSelf(os, indent);
109  os << indent << "Neighborhood Radius " << m_NeighborhoodRadius << std::endl;
110 }
111 
otb::KeyPointDensityImageFilter::SetDetector
virtual void SetDetector(DetectorType *detector)
otbKeyPointDensityImageFilter.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::KeyPointDensityImageFilter::GenerateData
void GenerateData() override
otb::KeyPointDensityImageFilter::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
otb::KeyPointDensityImageFilter::KeyPointDensityImageFilter
KeyPointDensityImageFilter()
otb::KeyPointDensityImageFilter::GetDetector
virtual DetectorType * GetDetector()
otb::KeyPointDensityImageFilter::DetectorType
TDetector DetectorType
Definition: otbKeyPointDensityImageFilter.h:74
otb::KeyPointDensityImageFilter::~KeyPointDensityImageFilter
~KeyPointDensityImageFilter() override