18 #ifndef __otbSVMImageClassificationFilter_txx
19 #define __otbSVMImageClassificationFilter_txx
30 template <
class TInputImage,
class TOutputImage,
class TMaskImage>
34 this->SetNumberOfInputs(2);
35 this->SetNumberOfRequiredInputs(1);
36 m_DefaultLabel = itk::NumericTraits<LabelType>::ZeroValue();
39 template <
class TInputImage,
class TOutputImage,
class TMaskImage>
47 template <
class TInputImage,
class TOutputImage,
class TMaskImage>
53 if (this->GetNumberOfInputs() < 2)
60 template <
class TInputImage,
class TOutputImage,
class TMaskImage>
67 itkGenericExceptionMacro(<<
"No model for classification");
71 template <
class TInputImage,
class TOutputImage,
class TMaskImage>
89 InputIteratorType inIt(inputPtr, outputRegionForThread);
90 OutputIteratorType outIt(outputPtr, outputRegionForThread);
93 MaskIteratorType maskIt;
96 maskIt = MaskIteratorType(inputMaskPtr, outputRegionForThread);
100 bool validPoint =
true;
103 for (inIt.GoToBegin(), outIt.GoToBegin(); !inIt.IsAtEnd() && !outIt.IsAtEnd(); ++inIt, ++outIt)
108 validPoint = maskIt.Get() > 0;
116 for (
unsigned int i = 0; i < inIt.Get().Size(); ++i)
118 measure.push_back(inIt.Get()[i]);
120 outIt.Set(m_Model->EvaluateLabel(measure));
125 outIt.Set(m_DefaultLabel);
127 progress.CompletedPixel();
134 template <
class TInputImage,
class TOutputImage,
class TMaskImage>
139 Superclass::PrintSelf(os, indent);