diff --git a/Code/BasicFilters/otbLabelImageRegionMergingFilter.h b/Code/BasicFilters/otbLabelImageRegionMergingFilter.h index d2f85ad5d23d38c65b388e242e45b095b03ff5ca..178ef29be15ff000b71db397027f804e3ecf8b85 100644 --- a/Code/BasicFilters/otbLabelImageRegionMergingFilter.h +++ b/Code/BasicFilters/otbLabelImageRegionMergingFilter.h @@ -111,6 +111,8 @@ public: protected: + virtual void GenerateOutputInformation(void); + virtual void GenerateData(); /** Constructor */ diff --git a/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx b/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx index 2e866dfa7442221cfa2a2410f7b6998b811e140c..e46dfa90d318c47a0d6e74c1dfb6e04b76ea1d40 100644 --- a/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx +++ b/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx @@ -131,6 +131,21 @@ LabelImageRegionMergingFilter<TInputLabelImage, TInputSpectralImage, TOutputLabe return static_cast<OutputClusteredImageType *>(this->itk::ProcessObject::GetOutput(1)); } +template <class TInputLabelImage, class TInputSpectralImage, class TOutputLabelImage, class TOutputClusteredImage> +void +LabelImageRegionMergingFilter<TInputLabelImage, TInputSpectralImage, TOutputLabelImage, TOutputClusteredImage> +::GenerateOutputInformation() +{ + Superclass::GenerateOutputInformation(); + + unsigned int numberOfComponentsPerPixel = this->GetInputSpectralImage()->GetNumberOfComponentsPerPixel(); + + if(this->GetClusteredOutput()) + { + this->GetClusteredOutput()->SetNumberOfComponentsPerPixel(numberOfComponentsPerPixel); + } + +} template <class TInputLabelImage, class TInputSpectralImage, class TOutputLabelImage, class TOutputClusteredImage> void