21 #ifndef otbShiftScaleImageFilter_h
22 #define otbShiftScaleImageFilter_h
24 #include "itkUnaryFunctorImageFilter.h"
25 #include "itkVariableLengthVector.h"
47 template <
class TInput,
class TOutput>
53 typedef typename itk::NumericTraits<typename TInput::ValueType>::RealType
RealType;
87 for (
unsigned int i = 0; i <
m_Shift.Size(); ++i)
97 for (
unsigned int i = 0; i <
m_Scale.Size(); ++i)
110 return !(*
this != other);
118 result.SetSize(x.GetSize());
121 if (result.GetSize() !=
m_Scale.GetSize() || result.GetSize() !=
m_Shift.GetSize())
123 itkGenericExceptionMacro(<<
"Pixel size different from scale or shift size !");
127 for (
unsigned int i = 0; i < x.GetSize(); ++i)
132 result[i] =
static_cast<typename TOutput::ValueType
>(invertedScale * (x[i] -
m_Shift[i]));
136 result[i] =
static_cast<typename TOutput::ValueType
>(x[i] -
m_Shift[i]);
164 template <
class TInputImage,
class TOutputImage = TInputImage>
166 :
public itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
167 Functor::VectorShiftScale<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
173 typedef itk::UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctorType>
Superclass;
181 typedef typename itk::NumericTraits<InputValueType>::RealType
InputRealType;
188 itkTypeMacro(ShiftScaleImageFilter, itk::UnaryFunctorImageFilter);
205 void BeforeThreadedGenerateData(
void)
override;
208 void GenerateOutputInformation(
void)
override;
211 void GenerateInputRequestedRegion(
void)
override;
223 #ifndef OTB_MANUAL_INSTANTIATION
This functor performs a per band linear transform of its input.
itk::NumericTraits< typename TInput::ValueType >::RealType RealType
Real type typedef.
void SetScaleValues(TInput value)
virtual ~VectorShiftScale()
Constructor.
void SetShiftValues(TInput value)
Accessors.
bool operator==(const VectorShiftScale &other) const
bool operator!=(const VectorShiftScale &other) const
VectorShiftScale()
Constructor.
TOutput operator()(const TInput &x) const
This filter performs a shift and scaling of a vector image on a per band basis.
TInputImage::PixelType InputPixelType
OutputPixelType::ValueType OutputValueType
ShiftScaleVectorImageFilter Self
TOutputImage::PixelType OutputPixelType
ShiftScaleVectorImageFilter(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
void operator=(const Self &)=delete
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, FunctorType > Superclass
Functor::VectorShiftScale< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
itk::NumericTraits< OutputValueType >::RealType OutputRealType
~ShiftScaleVectorImageFilter() override
InputPixelType::ValueType InputValueType
itk::SmartPointer< Self > Pointer
ShiftScaleVectorImageFilter()
itk::NumericTraits< InputValueType >::RealType InputRealType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.