Orfeo Toolbox  3.16
otbNearestPointDeformationFieldGenerator.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbNearestPointDeformationFieldGenerator_txx
19 #define __otbNearestPointDeformationFieldGenerator_txx
20 
23 #include "otbMacro.h"
24 
25 namespace otb
26 {
28 template <class TPointSet, class TDeformationField>
29 void
32 {
33  DeformationFieldPointerType outputPtr = this->GetOutput();
34  PixelType defaultValue(2);
35  defaultValue.Fill(this->GetDefaultValue());
36  outputPtr->Allocate();
37  outputPtr->FillBuffer(defaultValue);
38 
40  IteratorType it(outputPtr, outputPtr->GetRequestedRegion());
41 
42  for (it.GoToBegin(); !it.IsAtEnd(); ++it)
43  {
44  IndexVectorType indexVector = this->GenerateNearestValidPointsPointSet(it.GetIndex(), 1);
45  PixelType p(2);
46  if (indexVector.size() >= 1)
47  {
48  p[0] = static_cast<ValueType>(this->GetPointSet()->GetPointData()->GetElement(indexVector[0])[1]);
49  p[1] = static_cast<ValueType>(this->GetPointSet()->GetPointData()->GetElement(indexVector[0])[2]);
50  }
51  else
52  {
53  p = defaultValue;
54  }
55  it.Set(p);
56  }
57 }
61 template <class TPointSet, class TDeformationField>
62 void
64 ::PrintSelf(std::ostream& os, itk::Indent indent) const
65 {
66  Superclass::PrintSelf(os, indent);
67 }
68 } // End namespace otb
69 #endif

Generated at Sun Feb 3 2013 00:39:59 for Orfeo Toolbox with doxygen 1.8.1.1