22 #ifndef otbSOMbasedImageFilter_hxx
23 #define otbSOMbasedImageFilter_hxx
33 template <
class TInput,
class TOutput,
class TDistanceMetric,
class TMap>
36 return static_cast<TOutput
>(GetMap()->GetPixel(this->GetWinner(input)));
39 template <
class TInput,
class TOutput,
class TDistanceMetric,
class TMap>
42 m_Map =
const_cast<MapType*
>(theMap);
43 m_Distance = DistanceType::New();
46 template <
class TInput,
class TOutput,
class TDistanceMetric,
class TMap>
50 typedef itk::ImageRegionIteratorWithIndex<MapType> IteratorType;
51 IteratorType it(GetMap(), GetMap()->GetLargestPossibleRegion());
56 double tempDistance, minDistance = GetDistance()->Evaluate(sample, it.Get());
61 tempDistance = GetDistance()->Evaluate(sample, it.Get());
63 if (tempDistance < minDistance)
65 minDistance = tempDistance;
66 minPos = it.GetIndex();
80 template <
class TInputImage,
class TOutputImage,
class TDistanceMetric,
class TMap>
83 this->SetNumberOfRequiredInputs(1);
87 template <
class TInputImage,
class TOutputImage,
class TDistanceMetric,
class TMap>
90 m_Map =
const_cast<MapType*
>(theMap);
94 template <
class TInputImage,
class TOutputImage,
class TDistanceMetric,
class TMap>
98 this->GetFunctor().SetMap(m_Map);