/usr/include/OTB-5.8/otbShiftScaleImageAdaptor.h is in libotb-dev 5.8.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | /*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef otbShiftScaleImageAdaptor_h
#define otbShiftScaleImageAdaptor_h
#include "vnl/vnl_math.h"
#include "itkImageAdaptor.h"
namespace otb
{
namespace Accessor
{
/** \class ShiftScalePixelAccessor
* \brief Apply a shift scale operation to the value
*
* ShiftScalePixelAccessor shifts the input pixel by Shift
* and then scales the pixel by Scale. All computations
* are performed in the precision of the input pixel's RealType
*
* ShiftScalePixelAccessor is templated over an internal type and an
* external type representation. This class cast the input
* applies the function to it and cast the result according
* to the types defined as template parameters
*
* \ingroup ImageAdaptors
*
* \ingroup OTBImageManipulation
*/
template <class TPixelType, class TExternalType>
class ITK_EXPORT ShiftScalePixelAccessor
{
public:
/** External typedef. It defines the external aspect
* that this class will exhibit. */
typedef TExternalType ExternalType;
/** Internal typedef. It defines the internal real
* representation of data. */
typedef typename itk::NumericTraits<TPixelType>::RealType InternalType;
InternalType GetShift() const
{
return m_Shift;
}
void SetShift(InternalType value)
{
m_Shift = value;
}
InternalType GetScale() const
{
return m_Scale;
}
void SetScale(InternalType value)
{
m_Scale = value;
}
inline void Set(InternalType& output, const ExternalType& input)
{
output = static_cast<InternalType>(m_Scale * (static_cast<InternalType>(input) + m_Shift));
}
inline const ExternalType Get(const InternalType& input) const
{
return static_cast<ExternalType>(m_Scale * (static_cast<InternalType>(input) + m_Shift));
}
private:
InternalType m_Shift;
InternalType m_Scale;
};
} // end namespace Accessor
/** \class ShiftScaleImageAdaptor
* \brief Presents an image as being composed of the shift scale operation of its pixels
*
* Additional casting is performed according to the input and output image
* types following C++ default casting rules.
*
* \ingroup ImageAdaptors
*
* \ingroup OTBImageManipulation
*/
template <class TImage, class TOutputPixelType>
class ITK_EXPORT ShiftScaleImageAdaptor : public
itk::ImageAdaptor<TImage, Accessor::ShiftScalePixelAccessor<
typename TImage::PixelType,
TOutputPixelType> >
{
public:
/** Standard class typedefs. */
typedef ShiftScaleImageAdaptor Self;
typedef itk::ImageAdaptor<
TImage,
Accessor::ShiftScalePixelAccessor<typename TImage::PixelType, TOutputPixelType>
> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef typename TImage::PixelType InternalType;
typedef typename Superclass::IndexType IndexType;
typedef typename Accessor::ShiftScalePixelAccessor<
typename TImage::PixelType,
TOutputPixelType> AccessorType;
typedef typename AccessorType::ExternalType PixelType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(ShiftScaleImageAdaptor, ImageAdaptor);
typename TImage::PixelType GetShift() const
{
itkDebugMacro("returning " << " m_Shift of " << this->GetPixelAccessor().GetShift());
return this->GetPixelAccessor().GetShift();
}
virtual void SetShift(typename TImage::PixelType value)
{
itkDebugMacro("setting m_Shift to " << value);
if (this->GetPixelAccessor().GetShift() != value)
{
this->GetPixelAccessor().SetShift(value);
this->Modified();
}
}
typename TImage::PixelType GetScale() const
{
itkDebugMacro("returning " << " m_Scale of " << this->GetPixelAccessor().GetScale());
return this->GetPixelAccessor().GetScale();
}
virtual void SetScale(typename TImage::PixelType value)
{
itkDebugMacro("setting m_Scale to " << value);
if (this->GetPixelAccessor().GetScale() != value)
{
this->GetPixelAccessor().SetScale(value);
this->Modified();
}
}
protected:
ShiftScaleImageAdaptor() {}
~ShiftScaleImageAdaptor() ITK_OVERRIDE {}
private:
ShiftScaleImageAdaptor(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
};
} // end namespace otb
#endif
|