Orfeo Toolbox  4.0
otbSFSTexturesImageFilter.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 
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 __otbSFSTexturesImageFilter_h
19 #define __otbSFSTexturesImageFilter_h
20 
21 #include "otbSFSTexturesFunctor.h"
22 #include "itkImageToImageFilter.h"
25 
26 namespace otb
27 {
28 
52 template <class TInputImage, class TOutputImage>
53 class ITK_EXPORT SFSTexturesImageFilter :
54  public itk::ImageToImageFilter<TInputImage, TOutputImage>
55 {
56 public:
59  typedef TInputImage InputImageType;
60  typedef TOutputImage OutputImageType;
64 
66  itkNewMacro(Self);
67 
69  itkTypeMacro(UnaryFunctorNeighborhoodImageFilter, ImageToImageFilter);
70 
72  typedef typename InputImageType::ConstPointer InputImagePointerType;
73  typedef typename InputImageType::RegionType InputImageRegionType;
74  typedef typename InputImageType::PixelType InputImagePixelType;
75  typedef typename InputImageType::SizeType InputImageSizeType;
76  typedef typename OutputImageType::Pointer OutputImagePointerType;
77  typedef typename OutputImageType::RegionType OutputImageRegionType;
78  typedef typename OutputImageType::PixelType OutputImagePixelType;
84 
86  itkGetMacro(Radius, unsigned int);
87 
89  FunctorType& GetFunctor()
90  {
91  return m_Functor;
92  }
93 
94  const FunctorType& GetFunctor() const
95  {
96  return m_Functor;
97  }
98  void SetFunctor(const FunctorType& functor)
99  {
100  m_Functor = functor;
101  this->Modified();
102  }
103 
105  void SetSpatialThreshold(unsigned int thresh)
106  {
107  this->GetFunctor().SetSpatialThreshold(thresh);
108  m_Radius = thresh;
109  this->Modified();
110  }
111  unsigned int GetSpatialThreshold()
112  {
113  return this->GetFunctor().GetSpatialThreshold();
114  }
116  void SetSpectralThreshold(InputImagePixelType thresh)
117  {
118  this->GetFunctor().SetSpectralThreshold(thresh);
119  }
120  InputImagePixelType GetSpectralThreshold()
121  {
122  return this->GetFunctor().GetSpectralThreshold();
123  }
125  void SetRatioMaxConsiderationNumber(unsigned int value)
126  {
127  this->GetFunctor().SetRatioMaxConsiderationNumber(value);
128  }
129  unsigned int GetRatioMaxConsiderationNumber()
130  {
131  return this->GetFunctor().GetRatioMaxConsiderationNumber();
132  }
133 
135  void SetAlpha(double alpha)
136  {
137  this->GetFunctor().SetAlpha(alpha);
138  }
139  double GetAlpha()
140  {
141  return this->GetFunctor().GetAlpha();
142  }
143 
145  void SetNumberOfDirections(unsigned int D)
146  {
147  this->GetFunctor().SetNumberOfDirections(D);
148  double step = CONST_2PI / static_cast<double>(D);
149  this->GetFunctor().SetDirectionStep(step);
150  }
151  unsigned int GetNumberOfDirections()
152  {
153  return this->GetFunctor().GetNumberOfDirections();
154  }
155 
165  typedef enum {LENGTH = 1, WIDTH, PSI, WMEAN, RATIO, SD} FeatureType;
166 
167  void SetFeatureStatus(FeatureType id, bool isSelected)
168  {
169  if (static_cast<unsigned int>(id) > this->GetTexturesStatus().size() || id == 0)
170  {
171  itkExceptionMacro(
172  << "Invalid texture index " << id << ", must be in [1;" << this->GetTexturesStatus().size() << "]");
173  }
174  else
175  {
176  this->GetFunctor().SetTextureStatus(id - 1, isSelected);
177  }
178  }
179 
180  std::vector<bool> GetTexturesStatus()
181  {
182  return this->GetFunctor().GetTexturesStatus();
183  }
184 
185  void InitFeatureStatus(bool status);
186 
188  const OutputImageType * GetLengthOutput() const;
189  OutputImageType * GetLengthOutput();
190 
192  const OutputImageType * GetWidthOutput() const;
193  OutputImageType * GetWidthOutput();
194 
196  const OutputImageType * GetPSIOutput() const;
197  OutputImageType * GetPSIOutput();
198 
200  const OutputImageType * GetWMeanOutput() const;
201  OutputImageType * GetWMeanOutput();
202 
204  const OutputImageType * GetRatioOutput() const;
205  OutputImageType * GetRatioOutput();
206 
208  const OutputImageType * GetSDOutput() const;
209  OutputImageType * GetSDOutput();
210 
211  virtual void GenerateOutputInformation();
212  std::vector<FunctorType> m_FunctorList;
213 
214 protected:
217  void PrintSelf(std::ostream& os, itk::Indent indent) const;
218 
219  virtual void BeforeThreadedGenerateData();
220  virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId);
222  virtual void GenerateInputRequestedRegion(void);
223 
224 private:
225  SFSTexturesImageFilter(const Self &); //purposely not implemented
226  void operator =(const Self&); //purposely not implemented
227 
228  unsigned int m_Radius;
230 
231 };
232 
233 } // end namespace otb
234 
235 #ifndef OTB_MANUAL_INSTANTIATION
237 #endif
238 
239 #endif

Generated at Sat Mar 8 2014 16:17:58 for Orfeo Toolbox with doxygen 1.8.3.1