21 #ifndef otbTwoNRIBandsImageToNComplexBandsImage_hxx
22 #define otbTwoNRIBandsImageToNComplexBandsImage_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 nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
54 if ((nbCompo % 2) != 0)
56 itkExceptionMacro(
"Number of bands of the input images must be an even number");
60 this->GetOutput()->SetNumberOfComponentsPerPixel(nbCompo / 2);
67 template <
class TInputImage,
class TOutputImage>
70 unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
72 if ((nbCompo % 2) != 0)
73 itkExceptionMacro(
"Number of bands of the input images must be an even number");
79 template <
class TInputImage,
class TOutputImage>
81 itk::ThreadIdType threadId)
84 unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
86 itk::VariableLengthVector<std::complex<typename InputPixelType::ValueType>> vlv(nbCompo / 2);
90 itk::ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
92 itk::ImageRegionConstIterator<TInputImage> inIt;
93 inIt = itk::ImageRegionConstIterator<TInputImage>(this->GetInput(), outputRegionForThread);
95 itk::ImageRegionIterator<OutputImageType> outIt;
96 outIt = itk::ImageRegionIterator<OutputImageType>(this->GetOutput(), outputRegionForThread);
102 while (!outIt.IsAtEnd())
106 for (
unsigned int i = 0; i < nbCompo - 1; i = i + 2)
108 vlv[k] = std::complex<typename InputPixelType::ValueType>(inIt.Get()[i], inIt.Get()[i + 1]);
119 progress.CompletedPixel();
126 template <
class TInputImage,
class TOutput>
129 Superclass::PrintSelf(os, indent);