Commit dcbb0ec95a7821f9c0c1ed02a7b87fdd69516cca

Authored by Pierre Lassalle
1 parent de9faf3c
Exists in master

Fix bug for the generation of the label (Remi cresson update)

Showing 1 changed file with 7 additions and 10 deletions   Show diff stats
include/grmGraphToOtbImage.txx
... ... @@ -19,6 +19,7 @@
19 19 #define __GRM_GRAPH_TO_OTBIMAGE_TXX
20 20 #include "grmGraphToOtbImage.h"
21 21 #include "itkImageRegionIterator.h"
  22 +#include "itkGrayscaleFillholeImageFilter.h"
22 23  
23 24 namespace grm
24 25 {
... ... @@ -62,17 +63,13 @@ namespace grm
62 63 ++label;
63 64 }
64 65  
65   - unsigned int pixelValue = 0;
66   - for(it.GoToBegin(); !it.IsAtEnd(); ++it)
67   - {
68   - auto pixel = it.Get();
69   - if(pixel == 0)
70   - it.Set(pixelValue);
71   - else
72   - pixelValue = pixel;
73   - }
  66 + // Fill holes
  67 + typedef itk::GrayscaleFillholeImageFilter<LabelImageType,LabelImageType> FillholeFilterType;
  68 + FillholeFilterType::Pointer fillFilter = FillholeFilterType::New();
  69 + fillFilter->SetInput(label_img);
  70 + fillFilter->Update();
74 71  
75   - return label_img;
  72 + return fillFilter->GetOutput();
76 73 }
77 74  
78 75 template<class TGraph>
... ...