21 #ifndef otbTwoNRIBandsImageToNComplexBandsImage_hxx
22 #define otbTwoNRIBandsImageToNComplexBandsImage_hxx
27 #include "itkImageRegionIterator.h"
28 #include "itkImageRegionConstIterator.h"
29 #include "itkProgressReporter.h"
30 #include "itkVariableLengthVector.h"
39 template <
class TInputImage,
class TOutputImage>
42 this->DynamicMultiThreadingOn();
50 template <
class TInputImage,
class TOutputImage>
53 Superclass::GenerateOutputInformation();
55 unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
57 if ((nbCompo % 2) != 0)
59 itkExceptionMacro(
"Number of bands of the input images must be an even number");
63 this->GetOutput()->SetNumberOfComponentsPerPixel(nbCompo / 2);
70 template <
class TInputImage,
class TOutputImage>
73 unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
75 if ((nbCompo % 2) != 0)
76 itkExceptionMacro(
"Number of bands of the input images must be an even number");
82 template <
class TInputImage,
class TOutputImage>
86 unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
88 itk::VariableLengthVector<std::complex<typename InputPixelType::ValueType>> vlv(nbCompo / 2);
90 itk::ImageRegionConstIterator<TInputImage> inIt;
91 inIt = itk::ImageRegionConstIterator<TInputImage>(this->GetInput(), outputRegionForThread);
93 itk::ImageRegionIterator<OutputImageType> outIt;
94 outIt = itk::ImageRegionIterator<OutputImageType>(this->GetOutput(), outputRegionForThread);
100 while (!outIt.IsAtEnd())
104 for (
unsigned int i = 0; i < nbCompo - 1; i = i + 2)
106 vlv[k] = std::complex<typename InputPixelType::ValueType>(inIt.Get()[i], inIt.Get()[i + 1]);
123 template <
class TInputImage,
class TOutput>
126 Superclass::PrintSelf(os, indent);
OutputImageType::RegionType OutputImageRegionType
TwoNRIBandsImageToNComplexBandsImage()
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
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.