/usr/include/OTB-5.8/otbBCOInterpolateImageFunction.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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /*=========================================================================
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 otbBCOInterpolateImageFunction_h
#define otbBCOInterpolateImageFunction_h
#include "itkInterpolateImageFunction.h"
#include "vnl/vnl_vector.h"
#include "otbMath.h"
#include "otbVectorImage.h"
namespace otb
{
/** \class BCOInterpolateImageFunction
* \brief Interpolate an image at specified positions using bicubic interpolation.
*
* BCOInterpolateImageFunction interpolates image intensity at
* a non-integer pixel position. This class is templated
* over the input image type and the coordinate representation type
* (e.g. float or double).
*
* This function works for 2-dimensional images.
*
* This function works with both Images and VectorImages.
*
* Parameters are the interpolation window radius and the bicubic
* optimisation coefficient alpha.
* Alpha is usually set to -0.5, -0.75 or -1 (-0.5 by default).
* The case alpha = -0.5 (which corresponds to the cubic Hermite
* spline) is known to produce the best approximation of the original
* function.
*
* \ingroup ImageFunctions ImageInterpolators
*
* \ingroup OTBInterpolation
*/
template< class TInputImage, class TCoordRep = double >
class ITK_EXPORT BCOInterpolateImageFunctionBase :
public itk::InterpolateImageFunction<TInputImage, TCoordRep>
{
public:
/** Standard class typedefs. */
typedef BCOInterpolateImageFunctionBase Self;
typedef itk::InterpolateImageFunction<TInputImage, TCoordRep> Superclass;
/** Run-time type information (and related methods). */
itkTypeMacro(BCOInterpolateImageFunctionBase, InterpolateImageFunction);
/** OutputType typedef support. */
typedef typename Superclass::OutputType OutputType;
/** InputImageType typedef support. */
typedef typename Superclass::InputImageType InputImageType;
/** InputPixelType typedef support. */
typedef typename Superclass::InputPixelType InputPixelType;
/** RealType typedef support. */
typedef typename Superclass::RealType RealType;
/** Dimension underlying input image. */
itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
/** Index typedef support. */
typedef typename Superclass::IndexType IndexType;
typedef typename Superclass::IndexValueType IndexValueType;
/** Point typedef support. */
typedef typename Superclass::PointType PointType;
/** ContinuousIndex typedef support. */
typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
typedef TCoordRep ContinuousIndexValueType;
/** Coeficients container type.*/
typedef vnl_vector<double> CoefContainerType;
/** Set/Get the window radius */
virtual void SetRadius(unsigned int radius);
virtual unsigned int GetRadius() const;
/** Set/Get the optimisation coefficient (Common values are -0.5, -0.75 or -1.0) */
virtual void SetAlpha(double alpha);
virtual double GetAlpha() const;
/** Evaluate the function at a ContinuousIndex position
*
* Returns the linearly interpolated image intensity at a
* specified point position. No bounds checking is done.
* The point is assume to lie within the image buffer.
*
* ImageFunction::IsInsideBuffer() can be used to check bounds before
* calling the method. */
OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE = 0;
protected:
BCOInterpolateImageFunctionBase() : m_Radius(2), m_WinSize(5), m_Alpha(-0.5) {};
~BCOInterpolateImageFunctionBase() ITK_OVERRIDE {};
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
/** Compute the BCO coefficients. */
virtual CoefContainerType EvaluateCoef( const ContinuousIndexValueType & indexValue ) const;
/** Used radius for the BCO */
unsigned int m_Radius;
/** Used winsize for the BCO */
unsigned int m_WinSize;
/** Optimisation Coefficient */
double m_Alpha;
private:
BCOInterpolateImageFunctionBase( const Self& ); //purposely not implemented
void operator=( const Self& ); //purposely not implemented
};
template < class TInputImage, class TCoordRep = double >
class ITK_EXPORT BCOInterpolateImageFunction :
public otb::BCOInterpolateImageFunctionBase< TInputImage, TCoordRep >
{
public:
/** Standard class typedefs. */
typedef BCOInterpolateImageFunction Self;
typedef BCOInterpolateImageFunctionBase<TInputImage, TCoordRep> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
itkTypeMacro(BCOInterpolateImageFunction, BCOInterpolateImageFunctionBase);
itkNewMacro(Self);
itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
typedef typename Superclass::OutputType OutputType;
typedef typename Superclass::InputImageType InputImageType;
typedef typename Superclass::InputPixelType InputPixelType;
typedef typename Superclass::RealType RealType;
typedef typename Superclass::IndexType IndexType;
typedef typename Superclass::IndexValueType IndexValueType;
typedef typename Superclass::PointType PointType;
typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
typedef typename Superclass::CoefContainerType CoefContainerType;
OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE;
protected:
BCOInterpolateImageFunction() {};
~BCOInterpolateImageFunction() ITK_OVERRIDE {};
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
private:
BCOInterpolateImageFunction( const Self& ); //purposely not implemented
void operator=( const Self& ); //purposely not implemented
};
template < typename TPixel, unsigned int VImageDimension, class TCoordRep >
class ITK_EXPORT BCOInterpolateImageFunction< otb::VectorImage<TPixel, VImageDimension> , TCoordRep > :
public otb::BCOInterpolateImageFunctionBase< otb::VectorImage<TPixel, VImageDimension> , TCoordRep >
{
public:
/** Standard class typedefs.*/
typedef BCOInterpolateImageFunction Self;
typedef BCOInterpolateImageFunctionBase
< otb::VectorImage<TPixel, VImageDimension>, TCoordRep > Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
itkTypeMacro(BCOInterpolateImageFunction, BCOInterpolateImageFunctionBase);
itkNewMacro(Self);
itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
typedef typename Superclass::OutputType OutputType;
typedef typename Superclass::InputImageType InputImageType;
typedef typename Superclass::InputPixelType InputPixelType;
typedef typename Superclass::RealType RealType;
typedef typename Superclass::IndexType IndexType;
typedef typename Superclass::IndexValueType IndexValueType;
typedef typename Superclass::PointType PointType;
typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
typedef typename Superclass::CoefContainerType CoefContainerType;
OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE;
protected:
BCOInterpolateImageFunction() {};
~BCOInterpolateImageFunction() ITK_OVERRIDE {};
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
private:
BCOInterpolateImageFunction( const Self& ); //purposely not implemented
void operator=( const Self& ); //purposely not implemented
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbBCOInterpolateImageFunction.txx"
#endif
#endif
|