18 #ifndef __otbImageToLabelMapWithAttributesFilter_txx
19 #define __otbImageToLabelMapWithAttributesFilter_txx
26 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
30 m_Output = LabelMapType::New();
34 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
41 const_cast< InputImageType * >( image ) );
44 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
51 const_cast<LabeledImageType * >( image ) );
55 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
60 if (this->GetNumberOfInputs() < 2)
69 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
74 if (this->GetNumberOfInputs() < 2)
84 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
91 (this->Superclass::GetOutput(0));
95 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
100 typename InputImageType::Pointer inputImage =
const_cast<InputImageType *
>(this->GetInput());
101 typename LabeledImageType::Pointer labeldImage =
const_cast<LabeledImageType *
>(this->GetLabeledImage());
105 lfilter->SetBackgroundValue(itk::NumericTraits<LabelType>::max());
106 lfilter->SetInput(labeldImage);
110 shapeLabelMapFilter->SetInput(lfilter->GetOutput());
114 bandStatsLabelMapFilter->SetInput(shapeLabelMapFilter->GetOutput());
115 bandStatsLabelMapFilter->SetFeatureImage(inputImage);
118 bandStatsLabelMapFilter->GetOutput()->SetAdjacencyMap(lfilter->GetOutput()->GetAdjacencyMap());
119 bandStatsLabelMapFilter->GraftOutput( this->GetOutput() );
122 bandStatsLabelMapFilter->Update();
125 this->GraftOutput( bandStatsLabelMapFilter->GetOutput() );