This file is indexed.

/usr/include/OTB-5.8/otbMorphologicalPyramidResampler.txx 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
/*=========================================================================

  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 otbMorphologicalPyramidResampler_txx
#define otbMorphologicalPyramidResampler_txx
#include "otbMorphologicalPyramidResampler.h"
#include "itkResampleImageFilter.h"
#include "itkScalableAffineTransform.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
#include "itkProgressAccumulator.h"

namespace otb
{
namespace MorphologicalPyramid
{
/**
 * Constructor
 */
template <class TInputImage, class TOutputImage>
Resampler<TInputImage, TOutputImage>
::Resampler()
{
  for (unsigned int i = 0; i < InputImageType::ImageDimension; ++i)
    {
    m_Size[i] = 0;
    }
}
/**
 * Configure input requested region to be the largest possible region.
 */
template <class TInputImage, class TOutputImage>
void
Resampler<TInputImage, TOutputImage>
::GenerateInputRequestedRegion()
{
  // Superclass method call
  Superclass::GenerateInputRequestedRegion();
  // Input and output image pointers retrieval
  InputImagePointer  inputPtr = const_cast<InputImageType *> (this->GetInput());
  OutputImagePointer outputPtr = this->GetOutput();
  // If the pointers are not correct
  if (!inputPtr || !outputPtr)
    {
    // exit
    return;
    }
  // else
  // Configure input requested region to be the largest possible region
  inputPtr->SetRequestedRegion(inputPtr->GetLargestPossibleRegion());
}
/**
 * Configure output requested region to be the largest possible region
 */
template <class TInputImage, class TOutputImage>
void
Resampler<TInputImage, TOutputImage>
::EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output))
{
  this->GetOutput()->SetRequestedRegion(this->GetOutput()->GetLargestPossibleRegion());
}
/**
 * Generate output information
 */
template <class TInputImage, class TOutputImage>
void
Resampler<TInputImage, TOutputImage>
::GenerateOutputInformation()
{
  // Superclass method call
  Superclass::GenerateOutputInformation();
  // Input and output image pointers retrieval
  InputImageConstPointer inputPtr  = this->GetInput();
  OutputImagePointer     outputPtr = this->GetOutput();
  // If the pointers are not correct
  if (!inputPtr || !outputPtr)
    {
    // exit
    return;
    }
  unsigned int i;
  // Computing output spacing, size and index from input data
  const typename InputImageType::SpacingType& inputSpacing    = inputPtr->GetSpacing();
  const typename InputImageType::IndexType&   inputStartIndex = inputPtr->GetLargestPossibleRegion().GetIndex();
  typename OutputImageType::IndexType         outputStartIndex;
  typename OutputImageType::SpacingType       spacing;
  for (i = 0; i < OutputImageType::ImageDimension; ++i)
    {
    outputStartIndex[i] =  inputStartIndex[i];
    }

  outputPtr->SetSpacing(inputSpacing);
  typename OutputImageType::RegionType outputLargestPossibleRegion;
  outputLargestPossibleRegion.SetSize(this->GetSize());
  outputLargestPossibleRegion.SetIndex(outputStartIndex);
  outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion);
}
/**
 * Main computation method
 */
template <class TInputImage, class TOutputImage>
void
Resampler<TInputImage, TOutputImage>
::GenerateData()
{
  typename OutputImageType::Pointer result;

  // Filters typedefs
  typedef itk::ResampleImageFilter<InputImageType, OutputImageType>   ResampleFilterType;
  typedef itk::ScalableAffineTransform<double, InputImageType::ImageDimension> TransformType;
  typedef itk::LinearInterpolateImageFunction<InputImageType, double> InterpolatorType;

  // Resampling filter creation
  typename ResampleFilterType::Pointer resampler = ResampleFilterType::New();
  typename InterpolatorType::Pointer   interpolator = InterpolatorType::New();
  typename TransformType::Pointer      transform = TransformType::New();

  // Scale parameters computation
  typename TransformType::InputVectorType scales;
  typename InputImageType::SizeType    inputSize = this->GetInput()->GetLargestPossibleRegion().GetSize();
  typename InputImageType::SpacingType inputSpacing = this->GetInput()->GetSpacing();
  scales[0] = static_cast<double>(inputSize[0]) / static_cast<double>(m_Size[0]);
  scales[1] = static_cast<double>(inputSize[1]) / static_cast<double>(m_Size[1]);
  transform->SetScale(scales);
  transform->SetCenter(this->GetInput()->GetOrigin());
  typename TransformType::OutputVectorType translation;
  translation[0] = 0.5 * inputSpacing[0] * (scales[0] - 1.0);
  translation[1] = 0.5 * inputSpacing[1] * (scales[1] - 1.0);
  transform->SetTranslation(translation);


  // Resampling filter set up
  resampler->SetTransform(transform);
  resampler->SetInterpolator(interpolator);
  resampler->SetOutputOrigin(this->GetInput()->GetOrigin());
  resampler->SetSize(this->GetSize());
  resampler->SetOutputSpacing(inputSpacing);
  resampler->ReleaseDataFlagOn();

  // Progress accumulator
  itk::ProgressAccumulator::Pointer progress = itk::ProgressAccumulator::New();
  progress->SetMiniPipelineFilter(this);
  progress->RegisterInternalFilter(resampler, .5f);

  // Input image connexion
  resampler->SetInput(this->GetInput());
  resampler->Update();
  result = resampler->GetOutput();

  /** Output filter connexion */
  this->GraftOutput(result);
}
/**
 * PrintSelf method
 */
template <class TInputImage, class TOutputImage>
void
Resampler<TInputImage, TOutputImage>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
  Superclass::PrintSelf(os, indent);
  os << indent << "Size: " << m_Size << std::endl;
}
} // End namespace MorphologicalPyramid
} // End namespace otb
#endif