21 #ifndef otbMorphologicalProfilesSegmentationFilter_hxx
22 #define otbMorphologicalProfilesSegmentationFilter_hxx
29 template <
class TInputImage,
class TOutputImage,
class TInternalPrecision,
class TStructuringElement>
37 m_ClassificationFilter = MultiScaleClassificationFilterType::New();
38 m_ConnectedComponentsFilter = ConnectedComponentsFilterType::New();
39 m_OpeningProfile = OpeningProfileFilterType::New();
40 m_ClosingProfile = ClosingProfileFilterType::New();
41 m_OpeningDerivativeProfile = DerivativeFilterType::New();
42 m_ClosingDerivativeProfile = DerivativeFilterType::New();
43 m_OpeningCharacteristicsFilter = MultiScaleCharacteristicsFilterType::New();
44 m_ClosingCharacteristicsFilter = MultiScaleCharacteristicsFilterType::New();
46 m_OpeningDerivativeProfile->SetInput(m_OpeningProfile->GetOutput());
47 m_ClosingDerivativeProfile->SetInput(m_ClosingProfile->GetOutput());
48 m_OpeningCharacteristicsFilter->SetInput(m_OpeningDerivativeProfile->GetOutput());
49 m_ClosingCharacteristicsFilter->SetInput(m_ClosingDerivativeProfile->GetOutput());
51 using namespace Functor::MultiScaleConvexOrConcaveDecisionRule_tags;
54 m_ClassificationFilter->template SetInput<max_opening_profile_derivative>(m_OpeningCharacteristicsFilter->GetOutput());
55 m_ClassificationFilter->template SetInput<opening_profile_characteristics>(m_OpeningCharacteristicsFilter->GetOutputCharacteristics());
56 m_ClassificationFilter->template SetInput<max_closing_profile_derivative>(m_ClosingCharacteristicsFilter->GetOutput());
57 m_ClassificationFilter->template SetInput<closing_profile_characteristics>(m_ClosingCharacteristicsFilter->GetOutputCharacteristics());
59 m_ConnectedComponentsFilter->SetInput(m_ClassificationFilter->GetOutput());
62 template <
class TInputImage,
class TOutputImage,
class TInternalPrecision,
class TStructuringElement>
67 template <
class TInputImage,
class TOutputImage,
class TInternalPrecision,
class TStructuringElement>
70 m_OpeningProfile->SetInput(this->GetInput());
71 m_ClosingProfile->SetInput(this->GetInput());
73 m_OpeningProfile->SetProfileSize(m_ProfileSize);
74 m_OpeningProfile->SetInitialValue(m_ProfileStart);
75 m_OpeningProfile->SetStep(m_ProfileStep);
77 m_ClosingProfile->SetProfileSize(m_ProfileSize);
78 m_ClosingProfile->SetInitialValue(m_ProfileStart);
79 m_ClosingProfile->SetStep(m_ProfileStep);
81 m_OpeningCharacteristicsFilter->SetInitialValue(m_ProfileStart);
82 m_OpeningCharacteristicsFilter->SetStep(m_ProfileStep);
84 m_ClosingCharacteristicsFilter->SetInitialValue(m_ProfileStart);
85 m_ClosingCharacteristicsFilter->SetStep(m_ProfileStep);
87 m_ClassificationFilter->GetModifiableFunctor().SetSigma(m_Sigma);
88 m_ClassificationFilter->GetModifiableFunctor().SetLabelSeparator(m_ProfileStart + m_ProfileSize * m_ProfileStep);
90 m_ConnectedComponentsFilter->GraftOutput(this->GetOutput());
91 m_ConnectedComponentsFilter->Update();
92 this->GraftOutput(m_ConnectedComponentsFilter->GetOutput());