This file is indexed.

/usr/include/InsightToolkit/Review/itkQuadEdgeMeshParamMatrixCoefficients.h is in libinsighttoolkit3-dev 3.20.1-1.

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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkQuadEdgeMeshParamMatrixCoefficients.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 __itkQuadEdgeMeshParamMatrixCoefficients_h
#define __itkQuadEdgeMeshParamMatrixCoefficients_h

#include "itkQuadEdgeMesh.h"
#include "itkCrossHelper.h"
#include "itkTriangleHelper.h"
#include <vnl/vnl_math.h>

namespace itk
{
/** \class MatrixCoefficients
 * \brief Superclass for all the matrix coefficients computation classes.
 * \note  Belongs to the parameterisation package.
 */
template< typename TInputMesh >
class MatrixCoefficients
{
public:
  typedef TInputMesh                              InputMeshType;
  typedef typename InputMeshType::CoordRepType    InputCoordRepType;
  typedef typename InputMeshType::QEType          InputQEType;

  MatrixCoefficients( ){}
  virtual ~MatrixCoefficients( ) {}

  virtual InputCoordRepType operator ( )
      ( const InputMeshType* iMesh, InputQEType* iEdge ) const = 0;
};

/** \class OnesMatrixCoefficients
 * \brief Compute a matrix filled by 1s wherever two vertices are connected
 *        by an edge.
 * \note  Belongs to the parameterisation package.
 * \note  See paper:
 */
template< typename TInputMesh >
class OnesMatrixCoefficients : public MatrixCoefficients< TInputMesh >
{
public:
  typedef MatrixCoefficients< TInputMesh > Superclass;

  typedef TInputMesh                              InputMeshType;
  typedef typename InputMeshType::CoordRepType    InputCoordRepType;
  typedef typename InputMeshType::QEType          InputQEType;

  OnesMatrixCoefficients() {}

  /**
   * \param[in] iMesh
   * \param[in] iEdge
   * \return \f$ 1 \f$
   */
  InputCoordRepType operator ( ) ( const InputMeshType * itkNotUsed( iMesh ),
                                   InputQEType *   itkNotUsed( iEdge ) ) const
    {
    return 1.0;
    }
};

/** \class InverseEuclideanDistanceMatrixCoefficients
 * \brief Compute a matrix filed with the inverse of the euclidian distance
 *        wherever two vertices are connected by an edge.
 * \note  Belongs to the parameterisation package.
 * \note  See paper: ...
 */
template< typename TInputMesh >
class InverseEuclideanDistanceMatrixCoefficients :
    public MatrixCoefficients< TInputMesh >
{
public:
  typedef MatrixCoefficients< TInputMesh > Superclass;

  typedef TInputMesh                              InputMeshType;
  typedef typename InputMeshType::CoordRepType    InputCoordRepType;
  typedef typename InputMeshType::PointType       InputPointType;
  typedef typename InputMeshType::PointIdentifier InputPointIdentifier;
  typedef typename InputMeshType::QEType          InputQEType;
  typedef typename InputMeshType::VectorType      InputVectorType;

  InverseEuclideanDistanceMatrixCoefficients() {}

  /**
   * \param[in] iMesh
   * \param[in] iEdge
   * \return \f$ \frac{1}{\|\boldsymbol{p1} - \boldsymbol{p2} \|} \f$
   */
  InputCoordRepType operator () ( const InputMeshType* iMesh, InputQEType* iEdge ) const
    {
    InputPointIdentifier id1 = iEdge->GetOrigin( );
    InputPointIdentifier id2 = iEdge->GetDestination( );

    InputPointType pt1 = iMesh->GetPoint( id1 );
    InputPointType pt2 = iMesh->GetPoint( id2 );

    InputCoordRepType oValue = 1.0 / pt1.EuclideanDistanceTo( pt2 );

    return oValue;
    }
};


/** \class ConformalMatrixCoefficients
 * \brief Compute a matrix filed by Conformal Coefficients of the edge
 *        wherever two vertices are connected by an edge.
 * \note  Belongs to the parameterisation package.
 * \note  See paper ...
 */
template< typename TInputMesh >
class ConformalMatrixCoefficients : public MatrixCoefficients< TInputMesh >
{
public:
  typedef MatrixCoefficients< TInputMesh > Superclass;

  typedef TInputMesh                              InputMeshType;
  typedef typename InputMeshType::CoordRepType    InputCoordRepType;
  typedef typename InputMeshType::PointType       InputPointType;
  typedef typename InputMeshType::PointIdentifier InputPointIdentifier;
  typedef typename InputMeshType::QEType          InputQEType;

  ConformalMatrixCoefficients() { }

  /**
   * \param[in] iMesh
   * \param[in] iEdge
   * \return \f$ \text{cot} \alpha_{ij} + \text{cot} \beta_{ij} \f$
   */
  InputCoordRepType operator ( ) ( const InputMeshType* iMesh, InputQEType* iEdge ) const
    {
    InputPointIdentifier id1 = iEdge->GetOrigin( );
    InputPointIdentifier id2 = iEdge->GetDestination( );
    InputPointType pt1 = iMesh->GetPoint( id1 );
    InputPointType pt2 = iMesh->GetPoint( id2 );
    
    InputCoordRepType oValue( 0.0 );

    if( iEdge->IsLeftSet() )
      {
      InputPointIdentifier idA = iEdge->GetLnext( )->GetDestination( );
      InputPointType ptA = iMesh->GetPoint( idA );
      oValue += TriangleHelper< InputPointType >::Cotangent( pt1, ptA, pt2);
      }
    if( iEdge->IsRightSet() )
      {
      InputPointIdentifier idB = iEdge->GetRnext( )->GetOrigin( );
      InputPointType ptB = iMesh->GetPoint( idB );
      oValue += TriangleHelper< InputPointType >::Cotangent( pt1, ptB, pt2);
      }

    return vnl_math_max( static_cast< InputCoordRepType >( 0.0 ), oValue );
    }
};

/**\class AuthalicMatrixCoefficients
 *
 * \brief Compute a matrix filled with Authalic Coefiicients of the edge,
 *        wherever two vertices are connected with an edge.
 * \note  Belongs to the Parameterisation package.
 * \note  See paper:
 */
template< typename TInputMesh >
class AuthalicMatrixCoefficients : public MatrixCoefficients< TInputMesh >
{
public:
  typedef MatrixCoefficients< TInputMesh >        Superclass;

  typedef TInputMesh                              InputMeshType;
  typedef typename InputMeshType::CoordRepType    InputCoordRepType;
  typedef typename InputMeshType::PointType       InputPointType;
  typedef typename InputMeshType::PointIdentifier InputPointIdentifier;
  typedef typename InputMeshType::QEType          InputQEType;

  AuthalicMatrixCoefficients() { }

  /**
   * \param[in] iMesh
   * \param[in] iEdge
   * \return \f$ \frac{\text{cot} \gamma_{ij} + \text{cot}
   \delta_{ij}}{\|\boldsymbol{p1} - \boldsymbol{p2} \|} \f$
   */
  InputCoordRepType operator ( ) ( const InputMeshType* iMesh, InputQEType* iEdge ) const
    {
    InputPointIdentifier id1 = iEdge->GetOrigin( );
    InputPointType pt1 = iMesh->GetPoint( id1 );
    
    InputPointIdentifier id2 = iEdge->GetDestination( );
    InputPointType pt2 = iMesh->GetPoint( id2 );
    
    InputCoordRepType oValue( 0.0 );

    if( iEdge->IsLeftSet() )
      {
      InputPointIdentifier idA = iEdge->GetLnext( )->GetDestination( );
      InputPointType ptA = iMesh->GetPoint( idA );
      oValue +=
        TriangleHelper< InputPointType >::Cotangent( pt1, pt2, ptA );
      }

    if( iEdge->IsRightSet() )
      {
      InputPointIdentifier idB = iEdge->GetRnext( )->GetOrigin( );
      InputPointType ptB = iMesh->GetPoint( idB );
      oValue += TriangleHelper< InputPointType >::Cotangent( pt1, pt2, ptB );
      }

    return oValue / pt1.EuclideanDistanceTo( pt2 );
    }
};

/** \class IntrinsicMatrixCoefficients
 * \brief Compute a mtrix filled by intrinsic Coefficients of the edge,
 *        wherever two vertices are connected by an edge.
 * \note  Belongs to the parameterization Package.
 * \note  See paper:
 */
template< typename TInputMesh >
class IntrinsicMatrixCoefficients : public MatrixCoefficients< TInputMesh >
{
public:
  typedef MatrixCoefficients< TInputMesh >        Superclass;

  typedef TInputMesh                              InputMeshType;
  typedef typename InputMeshType::CoordRepType    InputCoordRepType;
  typedef typename InputMeshType::QEType          InputQEType;

  InputCoordRepType m_Lambda;

  IntrinsicMatrixCoefficients( const InputCoordRepType& iLambda ) :
      m_Lambda( iLambda )
    { }

  InputCoordRepType operator ( ) ( const InputMeshType* iMesh,
                                  InputQEType* iEdge ) const
    {
    AuthalicMatrixCoefficients< TInputMesh >   authalic;
    ConformalMatrixCoefficients< TInputMesh >  conformal;

    InputCoordRepType oValue = m_Lambda * conformal( iMesh, iEdge )
      + ( 1.0 - m_Lambda ) * authalic( iMesh, iEdge );

    return oValue;
    }
};

/** \class HarmonicMatrixCoefficients
 * \brief Compute a matrix filled with Harmonic coefficients, wherever
 *        two vertices are connected by an edge.
 * \note  Belongs to the parameterization package.
 * \note  See paper:
 */
template< typename TInputMesh >
class HarmonicMatrixCoefficients : public MatrixCoefficients< TInputMesh >
{
public:
  typedef MatrixCoefficients< TInputMesh > Superclass;

  typedef TInputMesh                                InputMeshType;
  typedef typename InputMeshType::CoordRepType      InputCoordRepType;
  typedef typename InputMeshType::PointType         InputPointType;
  typedef typename InputPointType::VectorType       InputVectorType;
  typedef typename InputMeshType::PointIdentifier   InputPointIdentifier;
  typedef typename InputMeshType::QEType            InputQEType;

  itkStaticConstMacro( PointDimension, unsigned int,
      InputPointType::PointDimension );


  HarmonicMatrixCoefficients() { }


  InputCoordRepType operator () ( const InputMeshType* iMesh, InputQEType* iEdge ) const
    {
    InputPointIdentifier id1 = iEdge->GetOrigin( );
    InputPointIdentifier id2 = iEdge->GetDestination( );

    InputPointIdentifier idA = iEdge->GetLnext( )->GetDestination( );
    InputPointIdentifier idB = iEdge->GetRnext( )->GetOrigin( );

    InputPointType pt1 = iMesh->GetPoint( id1 );
    InputPointType pt2 = iMesh->GetPoint( id2 );
    InputPointType ptA = iMesh->GetPoint( idA );
    InputPointType ptB = iMesh->GetPoint( idB );

    InputVectorType v1A = ptA - pt1;
    InputVectorType v1B = ptB - pt1;
    InputVectorType v12 = pt2 - pt1;

    InputCoordRepType L1A = v1A * v1A;
    InputCoordRepType L1B = v1B * v1B;
    InputCoordRepType L12 = v12 * v12;

    InputCoordRepType L2A = pt2.SquaredEuclideanDistanceTo( ptA );
    InputCoordRepType L2B = pt2.SquaredEuclideanDistanceTo( ptB );

    CrossHelper< InputVectorType > cross;

    InputCoordRepType AreaA = 0.5 * ( cross( v1A, v12 ).GetNorm( ) );
    InputCoordRepType AreaB = 0.5 * ( cross( v1B, v12 ).GetNorm( ) );

    InputCoordRepType
        oValue = ( L1A + L2A - L12 ) / AreaA + ( L1B + L2B - L12 ) / AreaB;

    return oValue;
    }
};

}
#endif