PageRenderTime 59ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 0ms

/Code/BasicFilters/otbVectorImageToIntensityImageFilter.h

https://github.com/paniwani/OTB
C Header | 103 lines | 39 code | 9 blank | 55 comment | 0 complexity | 9347fe4c8f999731f5d29a8a39388ed6 MD5 | raw file
  1. /*=========================================================================
  2. Program: ORFEO Toolbox
  3. Language: C++
  4. Date: $Date$
  5. Version: $Revision$
  6. Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  7. See OTBCopyright.txt for details.
  8. This software is distributed WITHOUT ANY WARRANTY; without even
  9. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  10. PURPOSE. See the above copyright notices for more information.
  11. =========================================================================*/
  12. #ifndef __otbVectorImageToIntensityImageFilter_h
  13. #define __otbVectorImageToIntensityImageFilter_h
  14. #include "itkImageToImageFilter.h"
  15. namespace otb
  16. {
  17. /** \class VectorImageToIntensityImageFilter
  18. * \brief This filter implements the computation of the mean of the spectral values of each pixel.
  19. *
  20. * The spectral mean
  21. * is defined as:
  22. *
  23. * \f[ SM = \frac{1}{n_{b}} \times \sum_{b=1}^{n_{b}}p(b) \f]
  24. * with \f$b\f$ being the spectral band and \f$p\f$
  25. * the current pixel.
  26. *
  27. * Since the spectral mean deals with multi-bands image, the InputImage pixels are suposed to
  28. * support the [] operator, and the input image to support the GetNumberOfComponentsPerPixel() method.
  29. *
  30. * \sa VectorImage
  31. *
  32. * This filter is implemented as a multithreaded filter.
  33. *
  34. * \ingroup IntensityImageFilters
  35. * \ingroup Threading
  36. * \ingroup Streamed
  37. */
  38. template <class TInputImage, class TOutputImage>
  39. class ITK_EXPORT VectorImageToIntensityImageFilter
  40. : public itk::ImageToImageFilter<TInputImage, TOutputImage>
  41. {
  42. public:
  43. /** Standard typedefs */
  44. typedef VectorImageToIntensityImageFilter Self;
  45. typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
  46. typedef itk::SmartPointer<Self> Pointer;
  47. typedef itk::SmartPointer<const Self> ConstPointer;
  48. /** Type macro */
  49. itkNewMacro(Self);
  50. /** Creation through object factory macro */
  51. itkTypeMacro(VectorImageToIntensityImageFilter, itk::ImageToImageFilter);
  52. /** Template parameters typedefs */
  53. typedef TInputImage InputImageType;
  54. typedef typename InputImageType::ConstPointer InputImageConstPointerType;
  55. typedef typename InputImageType::RegionType InputImageRegionType;
  56. typedef typename InputImageType::PixelType InputPixelType;
  57. typedef TOutputImage OutputImageType;
  58. typedef typename OutputImageType::Pointer OutputImagePointerType;
  59. typedef typename OutputImageType::RegionType OutputImageRegionType;
  60. typedef typename OutputImageType::PixelType OutputPixelType;
  61. protected:
  62. /** Constructor */
  63. VectorImageToIntensityImageFilter();
  64. /** Destructor */
  65. virtual ~VectorImageToIntensityImageFilter() {}
  66. /**PrintSelf method */
  67. virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
  68. /** VectorImageToIntensityImageFilter can be implemented as a multithreaded filter.
  69. * Therefore, this implementation provides a ThreadedGenerateData() routine
  70. * which is called for each processing thread. The output image data is
  71. * allocated automatically by the superclass prior to calling
  72. * ThreadedGenerateData(). ThreadedGenerateData can only write to the
  73. * portion of the output image specified by the parameter
  74. * "outputRegionForThread"
  75. *
  76. * \sa ImageToImageFilter::ThreadedGenerateData(),
  77. * ImageToImageFilter::GenerateData() */
  78. void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
  79. int threadId);
  80. private:
  81. VectorImageToIntensityImageFilter(const Self &); //purposely not implemented
  82. void operator =(const Self&); //purposely not implemented
  83. };
  84. } // End namespace otb
  85. #ifndef OTB_MANUAL_INSTANTIATION
  86. #include "otbVectorImageToIntensityImageFilter.txx"
  87. #endif
  88. #endif