This file is indexed.

/usr/include/ITK-4.5/itkTestDriverAfterTest.inc is in libinsighttoolkit4-dev 4.5.0-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
/*=========================================================================
*
*  Copyright Insight Software Consortium
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*         http://www.apache.org/licenses/LICENSE-2.0.txt
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*
*=========================================================================*/

// This code fragment is included in the test driver generated by the
// CMake command create_test_sourcelist. This is included directly after
// the call to the test main function. It performs optional redirection
// of test output and regression testing if needed.

if (redirectOutputParameters.redirect)
  {
  // Restore cout
  std::cout.rdbuf(oldCoutBuf);
  redirectStream.close();
  }

// before the image to image compare we first check md5 hashes
for( size_t li = 0; li < hashTestList.size(); ++li )
  {
  const char * const testFilename = hashTestList[li].first;

  const int ret = HashTestImage( testFilename, hashTestList[li].second );
  if ( ret )
    {
    result = EXIT_FAILURE; //Nonzero indicates failure
    }
  }

// Make a list of possible baselines
for ( int ii = 0;
      ii < static_cast< int >( regressionTestParameters.compareList.size() );
      ii++ )
  {
  char * baselineFilename = regressionTestParameters.compareList[ii].first;
  char * testFilename =     regressionTestParameters.compareList[ii].second;
  std::map< std::string, int > baselines =
    RegressionTestBaselines(baselineFilename);
  std::map< std::string, int >::iterator baseline = baselines.begin();
  std::string bestBaseline = baseline->first;
  int  bestBaselineStatus = itk::NumericTraits< int >::max();
  bool oneReferenceImageWasReadable=false;
  while ( baseline != baselines.end() )
    {
    baseline->second =
      RegressionTestImage(testFilename,
                          ( baseline->first ).c_str(),
                          0,
                          regressionTestParameters.intensityTolerance,
                          regressionTestParameters.numberOfPixelsTolerance,
                          regressionTestParameters.radiusTolerance);

    if ( baseline->second == itk::NumericTraits< int >::max() )
      {
      //Reference Image not found
      }
    else if ( baseline->second == itk::NumericTraits< int >::max() -2 )
      {
      //Test Image not found.  Immediate failure! (No further testing needed)
      break;
      }
    else if ( baseline->second == itk::NumericTraits< int >::max() -1 )
      {
      //Image dimensions do not match
      }
    else if ( baseline->second < bestBaselineStatus )
      {
      // A better image was found
      bestBaseline = baseline->first;
      bestBaselineStatus = baseline->second;
      oneReferenceImageWasReadable = true;
      }
    if ( baseline->second == 0 )
      {
      break;
      }
    ++baseline;
    }
  if ( oneReferenceImageWasReadable )
    {
    // if the best we can do still has errors, generate the error images
    if ( bestBaselineStatus  )
      {
      RegressionTestImage( testFilename,
        bestBaseline.c_str(),
        1,
        regressionTestParameters.intensityTolerance,
        regressionTestParameters.numberOfPixelsTolerance,
        regressionTestParameters.radiusTolerance);
        result = EXIT_FAILURE; //Nonzero indicates failure
      }
    // output the matching baseline
    std::cout << "<DartMeasurement name=\"BaselineImageName\" type=\"text/string\">"
              << itksys::SystemTools::GetFilenameName(bestBaseline)
              << "</DartMeasurement>" << std::endl;
    }
  else
    {
    std::cout << "<DartMeasurement name=\"BaselineImageName\" type=\"text/string\">"
              << "INVALID_BASELINE_GIVEN"
              << "</DartMeasurement>" << std::endl;
    result = EXIT_FAILURE; //Nonzero indicates failure
    }
  }
}
  catch ( const itk::ExceptionObject & e )
    {
    std::cerr << "ITK test driver caught an ITK exception:\n";
    e.Print(std::cerr);
    result = EXIT_FAILURE;
    }
  catch ( const std::exception & e )
    {
    std::cerr << "ITK test driver caught an exception:\n";
    std::cerr << e.what() << "\n";
    result = EXIT_FAILURE;
    }
  catch ( ... )
    {
    std::cerr << "ITK test driver caught an unknown exception!!!\n";
    result = EXIT_FAILURE;
    }