
    |h	                     *    d Z ddlZddlmZ dgZddZy)zb
The arraycrop module contains functions to crop values from the edges of an
n-dimensional array.
    N)Integralcropc                     t        j                   d       t        |t              r||gg j                  z  }nt        |d   t              r^t        |      dk(  r|d   |d   gg j                  z  }nt        |      dk(  r|g j                  z  }nmt        dt        |       d      t        |      dk(  r|d   g j                  z  }n3t        |       j                  k(  r|}nt        dt        |       d      t         fdt        |      D              }|rt        j                   |   |d	
      }|S  |   }|S )a3  Crop array `ar` by `crop_width` along each dimension.

    Parameters
    ----------
    ar : array-like of rank N
        Input array.
    crop_width : {sequence, int}
        Number of values to remove from the edges of each axis.
        ``((before_1, after_1),`` ... ``(before_N, after_N))`` specifies
        unique crop widths at the start and end of each axis.
        ``((before, after),) or (before, after)`` specifies
        a fixed start and end crop for every axis.
        ``(n,)`` or ``n`` for integer ``n`` is a shortcut for
        before = after = ``n`` for all axes.
    copy : bool, optional
        If `True`, ensure the returned array is a contiguous copy. Normally,
        a crop operation will return a discontiguous view of the underlying
        input array.
    order : {'C', 'F', 'A', 'K'}, optional
        If ``copy==True``, control the memory layout of the copy. See
        ``np.copy``.

    Returns
    -------
    cropped : array
        The cropped array. If ``copy=False`` (default), this is a sliced
        view of the input array.
    F)copyr         z"crop_width has an invalid length: zO
crop_width should be a sequence of N pairs, a single pair, or a single integerc              3   b   K   | ]&  \  }\  }}t        |j                  |   |z
         ( y w)N)sliceshape).0iabars       U/var/www/html/test/engine/venv/lib/python3.12/site-packages/skimage/util/arraycrop.py	<genexpr>zcrop.<locals>.<genexpr>C   s,     OFQ5BHHQK!O,Os   ,/T)orderr   )	nparray
isinstancer   ndimlen
ValueErrortuple	enumerate)r   
crop_widthr   r   cropsslicescroppeds   `      r   r   r      sO   : 
"5	!B*h'j)*RWW4	JqM8	,z?a mZ]34rww>E_!L277*E4S_4E F5 6 
 
ZA	A"'')	ZBGG	#0Z0A B1 2
 	
 Oi>NOOF((2f:U> N V*N    )FK)__doc__numpyr   numbersr   __all__r    r    r   <module>r'      s   
  (<r    