Orfeo Toolbox  4.0
otbAngularProjectionSetImageFilter.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 __otbAngularProjectionSetImageFilter_txx
19 #define __otbAngularProjectionSetImageFilter_txx
21 
22 #include <vnl/vnl_math.h>
23 
25 #include <itkImageRegionIterator.h>
26 
27 namespace otb {
28 
29 template < class TInputImage, class TOutputImage, class TAngleList, class TPrecision >
32 {
33  //this->SetNumberOfRequiredInputs( NumberOfInputImages );
34  this->SetNumberOfRequiredOutputs(1);
35  this->SetNthOutput(0, OutputImageListType::New());
36 
37  m_FilterList = FilterListType::New();
38  m_AngleList = AngleListType::New();
39 }
40 
41 template < class TInputImage, class TOutputImage, class TAngleList, class TPrecision >
42 void
44 ::SetInput ( unsigned int i, const InputImageType * img )
45 {
47  const_cast< InputImageType * >( img ) );
48 }
49 
50 template < class TInputImage, class TOutputImage, class TAngleList, class TPrecision >
51 const TInputImage *
53 ::GetInput ( unsigned int i ) const
54 {
55  if ( i >= this->GetNumberOfInputs() )
56  {
57  return 0;
58  }
59 
60  return static_cast<const InputImageType * >
61  (this->itk::ProcessObject::GetInput(i) );
62 }
63 
64 
65 template < class TInputImage, class TOutputImage, class TAngleList, class TPrecision >
66 void
69 {
71  progress->SetMiniPipelineFilter(this);
72 
73  std::cerr << "Using " << GetAngleList()->Size() << " outputs...\n";
74  GetFilterList()->Resize( GetAngleList()->Size() );
75  this->GetOutput()->Resize( GetAngleList()->Size() );
76 
77  for ( unsigned int idx = 0; idx < GetFilterList()->Size(); ++idx )
78  {
79  GetFilterList()->SetNthElement(0, FilterType::New());
80  FilterPointerType filter = GetFilterList()->GetNthElement(0);
81  for ( unsigned int i = 0; i < this->GetNumberOfInputs(); ++i )
82  filter->SetInput( i, this->GetInput(i) );
83  filter->SetAngleArray( GetAngleList()->GetMeasurementVector(idx) );
84 
85  progress->RegisterInternalFilter(filter, 1.f/static_cast<float>( GetAngleList()->Size() ) );
86 
87  filter->Update();
88 
89  this->GetOutput()->SetNthElement( idx, filter->GetOutput() );
90  }
91 }
92 
93 } // end of namespace otb
94 
95 #endif
96 
97 

Generated at Sat Mar 8 2014 15:50:06 for Orfeo Toolbox with doxygen 1.8.3.1