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;
Functor used by ImageToNoDataMaskFilter.
std::vector< double > m_Values
std::vector< bool > m_Flags
virtual ~NoDataFunctor()=default
TOutputPixel operator()(const TInputPixel &in) const
TOutputPixel m_InsideValue
TOutputPixel m_OutsideValue
Builds a no-data mask image from no-data flags and values.
void SetInsideValue(const typename TOutputImage::PixelType &value)
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, FunctorType > Superclass
void operator=(const Self &)=delete
itk::SmartPointer< Self > Pointer
ImageToNoDataMaskFilter(const Self &)=delete
ImageToNoDataMaskFilter Self
void BeforeThreadedGenerateData() override
ImageToNoDataMaskFilter()=default
void SetOutsideValue(const typename TOutputImage::PixelType &value)
void SetNaNIsNoData(bool nanIsNoData)
itk::SmartPointer< const Self > ConstPointer
~ImageToNoDataMaskFilter()=default
Functor::NoDataFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
This filter implements the computation of the spectral angle distance with respect to a reference pix...
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
bool OTBMetadata_EXPORT ReadNoDataFlags(const ImageMetadata &imd, std::vector< bool > &flags, std::vector< double > &values)
bool IsNoData(const T &pixel, const std::vector< bool > &flags, const std::vector< double > &values, bool nanIsNoData=false)