/usr/include/OTB-5.8/otbBSplineInterpolateImageFunction.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 | /*=========================================================================
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 otbBSplineInterpolateImageFunction_h
#define otbBSplineInterpolateImageFunction_h
#include <vector>
#include "itkInterpolateImageFunction.h"
#include "vnl/vnl_matrix.h"
#include "otbBSplineDecompositionImageFilter.h"
#include "itkConceptChecking.h"
#include "itkCovariantVector.h"
namespace otb
{
/** \class BSplineInterpolateImageFunction
* \brief This class is an evolution of the itk::BSplineInterpolateImageFunction to handle
* huge images with this interpolator. For more documentation, please refer to the original
* class.
* \sa itk::BSplineInterpolateImageFunction
* \sa itk::BSplineDecompositionImageFilter
* \sa otb::BSplineDecompositionImageFilter
*
* \ingroup ImageFunctions
*
* \ingroup OTBInterpolation
*/
template <
class TImageType,
class TCoordRep = double,
class TCoefficientType = double>
class ITK_EXPORT BSplineInterpolateImageFunction :
public itk::InterpolateImageFunction<TImageType, TCoordRep>
{
public:
/** Standard class typedefs. */
typedef BSplineInterpolateImageFunction Self;
typedef itk::InterpolateImageFunction<TImageType, TCoordRep> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro(BSplineInterpolateImageFunction, InterpolateImageFunction);
/** New macro for creation of through a Smart Pointer */
itkNewMacro(Self);
/** OutputType typedef support. */
typedef typename Superclass::OutputType OutputType;
/** InputImageType typedef support. */
typedef typename Superclass::InputImageType InputImageType;
/** Dimension underlying input image. */
itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
/** Index typedef support. */
typedef typename Superclass::IndexType IndexType;
/** Region typedef support */
typedef typename InputImageType::RegionType RegionType;
/** ContinuousIndex typedef support. */
typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
/** PointType typedef support */
typedef typename Superclass::PointType PointType;
/** Iterator typedef support */
typedef itk::ImageLinearIteratorWithIndex<TImageType> Iterator;
/** Internal Coefficient typedef support */
typedef TCoefficientType CoefficientDataType;
typedef itk::Image<CoefficientDataType,
itkGetStaticConstMacro(ImageDimension)
> CoefficientImageType;
/** Define filter for calculating the BSpline coefficients */
typedef otb::BSplineDecompositionImageFilter<TImageType, CoefficientImageType>
CoefficientFilter;
typedef typename CoefficientFilter::Pointer CoefficientFilterPointer;
/** Evaluate the function at a ContinuousIndex position.
*
* Returns the B-Spline 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;
/** Derivative typedef support */
typedef itk::CovariantVector<OutputType,
itkGetStaticConstMacro(ImageDimension)
> CovariantVectorType;
CovariantVectorType EvaluateDerivative(const PointType& point) const
{
ContinuousIndexType index;
this->GetInputImage()->TransformPhysicalPointToContinuousIndex(point, index);
return (this->EvaluateDerivativeAtContinuousIndex(index));
}
CovariantVectorType EvaluateDerivativeAtContinuousIndex(
const ContinuousIndexType& x) const;
/** Get/Sets the Spline Order, supports 0th - 5th order splines. The default
* is a 3rd order spline. */
void SetSplineOrder(unsigned int SplineOrder);
itkGetMacro(SplineOrder, int);
/** Set the input image. This must be set by the user. */
void SetInputImage(const TImageType * inputData) ITK_OVERRIDE;
/** Update coefficients filter. Coefficient filter are computed over the buffered
region of the input image. */
virtual void UpdateCoefficientsFilter(void);
protected:
BSplineInterpolateImageFunction();
~BSplineInterpolateImageFunction() ITK_OVERRIDE {}
void operator =(const Self&); //purposely not implemented
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
// These are needed by the smoothing spline routine.
std::vector<CoefficientDataType> m_Scratch; // temp storage for processing of Coefficients
typename TImageType::SizeType m_DataLength; // Image size
unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
private:
BSplineInterpolateImageFunction(const Self &); //purposely not implemented
/** Determines the weights for interpolation of the value x */
void SetInterpolationWeights(const ContinuousIndexType& x,
const vnl_matrix<long>& EvaluateIndex,
vnl_matrix<double>& weights,
unsigned int splineOrder) const;
/** Determines the weights for the derivative portion of the value x */
void SetDerivativeWeights(const ContinuousIndexType& x,
const vnl_matrix<long>& EvaluateIndex,
vnl_matrix<double>& weights,
unsigned int splineOrder) const;
/** Precomputation for converting the 1D index of the interpolation neighborhood
* to an N-dimensional index. */
void GeneratePointsToIndex();
/** Determines the indices to use give the splines region of support */
void DetermineRegionOfSupport(vnl_matrix<long>& evaluateIndex,
const ContinuousIndexType& x,
unsigned int splineOrder) const;
/** Set the indices in evaluateIndex at the boundaries based on mirror
* boundary conditions. */
void ApplyMirrorBoundaryConditions(vnl_matrix<long>& evaluateIndex,
unsigned int splineOrder) const;
Iterator m_CIterator; // Iterator for traversing spline coefficients.
unsigned long m_MaxNumberInterpolationPoints; // number of neighborhood points used for interpolation
std::vector<IndexType> m_PointsToIndex; // Preallocation of interpolation neighborhood indices
CoefficientFilterPointer m_CoefficientFilter;
RegionType m_CurrentBufferedRegion;
};
} // namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbBSplineInterpolateImageFunction.txx"
#endif
#endif
|