21 #ifndef otbInnerProductPCAImageFilter_hxx
22 #define otbInnerProductPCAImageFilter_hxx
31 template <
class TInputImage,
class TOutputImage>
34 this->SetNumberOfRequiredOutputs(1);
35 this->SetNthOutput(0, OutputImageType::New());
36 m_EstimatePCAFilter = EstimatePCAFilterType::New();
37 m_NormalizePCAFilter = NormalizePCAFilterType::New();
38 m_NumberOfPrincipalComponentsRequired = 1;
40 m_GenerateMeanComponent =
false;
41 m_MeanFilter = MeanFilterType::New();
42 m_CastFilter = CastFilterType::New();
43 m_ConcatenateFilter = ConcatenateFilterType::New();
49 template <
class TInputImage,
class TOutputImage>
52 Superclass::GenerateOutputInformation();
53 if (m_GenerateMeanComponent ==
false)
54 this->GetOutput()->SetNumberOfComponentsPerPixel(m_NumberOfPrincipalComponentsRequired);
56 this->GetOutput()->SetNumberOfComponentsPerPixel(m_NumberOfPrincipalComponentsRequired + 1);
60 this->GetOutput()->SetBandImageMetadata(
67 template <
class TInputImage,
class TOutputImage>
70 m_EstimatePCAFilter->SetInput(this->GetInput());
71 m_EstimatePCAFilter->SetNumberOfPrincipalComponentsRequired(m_NumberOfPrincipalComponentsRequired);
72 m_EstimatePCAFilter->SetCenterData(m_CenterData);
75 m_NormalizePCAFilter->SetInput(m_EstimatePCAFilter->GetOutput());
77 if ((m_CenterData ==
false) || ((m_CenterData ==
true) && (m_GenerateMeanComponent ==
false)))
79 m_NormalizePCAFilter->GraftOutput(this->GetOutput());
80 m_NormalizePCAFilter->Update();
81 this->GraftOutput(m_NormalizePCAFilter->GetOutput());
85 m_MeanFilter->SetInput(this->GetInput());
86 m_CastFilter->SetInput(m_MeanFilter->GetOutput());
88 m_ConcatenateFilter->SetInput1(m_NormalizePCAFilter->GetOutput());
89 m_ConcatenateFilter->SetInput2(m_CastFilter->GetOutput());
91 m_ConcatenateFilter->GraftOutput(this->GetOutput());
92 m_ConcatenateFilter->Update();
93 this->GraftOutput(m_ConcatenateFilter->GetOutput());
100 template <
class TInputImage,
class TOutputImage>
103 Superclass::PrintSelf(os, indent);