def binary_fill_holes(input, structure=None, output=None, origin=0):
 mask = numpy.logical_not(input)
 tmp = numpy.zeros(mask.shape, bool)
 inplace = isinstance(output, numpy.ndarray)
 if inplace:
  binary_dilation(tmp, structure, (-1), mask, output, 1, origin)
  numpy.logical_not(output, output)
 else:
  output = binary_dilation(tmp, structure, (-1), mask, None, 1, origin)
  numpy.logical_not(output, output)
  return output

def binary_fill_holes ( input , structure = None , output = None , origin = 0 ) : mask = numpy . logical_not ( input ) tmp = numpy . zeros ( mask . shape , bool ) inplace = isinstance ( output , numpy . ndarray ) if inplace : binary_dilation ( tmp , structure , ( - 1 ) , mask , output , 1 , origin ) numpy . logical_not ( output , output ) else : output = binary_dilation ( tmp , structure , ( - 1 ) , mask , None , 1 , origin ) numpy . logical_not ( output , output ) return output
fill the holes in binary objects .