This file is indexed.

/usr/include/InsightToolkit/Review/itkQuadEdgeMeshParam.txx 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
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkQuadEdgeMeshParam.txx
  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 __itkQuadEdgeMeshParam_txx
#define __itkQuadEdgeMeshParam_txx

#include "itkQuadEdgeMeshParam.h"

namespace itk
{

// ---------------------------------------------------------------------
template< typename TInputMesh, typename TOutputMesh, typename TSolverTraits >
QuadEdgeMeshParam< TInputMesh, TOutputMesh, TSolverTraits >
::QuadEdgeMeshParam()
{
  this->m_CoefficientsMethod = 0;
  this->m_BorderTransform = 0;
}

// ---------------------------------------------------------------------
template< typename TInputMesh, typename TOutputMesh, typename TSolverTraits >
void
QuadEdgeMeshParam< TInputMesh, TOutputMesh, TSolverTraits >
::CopyToOutputBorder( )
{
  OutputMeshType* output = this->GetOutput( );

  for( InputMapPoinIdentifierIterator it = m_BoundaryPtMap.begin( );
       it != m_BoundaryPtMap.end( );
       ++it )
    {
    output->SetPoint( it->first, m_Border[it->second] );
    }
}

// ---------------------------------------------------------------------
template< typename TInputMesh, typename TOutputMesh, typename TSolverTraits >
void
QuadEdgeMeshParam< TInputMesh, TOutputMesh, TSolverTraits >
::ComputeListOfInteriorVertices( )
{
  InputMeshConstPointer input = this->GetInput( );

  typename InputPointsContainer::ConstPointer points = input->GetPoints( );

  InputPointIdentifier k( 0 );
  InputPointIdentifier id( 0 );

  for( InputPointsContainerConstIterator it = points->Begin( );
        it != points->End( );
        ++it )
    {
    id = it->Index( );

    // if the id point is not in m_BoundaryPtMap
    // add this id point to m_InternalPtMap
    if( m_BoundaryPtMap.find( id ) == m_BoundaryPtMap.end( ) )
      {
      m_InternalPtMap[id] = k++;
      }
    }
}

// ---------------------------------------------------------------------
template< typename TInputMesh, typename TOutputMesh, typename TSolverTraits >
void
QuadEdgeMeshParam< TInputMesh, TOutputMesh, TSolverTraits >
::SolveLinearSystems( const MatrixType& iM, const VectorType& iBx,
       const VectorType& iBy, VectorType& oX, VectorType& oY )
{
  SolverTraits traits;
  traits.Solve( iM, iBx, iBy, oX, oY );
}

// ---------------------------------------------------------------------
template< typename TInputMesh, typename TOutputMesh, typename TSolverTraits >
void
QuadEdgeMeshParam< TInputMesh, TOutputMesh, TSolverTraits >
::FillMatrix( MatrixType& iM, VectorType& ioBx, VectorType& ioBy )
{
  InputMeshConstPointer input   = this->GetInput( );
  OutputMeshPointer output = this->GetOutput( );

  SolverTraits traits;

  InputCoordRepType value;

  InputMapPoinIdentifierIterator it;

  InputPointIdentifier id1, id2;
  InputPointIdentifier InternalId1, InternalId2;

  OutputPointType pt2;

  ValueType k[2];

  for( InputMapPoinIdentifierIterator
       InternalPtIterator = m_InternalPtMap.begin( );
       InternalPtIterator != m_InternalPtMap.end( );
       ++InternalPtIterator )
    {
    id1 = InternalPtIterator->first;
    InternalId1 = InternalPtIterator->second;

    k[0] = 0.;
    k[1] = 0.;

    InputQEType* edge = input->FindEdge( id1 );
    InputQEType* temp = edge;

    do
      {
      id2 = temp->GetDestination( );

      it = m_BoundaryPtMap.find( id2 );

      if( it != m_BoundaryPtMap.end( ) )
        {
        value = ( *m_CoefficientsMethod )( input, temp );
        pt2 = output->GetPoint( it->first );
        traits.AddToMatrix( iM, InternalId1, InternalId1, value );
        k[0] += static_cast< ValueType >( pt2[0] * value );
        k[1] += static_cast< ValueType >( pt2[1] * value );
        }
      else
        {
        InternalId2 = m_InternalPtMap[id2];
        if( InternalId1 < InternalId2 )
          {
          value = ( *m_CoefficientsMethod )( input, temp );
          traits.FillMatrix( iM, InternalId1, InternalId2, -value );
          traits.FillMatrix( iM, InternalId2, InternalId1, -value );
          traits.AddToMatrix( iM, InternalId1, InternalId1, value );
          traits.AddToMatrix( iM, InternalId2, InternalId2, value );
          }
       }

      temp = temp->GetOnext( );

      } while( temp != edge );

    ioBx[InternalId1] = k[0];
    ioBy[InternalId1] = k[1];
    }
}

// ---------------------------------------------------------------------
template< typename TInputMesh, typename TOutputMesh, typename TSolverTraits >
void
QuadEdgeMeshParam< TInputMesh, TOutputMesh, TSolverTraits >
::GenerateData( )
{
  this->CopyInputMeshToOutputMesh( );

  InputMeshConstPointer input = this->GetInput( );
  OutputMeshType* output = this->GetOutput( );

  if( m_BorderTransform.IsNotNull( ) )
    {
    m_BorderTransform->Update( );
    m_Border = m_BorderTransform->GetBorder( );
    m_BoundaryPtMap = m_BorderTransform->GetBoundaryPtMap( );
    }

  itkAssertOrThrowMacro( ( ( m_BoundaryPtMap.size( ) > 2 ) && ( m_Border.size( ) > 2 ) ),
    "BoundaryPtMap or Border have less than 2 elements" );

  this->CopyToOutputBorder( );

  this->ComputeListOfInteriorVertices( );

  size_t NbOfInteriorPts = m_InternalPtMap.size( );

  SolverTraits traits;

  MatrixType Matrix = traits.InitializeSparseMatrix( NbOfInteriorPts );
  VectorType Bx = traits.InitializeVector( NbOfInteriorPts );
  VectorType By = traits.InitializeVector( NbOfInteriorPts );
  VectorType X = traits.InitializeVector( NbOfInteriorPts );
  VectorType Y = traits.InitializeVector( NbOfInteriorPts );

  FillMatrix( Matrix, Bx, By );

  SolveLinearSystems( Matrix, Bx, By, X, Y );

  OutputPointType OutputPt;

  for( InputMapPoinIdentifierIterator PtIterator = m_InternalPtMap.begin( );
       PtIterator != m_InternalPtMap.end( );
       ++PtIterator )
    {
    OutputPointIdentifier id = static_cast< OutputPointIdentifier >( PtIterator->first );
    InputPointIdentifier InternalId = PtIterator->second;

    OutputPt[0] = X[InternalId];
    OutputPt[1] = Y[InternalId];
    OutputPt[2] = 0.;

    output->SetPoint( id, OutputPt );
    }
}

} // end namespace itk

#endif