21 #ifndef otbChangeNoDataValueFilter_h
22 #define otbChangeNoDataValueFilter_h
24 #include "itkUnaryFunctorImageFilter.h"
25 #include "itkMetaDataObject.h"
39 template <
typename TInputPixel,
typename TOutputPixel>
49 inline TOutputPixel
operator()(
const TInputPixel& in)
const
96 template <
typename TInputImage,
typename TOutputImage>
98 :
public itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
99 Functor::ChangeNoDataFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
105 typedef itk::UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctorType>
Superclass;
122 this->GetFunctor().m_NewValues = newValues;
132 this->GetFunctor().m_NaNIsNoData = nanIsNoData;
142 Superclass::GenerateOutputInformation();
144 std::vector<bool> noDataValueAvailable;
145 std::vector<double> noDataValues;
147 bool ret =
ReadNoDataFlags(this->GetInput()->GetImageMetadata(), noDataValueAvailable, noDataValues);
151 noDataValueAvailable.resize(this->GetInput()->GetNumberOfComponentsPerPixel(),
false);
152 noDataValues.resize(this->GetInput()->GetNumberOfComponentsPerPixel(), 0);
155 this->GetFunctor().m_Flags = noDataValueAvailable;
156 this->GetFunctor().m_Values = noDataValues;
158 std::vector<bool> flags = noDataValueAvailable;
160 if ((this->GetFunctor().m_NaNIsNoData) || (!ret))
162 flags = std::vector<bool>(flags.size(),
true);
165 WriteNoDataFlags(flags, this->GetFunctor().m_NewValues, this->GetOutput()->GetImageMetadata());