21 #ifndef otbImageToLabelMapWithAttributesFilter_hxx
22 #define otbImageToLabelMapWithAttributesFilter_hxx
25 #include "itkProcessObject.h"
29 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
32 m_Output = LabelMapType::New();
33 this->itk::ProcessObject::SetNumberOfRequiredInputs(2);
36 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
40 Superclass::GenerateInputRequestedRegion();
43 typename InputImageType::Pointer input =
const_cast<InputImageType*
>(this->GetInput());
50 input->SetRequestedRegion(input->GetLargestPossibleRegion());
53 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
57 this->itk::ProcessObject::SetNthInput(0,
const_cast<InputImageType*
>(image));
60 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
67 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
71 if (this->GetNumberOfInputs() < 2)
76 return static_cast<const InputImageType*
>(this->itk::ProcessObject::GetInput(0));
79 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
83 if (this->GetNumberOfInputs() < 2)
88 return static_cast<const LabelledImageType*
>(this->itk::ProcessObject::GetInput(1));
92 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
96 return dynamic_cast<LabelMapType*
>(this->Superclass::GetOutput(0));
100 template <
class TInputImage,
class TLabeledImage,
class TOutputLabel,
class TObjectLabel>
103 typename InputImageType::Pointer inputImage =
const_cast<InputImageType*
>(this->GetInput());
104 typename LabelledImageType::Pointer labelledImage =
const_cast<LabelledImageType*
>(this->GetLabelledImage());
108 lfilter->SetBackgroundValue(itk::NumericTraits<LabelType>::max());
109 lfilter->SetInput(labelledImage);
113 shapeLabelMapFilter->SetInput(lfilter->GetOutput());
117 bandStatsLabelMapFilter->SetInput(shapeLabelMapFilter->GetOutput());
118 bandStatsLabelMapFilter->SetFeatureImage(inputImage);
121 bandStatsLabelMapFilter->GetOutput()->SetAdjacencyMap(lfilter->GetOutput()->GetAdjacencyMap());
122 bandStatsLabelMapFilter->GraftOutput(this->GetOutput());
125 bandStatsLabelMapFilter->Update();
128 this->GraftOutput(bandStatsLabelMapFilter->GetOutput());
itk::SmartPointer< Self > Pointer
const InputImageType * GetInput(void)
TInputImage InputImageType
void SetInput(const InputImageType *image) override
void GenerateData() override
TLabeledImage LabelledImageType
ImageToLabelMapWithAttributesFilter()
virtual void SetLabelledImage(const LabelledImageType *image)
virtual LabelMapType * GetOutput()
void GenerateInputRequestedRegion() override
const LabelledImageType * GetLabelledImage()
itk::SmartPointer< Self > Pointer
This class is a LabelMap with additional adjacency information.
itk::SmartPointer< Self > Pointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.