21 #ifndef otbImageToNoDataMaskFilter_h
22 #define otbImageToNoDataMaskFilter_h
24 #include "itkUnaryFunctorImageFilter.h"
25 #include "itkMetaDataObject.h"
39 template <
typename TInputPixel,
typename TOutputPixel>
49 inline TOutputPixel
operator()(
const TInputPixel& in)
const
80 template <
typename TInputImage,
typename TOutputImage>
82 :
public itk::UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::NoDataFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
88 typedef itk::UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctorType>
Superclass;
104 this->GetFunctor().m_InsideValue = value;
113 this->GetFunctor().m_OutsideValue = value;
123 this->GetFunctor().m_NaNIsNoData = nanIsNoData;
133 std::vector<bool> noDataValueAvailable;
134 std::vector<double> noDataValues;
136 ReadNoDataFlags(this->GetInput()->GetImageMetadata(), noDataValueAvailable, noDataValues);
139 if (noDataValueAvailable.empty() || noDataValues.empty())
141 const TInputImage* input = this->GetInput();
142 noDataValueAvailable.assign(input->GetNumberOfComponentsPerPixel(),
false);
143 noDataValues.assign(input->GetNumberOfComponentsPerPixel(), 0.0);
146 this->GetFunctor().m_Flags = noDataValueAvailable;
147 this->GetFunctor().m_Values = noDataValues;