21 #ifndef otbSOMActivationBuilder_hxx
22 #define otbSOMActivationBuilder_hxx
25 #include "itkImageRegionIterator.h"
32 template <
class TInputImage,
class TInputMap,
class TOutputImage>
35 this->SetNumberOfRequiredInputs(1);
36 this->SetNthOutput(0, OutputImageType::New());
42 template <
class TInputImage,
class TInputMap,
class TOutputImage>
50 template <
class TInputImage,
class TInputMap,
class TOutputImage>
54 InputMapType* map =
const_cast<InputMapType*
>(this->GetInput());
55 OutputImagePointerType output = this->GetOutput();
59 output->SetRegions(map->GetLargestPossibleRegion());
61 output->FillBuffer(
static_cast<typename OutputImageType::PixelType
>(0));
64 typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType;
65 typename InputMapType::IndexType index;
67 OutputIteratorType outIt(output, output->GetLargestPossibleRegion());
70 for (
typename ListSampleType::Iterator it = m_ListSample->Begin(); it != m_ListSample->End(); ++it)
73 index = map->GetWinner(it.GetMeasurementVector());
75 outIt.SetIndex(index);
76 outIt.Set(outIt.Get() + 1);