# scipy 1.18.1 (BSD-3-Clause), harvested by tools/harvest_corpus.py
=== input

    Find objects in a labeled array.

    Parameters
    ----------
    input : ndarray of ints
        Array containing objects defined by different labels. Labels with
        value 0 are ignored.
    max_label : int, optional
        Maximum label to be searched for in `input`. If max_label is not
        given, the positions of all objects are returned.

    Returns
    -------
    object_slices : list of tuples
        A list of tuples, with each tuple containing N slices (with N the
        dimension of the input array). Slices correspond to the minimal
        parallelepiped that contains the object. If a number is missing,
        None is returned instead of a slice. The label ``l`` corresponds to
        the index ``l-1`` in the returned list.

    See Also
    --------
    label, center_of_mass

    Notes
    -----
    This function is very useful for isolating a volume of interest inside
    a 3-D array, that cannot be "seen through".

    Examples
    --------
    >>> from scipy import ndimage
    >>> import numpy as np
    >>> a = np.zeros((6,6), dtype=int)
    >>> a[2:4, 2:4] = 1
    >>> a[4, 4] = 1
    >>> a[:2, :3] = 2
    >>> a[0, 5] = 3
    >>> a
    array([[2, 2, 2, 0, 0, 3],
           [2, 2, 2, 0, 0, 0],
           [0, 0, 1, 1, 0, 0],
           [0, 0, 1, 1, 0, 0],
           [0, 0, 0, 0, 1, 0],
           [0, 0, 0, 0, 0, 0]])
    >>> ndimage.find_objects(a)
    [(slice(2, 5, None), slice(2, 5, None)),
     (slice(0, 2, None), slice(0, 3, None)),
     (slice(0, 1, None), slice(5, 6, None))]
    >>> ndimage.find_objects(a, max_label=2)
    [(slice(2, 5, None), slice(2, 5, None)), (slice(0, 2, None), slice(0, 3, None))]
    >>> ndimage.find_objects(a == 1, max_label=2)
    [(slice(2, 5, None), slice(2, 5, None)), None]

    >>> loc = ndimage.find_objects(a)[0]
    >>> a[loc]
    array([[1, 1, 0],
           [1, 1, 0],
           [0, 0, 1]])

    
=== parse numpydoc
short_description: 'Find objects in a labeled array.'
blank_after_short_description: True
blank_after_long_description: False
style: numpydoc
- DocstringParam
  description: |
    Array containing objects defined by different labels. Labels with
    value 0 are ignored.
  kind: param
  key: 'param'
  arg_name: 'input'
  type_name: 'ndarray of ints'
  is_optional: False
- DocstringParam
  description: |
    Maximum label to be searched for in `input`. If max_label is not
    given, the positions of all objects are returned.
  kind: param
  key: 'param'
  arg_name: 'max_label'
  type_name: 'int'
  is_optional: True
  raw_type_name: 'int, optional'
- DocstringReturns
  description: |
    A list of tuples, with each tuple containing N slices (with N the
    dimension of the input array). Slices correspond to the minimal
    parallelepiped that contains the object. If a number is missing,
    None is returned instead of a slice. The label ``l`` corresponds to
    the index ``l-1`` in the returned list.
  kind: returns
  key: 'returns'
  type_name: 'list of tuples'
  is_generator: False
  return_name: 'object_slices'
- DocstringMeta
  description: 'label, center_of_mass'
  kind: text
  key: 'see_also'
  title: 'See Also'
- DocstringMeta
  description: |
    This function is very useful for isolating a volume of interest inside
    a 3-D array, that cannot be "seen through".
  kind: text
  key: 'notes'
  title: 'Notes'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> from scipy import ndimage'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> import numpy as np'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> a = np.zeros((6,6), dtype=int)'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> a[2:4, 2:4] = 1'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> a[4, 4] = 1'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> a[:2, :3] = 2'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> a[0, 5] = 3'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> a
    array([[2, 2, 2, 0, 0, 3],
           [2, 2, 2, 0, 0, 0],
           [0, 0, 1, 1, 0, 0],
           [0, 0, 1, 1, 0, 0],
           [0, 0, 0, 0, 1, 0],
           [0, 0, 0, 0, 0, 0]])
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> ndimage.find_objects(a)
    [(slice(2, 5, None), slice(2, 5, None)),
     (slice(0, 2, None), slice(0, 3, None)),
     (slice(0, 1, None), slice(5, 6, None))]
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> ndimage.find_objects(a, max_label=2)
    [(slice(2, 5, None), slice(2, 5, None)), (slice(0, 2, None), slice(0, 3, None))]
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> ndimage.find_objects(a == 1, max_label=2)
    [(slice(2, 5, None), slice(2, 5, None)), None]
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> loc = ndimage.find_objects(a)[0]'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> a[loc]
    array([[1, 1, 0],
           [1, 1, 0],
           [0, 0, 1]])
=== detect
numpydoc
=== compose numpydoc
Find objects in a labeled array.

Parameters
----------
input : ndarray of ints
    Array containing objects defined by different labels. Labels with
    value 0 are ignored.
max_label : int, optional
    Maximum label to be searched for in `input`. If max_label is not
    given, the positions of all objects are returned.

Returns
-------
object_slices : list of tuples
    A list of tuples, with each tuple containing N slices (with N the
    dimension of the input array). Slices correspond to the minimal
    parallelepiped that contains the object. If a number is missing,
    None is returned instead of a slice. The label ``l`` corresponds to
    the index ``l-1`` in the returned list.

See Also
--------
label, center_of_mass

Notes
-----
This function is very useful for isolating a volume of interest inside
a 3-D array, that cannot be "seen through".

Examples
--------
>>> from scipy import ndimage
>>> import numpy as np
>>> a = np.zeros((6,6), dtype=int)
>>> a[2:4, 2:4] = 1
>>> a[4, 4] = 1
>>> a[:2, :3] = 2
>>> a[0, 5] = 3
>>> a
array([[2, 2, 2, 0, 0, 3],
       [2, 2, 2, 0, 0, 0],
       [0, 0, 1, 1, 0, 0],
       [0, 0, 1, 1, 0, 0],
       [0, 0, 0, 0, 1, 0],
       [0, 0, 0, 0, 0, 0]])
>>> ndimage.find_objects(a)
[(slice(2, 5, None), slice(2, 5, None)),
 (slice(0, 2, None), slice(0, 3, None)),
 (slice(0, 1, None), slice(5, 6, None))]
>>> ndimage.find_objects(a, max_label=2)
[(slice(2, 5, None), slice(2, 5, None)), (slice(0, 2, None), slice(0, 3, None))]
>>> ndimage.find_objects(a == 1, max_label=2)
[(slice(2, 5, None), slice(2, 5, None)), None]
>>> loc = ndimage.find_objects(a)[0]
>>> a[loc]
array([[1, 1, 0],
       [1, 1, 0],
       [0, 0, 1]])
