ó
    Eñi1  ã                   ó   • S SK rS r\4S jrg)é    Nc           	      óz  ^• [         R                  " U 5      n [        U 5      n[         R                  " [         R                  " U 5      5      n[         R                  " U 5      n[        [         R                  " U 5      5      nXQ::  a  [        S5      4U-  $ [         R                  " X%U-  SU-  -  SS9nXF:  R                  5       (       ai  [        U5       HZ  nXG   Xg'   [        [         R                  " XGS-   S 5      5      nXQ-  SX'-
  S-
  -  -  XgS-   S& XF:¬  R                  5       (       d  MZ    O   US-  R                  [        5      n[         R                  " U5      R                  [        5      n[        X†5       V	V
s/ s H  u  pš[        U	SU
5      PM     sn
n	m[!        U4S jU 5       5      mT$ s  sn
n	f )a  Find `n_points` regularly spaced along `ar_shape`.

The returned points (as slices) should be as close to cubically-spaced as
possible. Essentially, the points are spaced by the Nth root of the input
array size, where N is the number of dimensions. However, if an array
dimension cannot fit a full step size, it is "discarded", and the
computation is done for only the remaining dimensions.

Parameters
----------
ar_shape : array-like of ints
    The shape of the space embedding the grid. ``len(ar_shape)`` is the
    number of dimensions.
n_points : int
    The (approximate) number of points to embed in the space.

Returns
-------
slices : tuple of slice objects
    A slice along each dimension of `ar_shape`, such that the intersection
    of all the slices give the coordinates of regularly spaced points.

    .. versionchanged:: 0.14.1
        In scikit-image 0.14.1 and 0.15, the return type was changed from a
        list to a tuple to ensure `compatibility with Numpy 1.15`_ and
        higher. If your code requires the returned result to be a list, you
        may convert the output of this function to a list with:

        >>> result = list(regular_grid(ar_shape=(3, 20, 40), n_points=8))

        .. _compatibility with NumPy 1.15: https://github.com/numpy/numpy/blob/master/doc/release/1.15.0-notes.rst#deprecations

Examples
--------
>>> ar = np.zeros((20, 40))
>>> g = regular_grid(ar.shape, 8)
>>> g
(slice(5, None, 10), slice(5, None, 10))
>>> ar[g] = 1
>>> ar.sum()
8.0
>>> ar = np.zeros((20, 40))
>>> g = regular_grid(ar.shape, 32)
>>> g
(slice(2, None, 5), slice(2, None, 5))
>>> ar[g] = 1
>>> ar.sum()
32.0
>>> ar = np.zeros((3, 20, 40))
>>> g = regular_grid(ar.shape, 8)
>>> g
(slice(1, None, 3), slice(5, None, 10), slice(5, None, 10))
>>> ar[g] = 1
>>> ar.sum()
8.0
Ng      ð?Úfloat64©Údtypeé   é   c              3   ó.   >#   • U  H
  nTU   v •  M     g 7f)N© )Ú.0ÚiÚslicess     €ÚW/home/mande/repo/quber/.venv/lib/python3.13/site-packages/skimage/util/_regular_grid.pyÚ	<genexpr>Úregular_grid.<locals>.<genexpr>O   s   øé € Ð6¢o �6˜!–9¢oùs   ƒ)ÚnpÚ
asanyarrayÚlenÚargsortÚsortÚfloatÚprodÚsliceÚfullÚanyÚrangeÚallÚastypeÚintÚroundÚzipÚtuple)Úar_shapeÚn_pointsÚndimÚunsort_dim_idxsÚsorted_dimsÚ
space_sizeÚ	stepsizesÚdimÚstartsÚstartÚstepr   s              @r   Úregular_gridr-      sw  ø€ ôr �}Š}˜XÓ&€HÜˆx‹=€DÜ—j’j¤§¢¨HÓ!5Ó6€OÜ—'’'˜(Ó#€KÜ”r—w’w˜xÓ(Ó)€JØÓÜ�d“ˆ~ Ñ$Ð$Ü—’˜¨HÑ4¸#À¹*ÑEÈYÑW€IØÑ×$Ñ$×&Ñ&Ü˜–;ˆCØ(Ñ-ˆI‰NÜœrŸwšw {¸±7°9Ð'=Ó>Ó?ˆJØ$.Ñ$9¸sÀdÁjÐSTÁnÑ?UÑ#VˆI˜A‘g�iÐ ØÑ(×-Ñ-×/Ó/Ùñ ð ˜1‰n×$Ñ$¤SÓ)€FÜ—’˜Ó#×*Ñ*¬3Ó/€IÜ:=¸fÔ:PÔQÒ:P©;¨5Œe�E˜4 Ö&Ñ:PÒQ€FÜÔ6¡oÓ6Ó6€FØ€Mùó Rs   ÆF7c                 óÔ   • [        X5      n[        R                  " XS9nS[        R                  " [        R                  " XC   R
                  5      XC   R                  5      -   XC'   U$ )a  Return an image with ~`n_points` regularly-spaced nonzero pixels.

Parameters
----------
ar_shape : tuple of int
    The shape of the desired output image.
n_points : int
    The desired number of nonzero points.
dtype : numpy data type, optional
    The desired data type of the output.

Returns
-------
seed_img : array of int or bool
    The desired image.

Examples
--------
>>> regular_seeds((5, 5), 4)
array([[0, 0, 0, 0, 0],
       [0, 1, 0, 2, 0],
       [0, 0, 0, 0, 0],
       [0, 3, 0, 4, 0],
       [0, 0, 0, 0, 0]])
r   r   )r-   r   ÚzerosÚreshapeÚarangeÚsizeÚshape)r"   r#   r   ÚgridÚseed_imgs        r   Úregular_seedsr6   S   sX   € ô4 ˜Ó+€DÜ�xŠx˜Ñ.€HØœŸšÜ
�	Š	�(‘.×%Ñ%Ó&¨©×(<Ñ(<óñ €H�Nð €Oó    )Únumpyr   r-   r   r6   r
   r7   r   Ú<module>r9      s   ðÛ òLð^ -0õ r7   