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>
47 template <
class TInputImage,
class TOutputImage>
50 Superclass::GenerateOutputInformation();
52 unsigned int nbInputs = this->GetNumberOfInputs();
53 this->GetOutput()->SetNumberOfComponentsPerPixel(nbInputs);
59 template <
class TInputImage,
class TOutputImage>
62 unsigned int nbInputs = this->GetNumberOfInputs();
64 for (
unsigned int i = 0; i < nbInputs; i++)
65 if (this->GetInput(i)->GetNumberOfComponentsPerPixel() != 2)
66 itkExceptionMacro(
"Input images must be made of two bands and only two (see input #" << i <<
").");
72 template <
class TInputImage,
class TOutputImage>
74 itk::ThreadIdType threadId)
78 itk::ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
80 unsigned int nbInputs = this->GetNumberOfInputs();
82 itk::VariableLengthVector<std::complex<typename InputPixelType::ValueType>> vlv(nbInputs);
84 std::vector<typename itk::ImageRegionConstIterator<TInputImage>> vInIt;
85 for (
unsigned int i = 0; i < nbInputs; i++)
86 vInIt.push_back(itk::ImageRegionConstIterator<TInputImage>(this->GetInput(i), outputRegionForThread));
89 itk::ImageRegionIterator<OutputImageType> outIt;
90 outIt = itk::ImageRegionIterator<OutputImageType>(this->GetOutput(), outputRegionForThread);
92 for (
unsigned int i = 0; i < nbInputs; i++)
96 while (!outIt.IsAtEnd())
100 for (
unsigned int i = 0; i < nbInputs; i++)
102 vlv[i] = std::complex<typename InputPixelType::ValueType>(vInIt[i].Get()[0], vInIt[i].Get()[1]);
111 for (
unsigned int i = 0; i < nbInputs; i++)
115 progress.CompletedPixel();
122 template <
class TInputImage,
class TOutput>
125 Superclass::PrintSelf(os, indent);