21 #ifndef otbPerBandVectorImageFilter_hxx
22 #define otbPerBandVectorImageFilter_hxx
31 template <
class TInputImage,
class TOutputImage,
class TFilter>
34 m_Filter = FilterType::New();
39 template <
class TInputImage,
class TOutputImage,
class TFilter>
45 typename InputImageType::Pointer dummyInputImage = InputImageType::New();
46 dummyInputImage->CopyInformation(this->GetInput());
47 dummyInputImage->SetNumberOfComponentsPerPixel(1);
48 m_Filter->SetInput(dummyInputImage);
49 m_Filter->UpdateOutputInformation();
50 this->GetOutput()->CopyInformation(m_Filter->GetOutput(m_OutputIndex));
51 this->GetOutput()->SetNumberOfComponentsPerPixel(this->GetInput()->GetNumberOfComponentsPerPixel());
54 this->GetOutput()->SetImageMetadata(this->GetInput()->GetImageMetadata());
58 template <
class TInputImage,
class TOutputImage,
class TFilter>
61 InputVectorImageType* inputPtr =
const_cast<InputVectorImageType*
>(this->GetInput());
62 typename InputImageType::Pointer dummyInputImage = InputImageType::New();
63 dummyInputImage->CopyInformation(this->GetInput());
64 dummyInputImage->SetNumberOfComponentsPerPixel(1);
65 m_Filter->SetInput(dummyInputImage);
66 m_Filter->GetOutput(m_OutputIndex)->SetRequestedRegion(this->GetOutput()->GetRequestedRegion());
67 m_Filter->PropagateRequestedRegion(this->GetOutput());
68 inputPtr->SetRequestedRegion(m_Filter->GetInput()->GetRequestedRegion());
73 template <
class TInputImage,
class TOutputImage,
class TFilter>
76 InputVectorImageType* inputPtr =
const_cast<InputVectorImageType*
>(this->GetInput());
77 OutputVectorImagePointerType outputPtr = this->GetOutput();
78 DecompositionFilterPointerType decomposer = DecompositionFilterType::New();
79 ProcessingFilterPointerType processor = ProcessingFilterType::New();
80 RecompositionFilterPointerType recomposer = RecompositionFilterType::New();
83 inputPtr->UpdateOutputData();
85 decomposer->SetInput(this->GetInput());
86 processor->SetInput(decomposer->GetOutput());
87 processor->SetFilter(m_Filter);
88 processor->SetOutputIndex(m_OutputIndex);
89 recomposer->SetInput(processor->GetOutput());
90 recomposer->GetOutput()->SetRequestedRegion(this->GetOutput()->GetRequestedRegion());
92 recomposer->GraftOutput(this->GetOutput());
94 this->GraftOutput(recomposer->GetOutput());