OTB  5.0.0
Orfeo Toolbox
otbFunctionToImageFilter.h
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  Some parts of this code are derived from ITK. See ITKCopyright.txt
13  for details.
14 
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notices for more information.
19 
20 =========================================================================*/
21 #ifndef __otbFunctionToImageFilter_h
22 #define __otbFunctionToImageFilter_h
23 
24 #include "itkInPlaceImageFilter.h"
25 #include "itkImageFunction.h"
26 #include "itkImageRegionIterator.h"
27 #include "itkSize.h"
28 #include "itkSpatialFunction.h"
29 
30 namespace otb
31 {
32 
53 template <class TInputImage, class TOutputImage, class TFunction>
54 class ITK_EXPORT FunctionToImageFilter :
55  public itk::InPlaceImageFilter<TInputImage, TOutputImage>
56 {
57 public:
63 
65  itkNewMacro(Self);
66 
68  itkTypeMacro(FunctionToImageFilter, InPlaceImageFilter);
69 
73  typedef TInputImage InputImageType;
74  typedef typename InputImageType::ConstPointer InputImagePointer;
75  typedef typename InputImageType::RegionType InputImageRegionType;
76  typedef typename InputImageType::PixelType InputImagePixelType;
77  typedef TOutputImage OutputImageType;
78  typedef typename OutputImageType::Pointer OutputImagePointer;
79  typedef typename OutputImageType::RegionType OutputImageRegionType;
80  typedef typename OutputImageType::PixelType OutputImagePixelType;
81 
83  typedef TFunction FunctionType;
84  typedef typename FunctionType::Pointer FunctionPointer;
87 
89  void SetFunction(FunctionType* PixelFunction)
90  {
91  m_PixelFunction = PixelFunction;
92  this->Modified();
93  }
95  {
96  return m_PixelFunction;
97  }
99 
100 
102  itkStaticConstMacro(InputImageDimension, unsigned int,
103  TInputImage::ImageDimension);
104  itkStaticConstMacro(OutputImageDimension, unsigned int,
105  TOutputImage::ImageDimension);
107 
108 protected:
111 
114  virtual void BeforeThreadedGenerateData();
115 
126  virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
127  itk::ThreadIdType threadId);
128 
129 private:
130  FunctionToImageFilter(const Self &); //purposely not implemented
131  void operator =(const Self&); //purposely not implemented
132 
135 };
136 
137 } // end namespace otb
138 
139 #ifndef OTB_MANUAL_INSTANTIATION
141 #endif
142 
143 #endif
OutputImageType::Pointer OutputImagePointer
FunctionType::Pointer FunctionPointer
InputImageType::RegionType InputImageRegionType
void SetFunction(FunctionType *PixelFunction)
InputImageType::ConstPointer InputImagePointer
FunctionType::OutputType FunctionValueType
Evaluates a ImageFunction onto a source image.
itk::SmartPointer< Self > Pointer
OutputImageType::RegionType OutputImageRegionType
OutputImageType::PixelType OutputImagePixelType
InputImageType::PixelType InputImagePixelType
itk::SmartPointer< const Self > ConstPointer
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
Calculate the backscatter for the given pixel.
FunctionType::InputType FunctionPositionType
unsigned int ThreadIdType