Orfeo ToolBox  4.2
Orfeo ToolBox is not a black box
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 "itkImageToImageFilter.h"
28 #include "itkSize.h"
29 #include "itkSpatialFunction.h"
30 
31 namespace otb
32 {
33 
52 template <class TInputImage, class TOutputImage, class TFunction>
53 class ITK_EXPORT FunctionToImageFilter :
54  public itk::InPlaceImageFilter<TInputImage, TOutputImage>
55 {
56 public:
62 
64  itkNewMacro(Self);
65 
67  itkTypeMacro(FunctionToImageFilter, InPlaceImageFilter);
68 
71  typedef TInputImage InputImageType;
72  typedef typename InputImageType::ConstPointer InputImagePointer;
73  typedef typename InputImageType::RegionType InputImageRegionType;
74  typedef typename InputImageType::PixelType InputImagePixelType;
75  typedef TOutputImage OutputImageType;
76  typedef typename OutputImageType::Pointer OutputImagePointer;
77  typedef typename OutputImageType::RegionType OutputImageRegionType;
78  typedef typename OutputImageType::PixelType OutputImagePixelType;
80  typedef TFunction FunctionType;
81  typedef typename FunctionType::Pointer FunctionPointer;
84 
86  //void SetInput( const TInputImage *image);
87 
89  void SetFunction(FunctionType* PixelFunction)
90  {
91  m_PixelFunction = PixelFunction;
92  this->Modified();
93  }
95  {
96  return m_PixelFunction;
97  }
98 
99 
101  itkStaticConstMacro(InputImageDimension, unsigned int,
102  TInputImage::ImageDimension);
103  itkStaticConstMacro(OutputImageDimension, unsigned int,
104  TOutputImage::ImageDimension);
105 
106 protected:
109 
112  virtual void BeforeThreadedGenerateData();
113 
124  virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
125  itk::ThreadIdType threadId);
126 
127 private:
128  FunctionToImageFilter(const Self &); //purposely not implemented
129  void operator =(const Self&); //purposely not implemented
130 
133 };
134 
135 } // end namespace otb
136 
137 #ifndef OTB_MANUAL_INSTANTIATION
139 #endif
140 
141 #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