diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx index ad036fb3b24fb0f92744e1f1d79baadd72cba6a0..daaafb96048e3dac65efb59ef58982ac91894b0b 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx @@ -259,6 +259,15 @@ VectorDataToLabelImageFilter::GenerateData() // Get the buffered region OutputImageRegionType bufferedRegion = this->GetOutput()->GetBufferedRegion(); + //Start from a clean buffer + //Patch provided by R. Cresson on otb-developers + typename itk::ImageRegionIterator outputIt(this->GetOutput(), bufferedRegion); + + for (outputIt.GoToBegin(); !outputIt.IsAtEnd(); ++outputIt) + { + outputIt.Set(itk::NumericTraits::Zero); + } + // nb bands unsigned int nbBands = this->GetOutput()->GetNumberOfComponentsPerPixel();