22 #ifndef otbSimpleRcsPanSharpeningFusionImageFilter_h
23 #define otbSimpleRcsPanSharpeningFusionImageFilter_h
29 #include "itkProgressAccumulator.h"
51 template <
class TPanImageType,
class TXsImageType,
class TOutputImageType,
class TInternalPrecision =
float>
58 typedef itk::ImageToImageFilter<TXsImageType, TOutputImageType>
Superclass;
66 typedef typename itk::Array<TInternalPrecision>
ArrayType;
87 virtual void SetPanInput(
const TPanImageType* image);
88 const TPanImageType* GetPanInput(
void)
const;
90 virtual void SetXsInput(
const TXsImageType* path);
91 const TXsImageType* GetXsInput(
void)
const;
101 void GenerateData()
override;
104 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
108 void operator=(
const Self&);
121 void operator()(
typename TOutputImageType::PixelType& output,
const typename TXsImageType::PixelType& xsPixel,
const TInternalPrecision& smoothPanchroPixel,
122 const typename TPanImageType::PixelType& sharpPanchroPixel)
const
124 TInternalPrecision scale = 1.;
126 if (std::abs(smoothPanchroPixel) > 1e-10)
128 scale = sharpPanchroPixel / smoothPanchroPixel;
132 for (
unsigned int i = 0; i < xsPixel.Size(); ++i)
134 output[i] =
static_cast<typename TOutputImageType::InternalPixelType
>(xsPixel[i] * scale);
138 constexpr
size_t OutputSize(
const std::array<size_t, 3>& inputsNbBands)
const
140 return inputsNbBands[0];
156 void operator()(
typename TOutputImageType::PixelType& output,
const typename TXsImageType::PixelType& xsPixel,
const TInternalPrecision& smoothPanchroPixel,
157 const typename TPanImageType::PixelType& sharpPanchroPixel)
const
160 if (m_NoDataValuePanAvailable && sharpPanchroPixel == m_NoDataValuePan)
162 for (
unsigned int i = 0; i < xsPixel.Size(); ++i)
164 output[i] =
static_cast<typename TOutputImageType::InternalPixelType
>(m_NoDataValuesXs[i]);
169 TInternalPrecision scale = 1.;
171 if (std::abs(smoothPanchroPixel) > 1e-10)
173 scale = sharpPanchroPixel / smoothPanchroPixel;
177 for (
unsigned int i = 0; i < xsPixel.Size(); ++i)
179 output[i] = (m_NoDataValuesXsAvailable[i] && (xsPixel[i] == m_NoDataValuesXs[i]))
180 ?
static_cast<typename TOutputImageType::InternalPixelType
>(xsPixel[i])
181 :
static_cast<typename TOutputImageType::InternalPixelType
>(xsPixel[i] * scale);
187 m_NoDataValuePanAvailable = noDataAvailable;
192 m_NoDataValuePan = noDataValue;
197 m_NoDataValuesXsAvailable = noDataValuesAvailable;
202 m_NoDataValuesXs = noDataValues;
205 constexpr
size_t OutputSize(
const std::array<size_t, 3> inputsNbBands)
const
207 return inputsNbBands[0];
210 NoDataFusionFunctor() : m_NoDataValuePanAvailable(false), m_NoDataValuePan(0), m_NoDataValuesXsAvailable(false), m_NoDataValuesXs()
265 #ifndef OTB_MANUAL_INSTANTIATION