OTB  6.5.0
Orfeo Toolbox
otbRAndNIRIndexImageFilter.txx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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 otbRAndNIRIndexImageFilter_txx
22 #define otbRAndNIRIndexImageFilter_txx
23 
25 #include "itkImageRegionIterator.h"
26 #include "itkProgressReporter.h"
27 
28 namespace otb
29 {
30 
34 template <class TInputImageR, class TInputImageNIR,
35  class TOutputImage, class TFunction>
38 {
39 }
40 
44 template <class TInputImageR, class TInputImageNIR,
45  class TOutputImage, class TFunction>
46 void
48 ::SetInputR(const TInputImageR * image1)
49 {
50  // Process object is not const-correct so the const casting is required.
51  this->SetInput1(image1);
52 }
53 
57 template <class TInputImageR, class TInputImageNIR,
58  class TOutputImage, class TFunction>
59 void
61 ::SetInputNIR(const TInputImageNIR * image2)
62 {
63  // Process object is not const-correct so the const casting is required.
64 // SetNthInput(1, const_cast<TInputImageNIR *>( image2 ));
65  this->SetInput2(image2);
66 }
68 
72 /*
73 template <class TInputImageR, class TInputImageNIR, class TOutputImage, class TFunction >
74 void
75 RAndNIRIndexImageFilter<TInputImageR, TInputImageNIR, TOutputImage, TFunction>
76 ::ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread,
77  itk::ThreadIdType threadId)
78 {
79 
80  // We use dynamic_cast since inputs are stored as DataObjects. The
81  // ImageToImageFilter::GetInput(int) always returns a pointer to a
82  // TInputImageR so it cannot be used for the second input.
83  RInputImagePointer inputPtr1
84  = dynamic_cast<const TInputImageR*>(itk::ProcessObject::GetInput(0));
85  NIRInputImagePointer inputPtr2
86  = dynamic_cast<const TInputImageNIR*>(itk::ProcessObject::GetInput(1));
87  OutputImagePointer outputPtr = this->GetOutput(0);
88 
89  itk::ImageRegionConstIterator<TInputImageR> inputItR(inputPtr1, outputRegionForThread);
90  itk::ImageRegionConstIterator<TInputImageNIR> inputItNIR(inputPtr2, outputRegionForThread);
91 
92  itk::ImageRegionIterator<TOutputImage> outputIt(outputPtr, outputRegionForThread);
93 
94  itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());
95 
96  inputItR.GoToBegin();
97  inputItNIR.GoToBegin();
98  outputIt.GoToBegin();
99 
100  while( !inputItR.IsAtEnd() )
101  {
102  outputIt.Set( this->GetFunctor()( inputItR.Get(), inputItNIR.Get() ) );
103  ++inputItNIR;
104  ++inputItR;
105  ++outputIt;
106  progress.CompletedPixel(); // potential exception thrown here
107  }
108 
109 }
110 */
111 template <class TInputImageR, class TInputImageNIR, class TOutputImage, class TFunction>
112 void
114 ::PrintSelf(std::ostream& os, itk::Indent indent) const
115 {
116  Superclass::PrintSelf(os, indent);
117 }
118 
119 }
120 
121 #endif
void SetInputNIR(const TInputImageNIR *image2)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void SetInputR(const TInputImageR *image1)