22 #ifndef otbLmvmPanSharpeningFusionImageFilter_hxx
23 #define otbLmvmPanSharpeningFusionImageFilter_hxx
29 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision>
33 this->SetNumberOfRequiredInputs(2);
36 m_PanConvolutionFilter = PanConvolutionFilterType::New();
37 m_PanConvolutionFilter->NormalizeFilterOn();
38 m_XsConvolutionFilter = XsConvolutionFilterType::New();
39 m_XsConvolutionFilter->NormalizeFilterOn();
40 m_PanNoiseFilter = PanNoiseFilterType::New();
41 m_XsNoiseFilter = XsNoiseFilterType::New();
42 m_XsVectorConvolutionFilter = XsVectorConvolutionFilterType::New();
43 m_XsVectorNoiseFilter = XsVectorNoiseFilterType::New();
48 m_Filter.SetSize(7 * 7);
52 m_FusionStep1Filter = FusionStep1FilterType::New();
53 m_FusionStep2Filter = FusionStep2FilterType::New();
56 m_ProgressAccumulator = itk::ProgressAccumulator::New();
57 m_ProgressAccumulator->SetMiniPipelineFilter(
this);
58 m_ProgressAccumulator->RegisterInternalFilter(m_PanConvolutionFilter, 0.2);
59 m_ProgressAccumulator->RegisterInternalFilter(m_PanNoiseFilter, 0.2);
60 m_ProgressAccumulator->RegisterInternalFilter(m_XsVectorConvolutionFilter, 0.2);
61 m_ProgressAccumulator->RegisterInternalFilter(m_XsVectorNoiseFilter, 0.2);
62 m_ProgressAccumulator->RegisterInternalFilter(m_FusionStep1Filter, 0.1);
63 m_ProgressAccumulator->RegisterInternalFilter(m_FusionStep2Filter, 0.1);
66 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision>
72 this->itk::ProcessObject::SetNthInput(1,
const_cast<TPanImageType*
>(image));
76 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision>
79 if (this->GetNumberOfInputs() < 2)
84 return static_cast<const TPanImageType*
>(this->itk::ProcessObject::GetInput(1));
87 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision>
93 this->itk::ProcessObject::SetNthInput(0,
const_cast<TXsImageType*
>(image));
97 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision>
100 if (this->GetNumberOfInputs() < 1)
105 return static_cast<const TXsImageType*
>(this->itk::ProcessObject::GetInput(0));
108 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision>
112 typename TPanImageType::SizeType sizePan;
113 typename TXsImageType::SizeType sizeXs;
114 sizePan = this->GetPanInput()->GetLargestPossibleRegion().GetSize();
115 sizeXs = this->GetXsInput()->GetLargestPossibleRegion().GetSize();
116 if ((sizePan[0] != sizeXs[0]) || (sizePan[1] != sizeXs[1]))
118 itkExceptionMacro(<<
"LmvmPanSharpeningFusionImageFilter: Wrong Pan/Xs size");
122 m_PanConvolutionFilter->SetInput(this->GetPanInput());
123 m_PanConvolutionFilter->SetRadius(this->m_Radius);
124 m_PanConvolutionFilter->SetFilter(this->m_Filter);
125 m_PanNoiseFilter->SetRadius(this->m_Radius);
126 m_PanNoiseFilter->SetInput(this->GetPanInput());
127 m_XsConvolutionFilter->SetRadius(this->m_Radius);
128 m_XsConvolutionFilter->SetFilter(this->m_Filter);
129 m_XsVectorConvolutionFilter->SetInput(this->GetXsInput());
130 m_XsVectorConvolutionFilter->SetFilter(m_XsConvolutionFilter);
131 m_XsNoiseFilter->SetRadius(this->m_Radius);
132 m_XsVectorNoiseFilter->SetInput(this->GetXsInput());
133 m_XsVectorNoiseFilter->SetFilter(m_XsNoiseFilter);
136 m_FusionStep1Filter->SetInput1(m_XsVectorNoiseFilter->GetOutput());
137 m_FusionStep1Filter->SetInput2(m_PanConvolutionFilter->GetOutput());
138 m_FusionStep1Filter->SetInput3(this->GetPanInput());
140 m_FusionStep2Filter->SetInput1(m_FusionStep1Filter->GetOutput());
141 m_FusionStep2Filter->SetInput3(m_PanNoiseFilter->GetOutput());
142 m_FusionStep2Filter->SetInput2(m_XsVectorConvolutionFilter->GetOutput());
144 m_FusionStep2Filter->UpdateOutputInformation();
147 m_FusionStep2Filter->GraftOutput(this->GetOutput());
148 m_FusionStep2Filter->Update();
149 this->GraftOutput(m_FusionStep2Filter->GetOutput());
152 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision>
154 itk::Indent indent)
const
156 Superclass::PrintSelf(os, indent);
157 os << indent <<
"Radius:" << this->m_Radius << std::endl;