21 #ifndef otbNRIBandImagesToOneNComplexBandsImage_hxx
22 #define otbNRIBandImagesToOneNComplexBandsImage_hxx
26 #include "itkImageRegionIterator.h"
27 #include "itkImageRegionConstIterator.h"
28 #include "itkProgressReporter.h"
29 #include "itkVariableLengthVector.h"
38 template <
class TInputImage,
class TOutputImage>
42 this->DynamicMultiThreadingOn();
49 template <
class TInputImage,
class TOutputImage>
52 Superclass::GenerateOutputInformation();
54 unsigned int nbInputs = this->GetNumberOfInputs();
55 this->GetOutput()->SetNumberOfComponentsPerPixel(nbInputs);
61 template <
class TInputImage,
class TOutputImage>
64 unsigned int nbInputs = this->GetNumberOfInputs();
66 for (
unsigned int i = 0; i < nbInputs; i++)
67 if (this->GetInput(i)->GetNumberOfComponentsPerPixel() != 2)
68 itkExceptionMacro(
"Input images must be made of two bands and only two (see input #" << i <<
").");
74 template <
class TInputImage,
class TOutputImage>
78 unsigned int nbInputs = this->GetNumberOfInputs();
80 itk::VariableLengthVector<std::complex<typename InputPixelType::ValueType>> vlv(nbInputs);
82 std::vector<typename itk::ImageRegionConstIterator<TInputImage>> vInIt;
83 for (
unsigned int i = 0; i < nbInputs; i++)
84 vInIt.push_back(itk::ImageRegionConstIterator<TInputImage>(this->GetInput(i), outputRegionForThread));
87 itk::ImageRegionIterator<OutputImageType> outIt;
88 outIt = itk::ImageRegionIterator<OutputImageType>(this->GetOutput(), outputRegionForThread);
90 for (
unsigned int i = 0; i < nbInputs; i++)
94 while (!outIt.IsAtEnd())
98 for (
unsigned int i = 0; i < nbInputs; i++)
100 vlv[i] = std::complex<typename InputPixelType::ValueType>(vInIt[i].Get()[0], vInIt[i].Get()[1]);
109 for (
unsigned int i = 0; i < nbInputs; i++)
119 template <
class TInputImage,
class TOutput>
122 Superclass::PrintSelf(os, indent);
NRIBandImagesToOneNComplexBandsImage()
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
OutputImageType::RegionType OutputImageRegionType
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void GenerateOutputInformation(void) override
void BeforeThreadedGenerateData(void) override
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.