OTB  9.0.0
Orfeo Toolbox
otbDrawPathFilter.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 
22 #ifndef otbDrawPathFilter_hxx
23 #define otbDrawPathFilter_hxx
24 
25 #include "otbDrawPathFilter.h"
26 #include "otbDrawPathListFilter.h"
27 
28 namespace otb
29 {
33 template <class TInputImage, class TInputPath, class TOutputImage>
35  :
36  m_Value(static_cast<OutputImagePixelType>(255.0))
37 {}
38 
39 template <class TInputImage, class TInputPath, class TOutputImage>
41 {
42  this->SetPathInput(path);
43 }
44 
45 template <class TInputImage, class TInputPath, class TOutputImage>
47 {
48  return this->GetPathInput();
49 }
50 
54 template <class TInputImage, class TInputPath, class TOutputImage>
56 {
58  typedef typename DrawListFilterType::InputPathListType PathListType;
59  typename PathListType::Pointer list = PathListType::New();
60  InputPathPointer path = const_cast<TInputPath*>(this->GetPathInput());
61  list->PushBack(path);
63 
64  typename DrawListFilterType::Pointer drawer = DrawListFilterType::New();
65  drawer->SetInput(this->GetImageInput());
66  drawer->SetInputPath(list);
67  drawer->SetPathValue(m_Value);
68 
69  drawer->GraftOutput(this->GetOutput());
70  drawer->Update();
71  this->GraftOutput(drawer->GetOutput());
72 }
76 template <class TInputImage, class TInputPath, class TOutputImage>
77 void DrawPathFilter<TInputImage, TInputPath, TOutputImage>::PrintSelf(std::ostream& os, itk::Indent indent) const
78 {
79  Superclass::PrintSelf(os, indent);
80  os << indent << "Path Value: " << m_Value << std::endl;
81 }
82 } // end namespace otb
84 
85 #endif
otb::DrawPathFilter::InputPathPointer
InputPathType::Pointer InputPathPointer
Definition: otbDrawPathFilter.h:68
otb::DrawPathFilter::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbDrawPathFilter.hxx:77
otb::DrawPathFilter::GenerateData
void GenerateData() override
Definition: otbDrawPathFilter.hxx:55
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::DrawPathFilter::DrawPathFilter
DrawPathFilter()
Definition: otbDrawPathFilter.hxx:34
otb::DrawPathFilter::SetInputPath
void SetInputPath(const TInputPath *path)
Definition: otbDrawPathFilter.hxx:40
otbDrawPathFilter.h
otbDrawPathListFilter.h
otb::DrawPathListFilter
This class can be used to draw a list of path on an image.
Definition: otbDrawPathListFilter.h:50
otb::DrawPathFilter::GetInputPath
const TInputPath * GetInputPath(void)
Definition: otbDrawPathFilter.hxx:46
otb::DrawPathFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbDrawPathFilter.h:79