OTB  10.0.0
Orfeo Toolbox
otbExtractROI.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbExtractROI_hxx
22 #define otbExtractROI_hxx
23 
24 #include "otbExtractROI.h"
25 #include "itkImageRegionIterator.h"
26 #include "itkProgressReporter.h"
27 
28 namespace otb
29 {
30 
34 template <class TInputPixel, class TOutputPixel>
35 ExtractROI<TInputPixel, TOutputPixel>::ExtractROI() //: ExtractROIBase< itk::Image<TInputPixel, VImageDimension> , itk::Image<TOutputPixel, VImageDimension> >()
36 {
37  this->DynamicMultiThreadingOn();
38 }
39 
43 template <class TInputPixel, class TOutputPixel>
44 void ExtractROI<TInputPixel, TOutputPixel>::PrintSelf(std::ostream& os, itk::Indent indent) const
45 {
46  Superclass::PrintSelf(os, indent);
47 }
48 
58 template <class TInputPixel, class TOutputPixel>
60 {
61  // Call to the base class method
62  Superclass::GenerateOutputInformation();
63 }
64 
65 template <class TInputPixel, class TOutputPixel>
67 {
68  itkDebugMacro(<< "Actually executing");
69 
70  // Get the input and output pointers
71  typename Superclass::InputImageConstPointer inputPtr = this->GetInput();
72  typename Superclass::OutputImagePointer outputPtr = this->GetOutput();
73 
74  // Define the portion of the input to walk for this thread
75  InputImageRegionType inputRegionForThread;
76  this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
77 
78  // Define the iterators.
79  typedef itk::ImageRegionIterator<OutputImageType> OutputIterator;
80  typedef itk::ImageRegionConstIterator<InputImageType> InputIterator;
81 
82  OutputIterator outIt(outputPtr, outputRegionForThread);
83  InputIterator inIt(inputPtr, inputRegionForThread);
84 
85  // walk the output region, and sample the input image
86  while (!outIt.IsAtEnd())
87  {
88  // copy the input pixel to the output
89  outIt.Set(inIt.Get());
90  ++outIt;
91  ++inIt;
92  }
93 }
94 
95 } // end namespace otb
96 
97 #endif
void GenerateOutputInformation() override
InputImageType::RegionType InputImageRegionType
Definition: otbExtractROI.h:64
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void PrintSelf(std::ostream &os, itk::Indent indent) const override
OutputImageType::RegionType OutputImageRegionType
Definition: otbExtractROI.h:63
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.