This file is indexed.

/usr/include/mia-2.2/mia/2d/interpolator.hh is in libmia-2.2-dev 2.2.2-1+b1.

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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/* -*- mia-c++  -*-
 *
 * This file is part of MIA - a toolbox for medical image analysis 
 * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
 *
 * MIA is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MIA; if not, see <http://www.gnu.org/licenses/>.
 *
 */

/*
  The filter routines for splines and omoms is based on code by
  Philippe Thevenaz http://bigwww.epfl.ch/thevenaz/interpolation/
  see also:

  [1] M. Unser,
 	"Splines: A Perfect Fit for Signal and Image Processing,"
 	IEEE Signal Processing Magazine, vol. 16, no. 6, pp. 22-38,
 	November 1999.
  [2] M. Unser, A. Aldroubi and M. Eden,
 	"B-Spline Signal Processing: Part I--Theory,"
 	IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 821-832,
 	February 1993.
  [3]  M. Unser, A. Aldroubi and M. Eden,
 	"B-Spline Signal Processing: Part II--Efficient Design and Applications,"
 	IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 834-848,
 	February 1993.
*/

#ifndef mia_2d_interpolator_hh
#define mia_2d_interpolator_hh

#include <vector>
#include <mia/core/splinekernel.hh>
#include <mia/core/boundary_conditions.hh>
#include <mia/2d/image.hh>


NS_MIA_BEGIN

/**
   @cond INTERNAL 
*/
template <typename T>
struct max_hold_type<T2DVector<T> > {
	typedef T2DVector<double> type;


};
/// @endcond 

/**
   \ingroup interpol 

   \tparam T data type to be interpolated 

   \brief The base class template for all kinds of interpolators 

   Basic Interpolator type for 2D Data.
*/
template <typename T>
class  EXPORT_2D T2DInterpolator  {
public:

	/** a virtual destructor is neccessary for some of the interpolators */
	virtual  ~T2DInterpolator(){}
	/**
	   \param x location of data value to read
	   \returns interpolated value at location x
	 */
	virtual T operator () (const C2DFVector& x) const = 0;
	
	/**
	   \param x location of data value to read
	   \returns interpolated gradient at location x
	*/
	virtual T2DVector<T> derivative_at(const C2DFVector& x) const = 0;

};

/** 
    @cond INTERNAL 
*/
template <class U>
struct coeff_map<T2DVector<U> > {
	typedef T2DVector<U> value_type;
	typedef C2DDVector   coeff_type;
};

/// @endcond 

/**
   \ingroup interpol 

   \tparam T data type to be interpolated 

   \brief The base class for 2D interpolators that use some kind of spacial convolution 

   This class provides the interface for 2D interpolation based on some kind of 
   spacial convolution, like e.g. by using B-splines. 
*/
template <class T>
class EXPORT_2D T2DConvoluteInterpolator: public T2DInterpolator<T> {
public:
	/**
	   Constructor for the interpolator. The input data is pre-filtered in order to 
	   ensure that the interpolation at grid points returns the original data values. 
	   \param data input data to base th einterpolation on 
	   \param kernel the B-spline kernel to be used. 
	*/
	T2DConvoluteInterpolator(const T2DDatafield<T>& data, PSplineKernel kernel);

	/**
	   Construtor to prefilter the input for proper interpolation 
	   \param data the data used for interpolation 
	   \param kernel the spline kernel used for interpolation 
	   \param xbc boundary conditions to be applied along the x-axis when interpolating  
	   \param ybc boundary conditions to be applied along the y-axis when interpolating  
	 */

	T2DConvoluteInterpolator(const T2DDatafield<T>& data, PSplineKernel kernel, 
				 const CSplineBoundaryCondition& xbc, const CSplineBoundaryCondition& ybc);

	~T2DConvoluteInterpolator();


	/**
	   Interpolate at the given input point 
	   \param x input point 
	   \returns interpolated value 
	   \remark this method is not thread save 
	 */
	T  operator () (const C2DFVector& x) const;

	/**
	   Evaluate the first order derivative on the given coordinate 
	   \param x location 
	   \returns teh drivatives in all coordinate directions as 2D vector 
	   \remark this method is not thread save 
	 */
	T2DVector<T> derivative_at(const C2DFVector& x) const;

	/** Data type of the field that holds the cofficients. Essentially, it uses 
	    the coeff_map template to translate whatever T is composed of to something that 
	    is composed of double float values to provide the required accuracy for interpolation. 
	 */
	typedef T2DDatafield< typename coeff_map< T >::coeff_type > TCoeff2D;

	/**
	   \returns the current coefficient field 
	 */
	const TCoeff2D& get_coefficients() const;

protected:
	/// helper class for the coefficient field 
	typedef std::vector< typename TCoeff2D::value_type > coeff_vector;
private:
	
	void prefilter(const T2DDatafield<T>& image); 

	typename TCoeff2D::value_type evaluate() const;

	TCoeff2D m_coeff;
	C2DBounds m_size2;
	PSplineKernel m_kernel;
	PSplineBoundaryCondition m_x_boundary; 
	PSplineBoundaryCondition m_y_boundary; 
	T m_min;
	T m_max;

	/// This part makes the class to be not thread save 
	mutable CSplineKernel::VIndex m_x_index; 
	mutable CSplineKernel::VIndex m_y_index; 
	mutable CSplineKernel::VWeight m_x_weight; 
	mutable CSplineKernel::VWeight m_y_weight; 
	mutable CSplineKernel::SCache m_x_cache; 
	mutable CSplineKernel::SCache m_y_cache; 

	

};

/**
   \ingroup interpol 

   \brief The factory to create an interpolator from some input data 
*/

class EXPORT_2D C2DInterpolatorFactory {
public:
        /**
	   Construct the factory the interpolation  kernel and according boundary conditions 
	   \param kernel description of the interpolation kernel
	   \param boundary_conditions description of the boundary conditions 
	*/
	C2DInterpolatorFactory(const std::string& kernel, const std::string& boundary_conditions);


        /**
	   Construct the factory the interpolation  kernel and according boundary conditions 
	   \param kernel  interpolation kernel
	   \param boundary_conditions prototype boundary condition 
	*/
	C2DInterpolatorFactory(PSplineKernel kernel, const CSplineBoundaryCondition& boundary_conditions);

        /**
	   Construct the factory the interpolation  kernel and according boundary conditions 
	   \param kernel  interpolation kernel
	   \param boundary_conditions description of the boundary conditions 
	*/
	C2DInterpolatorFactory(PSplineKernel kernel, const std::string& boundary_conditions);

	/**
	   Construct the factory the interpolation  kernel and according boundary conditions 
	   \param kernel
	   \param xbc boundary conditions along the x-axis 
	   \param ybc boundary conditions along the y-axis 
	 */
	C2DInterpolatorFactory(PSplineKernel kernel, const CSplineBoundaryCondition& xbc, const CSplineBoundaryCondition& ybc);

	/// Copy constructor 
	C2DInterpolatorFactory(const C2DInterpolatorFactory& o);

	/// Assignment operator 
	C2DInterpolatorFactory& operator = ( const C2DInterpolatorFactory& o);

	virtual ~C2DInterpolatorFactory();

	/**
	   Interpolator creation function 
	   \tparam pixel data type - can be anything that cann be added to itself and 
	   multiplied by a double scalar. The class T must also define the coeff_map trait. 
	   \param src input data to interpolate 
	   \returns the requested interpolator
	 */

	template <class T>
	T2DInterpolator<T> *create(const T2DDatafield<T>& src) const
		__attribute__ ((warn_unused_result));


	/**
	   \returns raw pointer to the interpolation kernel. 
	 */
	const CSplineKernel* get_kernel() const;

private:
	PSplineKernel m_kernel;
	PSplineBoundaryCondition m_xbc;
	PSplineBoundaryCondition m_ybc;
};

/// Pointer type for the 2D interpolationfactory 
typedef std::shared_ptr<C2DInterpolatorFactory > P2DInterpolatorFactory;


/**
   create a 2D interpolation factory of a certain interpolation type 
*/
C2DInterpolatorFactory EXPORT_2D  *create_2dinterpolation_factory(EInterpolation type, EBoundaryConditions bc)
	__attribute__ ((warn_unused_result));

// implementation

template <class T>
T2DInterpolator<T> *C2DInterpolatorFactory::create(const T2DDatafield<T>& src) const
{
	return new T2DConvoluteInterpolator<T>(src, m_kernel, *m_xbc, *m_ybc);
}

NS_MIA_END

#endif