OTB  9.0.0
Orfeo Toolbox
otbGAndRIndexImageFilter.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 otbGAndRIndexImageFilter_hxx
22 #define otbGAndRIndexImageFilter_hxx
23 
24 #include "otbGAndRIndexImageFilter.h"
25 #include "itkImageRegionIterator.h"
26 #include "itkProgressReporter.h"
27 
28 namespace otb
29 {
30 
34 template <class TInputImageG, class TInputImageR, class TOutputImage, class TFunction>
35 GAndRIndexImageFilter<TInputImageG, TInputImageR, TOutputImage, TFunction>::GAndRIndexImageFilter()
36 {
37 }
38 
42 template <class TInputImageG, class TInputImageR, class TOutputImage, class TFunction>
43 void GAndRIndexImageFilter<TInputImageG, TInputImageR, TOutputImage, TFunction>::SetInputG(const TInputImageG* image1)
44 {
45  // Process object is not const-correct so the const casting is required.
46  this->SetInput1(image1);
47 }
48 
52 template <class TInputImageG, class TInputImageR, class TOutputImage, class TFunction>
53 void GAndRIndexImageFilter<TInputImageG, TInputImageR, TOutputImage, TFunction>::SetInputR(const TInputImageR* image2)
54 {
55  // Process object is not const-correct so the const casting is required.
56  // SetNthInput(1, const_cast<TInputImageR *>( image2 ));
57  this->SetInput2(image2);
58 }
60 
64 /*
65 template <class TInputImageG, class TInputImageR, class TOutputImage, class TFunction >
66 void
67 GAndRIndexImageFilter<TInputImageG, TInputImageR, TOutputImage, TFunction>
68 ::ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread,
69  itk::ThreadIdType threadId)
70 {
71 
72  // We use dynamic_cast since inputs are stored as DataObjects. The
73  // ImageToImageFilter::GetInput(int) always returns a pointer to a
74  // TInputImageG so it cannot be used for the second input.
75  RInputImagePointer inputPtr1
76  = dynamic_cast<const TInputImageG*>(itk::ProcessObject::GetInput(0));
77  NIRInputImagePointer inputPtr2
78  = dynamic_cast<const TInputImageR*>(itk::ProcessObject::GetInput(1));
79  OutputImagePointer outputPtr = this->GetOutput(0);
80 
81  itk::ImageRegionConstIterator<TInputImageG> inputItR(inputPtr1, outputRegionForThread);
82  itk::ImageRegionConstIterator<TInputImageR> inputItNIR(inputPtr2, outputRegionForThread);
83 
84  itk::ImageRegionIterator<TOutputImage> outputIt(outputPtr, outputRegionForThread);
85 
86  itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());
87 
88  inputItR.GoToBegin();
89  inputItNIR.GoToBegin();
90  outputIt.GoToBegin();
91 
92  while( !inputItR.IsAtEnd() )
93  {
94  outputIt.Set( this->GetFunctor()( inputItR.Get(), inputItNIR.Get() ) );
95  ++inputItNIR;
96  ++inputItR;
97  ++outputIt;
98  progress.CompletedPixel(); // potential exception thrown here
99  }
100 
101 }
102 */
103 template <class TInputImageG, class TInputImageR, class TOutputImage, class TFunction>
104 void GAndRIndexImageFilter<TInputImageG, TInputImageR, TOutputImage, TFunction>::PrintSelf(std::ostream& os, itk::Indent indent) const
105 {
106  Superclass::PrintSelf(os, indent);
107 }
108 }
109 
110 #endif
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32