def binary_hit_or_miss(input, structure1=None, structure2=None, output=None, origin1=0, origin2=None):
 input = numpy.asarray(input)
 if (structure1 is None):
  structure1 = generate_binary_structure(input.ndim, 1)
 if (structure2 is None):
  structure2 = numpy.logical_not(structure1)
 origin1 = _ni_support._normalize_sequence(origin1, input.ndim)
 if (origin2 is None):
  origin2 = origin1
 else:
  origin2 = _ni_support._normalize_sequence(origin2, input.ndim)
 tmp1 = _binary_erosion(input, structure1, 1, None, None, 0, origin1, 0, False)
 inplace = isinstance(output, numpy.ndarray)
 result = _binary_erosion(input, structure2, 1, None, output, 0, origin2, 1, False)
 if inplace:
  numpy.logical_not(output, output)
  numpy.logical_and(tmp1, output, output)
 else:
  numpy.logical_not(result, result)
  return numpy.logical_and(tmp1, result)

def binary_hit_or_miss ( input , structure1 = None , structure2 = None , output = None , origin1 = 0 , origin2 = None ) : input = numpy . asarray ( input ) if ( structure1 is None ) : structure1 = generate_binary_structure ( input . ndim , 1 ) if ( structure2 is None ) : structure2 = numpy . logical_not ( structure1 ) origin1 = _ni_support . _normalize_sequence ( origin1 , input . ndim ) if ( origin2 is None ) : origin2 = origin1 else : origin2 = _ni_support . _normalize_sequence ( origin2 , input . ndim ) tmp1 = _binary_erosion ( input , structure1 , 1 , None , None , 0 , origin1 , 0 , False ) inplace = isinstance ( output , numpy . ndarray ) result = _binary_erosion ( input , structure2 , 1 , None , output , 0 , origin2 , 1 , False ) if inplace : numpy . logical_not ( output , output ) numpy . logical_and ( tmp1 , output , output ) else : numpy . logical_not ( result , result ) return numpy . logical_and ( tmp1 , result )
multi-dimensional binary hit-or-miss transform .