File: otbSVMImageModelEstimator.h

package info (click to toggle)
otb 5.8.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 38,496 kB
  • ctags: 40,282
  • sloc: cpp: 306,573; ansic: 3,575; python: 450; sh: 214; perl: 74; java: 72; makefile: 70
file content (130 lines) | stat: -rw-r--r-- 4,112 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef otbSVMImageModelEstimator_h
#define otbSVMImageModelEstimator_h

#include "vcl_deprecated_header.h"

#include "itkImageModelEstimatorBase.h"
#include "itkImageRegionIterator.h"
#include "otbSVMModelEstimator.h"

namespace otb
{

/** \class SVMImageModelEstimator
 * \brief Class for SVM model estimation from images used for classification.
 *
 *
 * The basic functionality of the SVMImageModelEstimator is to
 * generate the models used in SVM classification. It
 * requires input images and a training image to be provided by the
 * user. This object supports data handling of multiband images. The
 * object accepts the input image as a VectorImage only, where each
 * pixel is a vector and each element of the vector corresponds to an
 * entry from 1 particular band of a multiband dataset. A single band
 * image is treated as a vector image with a single element for every
 * vector. The classified image is treated as a single band scalar
 * image.
 *
 * \deprecated
 *
 * \sa MachineLearningModel
 * \sa LibSVMMachineLearningModel
 * \sa ImageClassificationFilter
 *
 * \ingroup ClassificationFilters
 *
 * \ingroup OTBSVMLearning
 */
template <class TInputImage, class TTrainingImage>
class ITK_EXPORT SVMImageModelEstimator :
  public SVMModelEstimator<typename TInputImage::InternalPixelType, typename TTrainingImage::PixelType>
{
public:
  /** Standard class typedefs. */
  typedef SVMImageModelEstimator Self;
  typedef SVMModelEstimator<typename TInputImage::PixelType::ComponentType,
      typename TTrainingImage::PixelType>
  Superclass;

  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(SVMImageModelEstimator, otb::SVMModelEstimator);

  /** Type definition for the input image. */
  typedef typename TInputImage::Pointer InputImagePointer;

  /** Type definitions for the training image. */
  typedef typename TTrainingImage::Pointer TrainingImagePointer;

  /** Type definition for the vector associated with
   * input image pixel type. */
  typedef typename TInputImage::PixelType InputImagePixelType;

  /** Type definitions for the vector holding
   * training image pixel type. */
  typedef typename TTrainingImage::PixelType TrainingImagePixelType;

  /** Type definitions for the iterators for the input and training images. */
  typedef
  itk::ImageRegionIterator<TInputImage>  InputImageIterator;
  typedef
  itk::ImageRegionIterator<TTrainingImage> TrainingImageIterator;

  /** Set the input image */
  void SetInputImage(const TInputImage * inputImage);

  /** Set the training image */
  void SetTrainingImage(const TTrainingImage * trainingImage);

  /** Get the input image */
  const TInputImage * GetInputImage();

  /** Get the training image */
  const TTrainingImage * GetTrainingImage();

protected:
  /** Constructor */
  SVMImageModelEstimator();
  /** Destructor */
  ~SVMImageModelEstimator() ITK_OVERRIDE;
  /** PrintSelf */
  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;

  /** Implement the prepare data step from SVMModelEstimator */
  void PrepareData() ITK_OVERRIDE;

private:
  SVMImageModelEstimator(const Self &); //purposely not implemented
  void operator =(const Self&); //purposely not implemented

}; // class SVMImageModelEstimator

} // namespace otb

#ifndef OTB_MANUAL_INSTANTIATION
#include "otbSVMImageModelEstimator.txx"
#endif

#endif